Add readme and tweak spec

This commit is contained in:
Nikita Lisitsa 2026-03-22 13:00:41 +03:00
parent d363be0eef
commit 78e6a5c0ee
2 changed files with 20 additions and 7 deletions

13
readme.md Normal file
View file

@ -0,0 +1,13 @@
This is the repository of an experimental toy programming language.
It is a statically & strictly-typed, imperative, eager-evaluated, low-level language, that should be efficient, simple but effective to use, and allow seamless C FFI.
What is currently done:
* Part of the base specification (see spec.txt)
* Bison-generated parser into AST
* Custom non-SSA IR
* Part of the AST -> IR compiler
* Aarch64 JIT compiler (independent from IR for now)
* Tree-walking interpreter (partially broken)
The project is currently in early stages and in active development. Inspecting its code might prove counter-productive; forking it is absolutely unnecessary.

View file

@ -25,7 +25,7 @@ Pointer types:
T mut** (pointer to const pointer to mutable T)
T mut* mut* (pointer to mutable pointer to mutable T)
Array types:
Array types:
T[N] array of N elements of type T (N must be a compile-time value)
Function types:
@ -50,7 +50,7 @@ Literals:
'a' -> u8 (ascii only?)
'猫'u -> u32
TODO: string literals? fixed-size arrays? built-in spans? Probably built-in spans (potentially defines in prelude.psl)
TODO: string literals? fixed-size arrays? built-in spans? Probably built-in spans (potentially defined in prelude.psl)
"hello, world" -> utf-8 string
"здарова, братки"u -> utf-32 string
@ -59,12 +59,12 @@ TODO: string literals? fixed-size arrays? built-in spans? Probably built-in span
Variable declaration:
const x = ... compile-time value, type inferred
const x: T = ... compile-time value of type T
let x = ... immutable value, type inferred
let x = ... immutable value, type inferred
let x: T = ... immutable value of type T
mut x = ... mutable, ...
mut x: T = ...
Array declaration:
Array declaration:
let arr: i32[4] = [12, 15, 65, 42]
let arr = [2, 5, 6] // size and type inferred as i32[3]
let arr: i32[0] = [] // need special empty array literal, type cannot be inferred
@ -85,11 +85,11 @@ Logical (only bool type):
x || y // short-circuit
x ^ y
Equality (all built-in types, all struct types, only same type):
Equality (all built-in types, all pointer types, all array/struct types, only same type):
x == y
x != y
Comparison (all built-in types, all struct types, only same type):
Comparison (all built-in types, all pointer types, all array/struct types, only same type):
x < y
x > y
x <= y
@ -159,7 +159,7 @@ Struct types:
Creating a struct value:
let x = rect(10u, 20u)
let y = rect(width = 10u, height = 20u)
let y = rect(width = 10u, height = 20u) // named function arguments in general?
Struct field access:
let r = rect(1u, 2u)