Cryn
A compiled, statically typed systems language with a tiny core.
The machine has cells, connections, focus, one working value, and a value stack.
37 English commands. No symbolic operators, no semicolons, no braces.
Whitespace and indentation have no meaning.
Static types with defined behavior: fixed-width integers, IEEE floats, overflow wraps, division by zero aborts, float-to-int saturates, indexing is bounds-checked.
Files are first-class handles with read, write, both, and append modes.
Example
define main
set 10
push
set 20
add
output
return
end
The machine
- Cells and connections are a graph of typed memory cells. A cell holds one value and connects to other cells by name or by index. Arrays are indexed connections. Linked lists are stored as addresses in cells. There is no separate struct keyword. The world is the collection of all cells.
- Focus identifies the currently selected cell. move navigates by name or index and anchors the focus. back returns to the previous focus. home returns to the frame root. The focus is a stack of cell references, with the frame root at the bottom.
- Working value is one typed value that commands read, write, and compute on. It is the only immediate value in the machine. It is also the return value of a transformation.
- Value stack saves values while the working value does something else. It is also used for passing arguments to calls. Push, pop, swap. The stack must be empty at return. The checker enforces this at every program point.
- Control flow uses compare to set a condition, then jump label or jump label when less or greater or equal. mark defines labels. Loops are backward jumps. There is no if, while, or for. The checker tracks the working value type, focus, and stack shape at every label. All paths reaching a label must agree.
- Threads use spawn to start a zero-parameter transformation in a new thread, and wait to join all spawned threads and synchronize memory. Communication is through shared world cells and heap blocks. A race on an aligned cell of eight bytes or less yields an unspecified value of the cell's type and never tears. exchange is an atomic swap of the working value with the focused cell, the only ordering primitive besides wait, and enough to build locks.
Compiler
The bootstrap compiler is portable ISO C11 with no dependencies beyond a C compiler and pthreads.
It lowers Cryn source through a typed IR to readable C, then invokes the host C compiler to produce a native executable.
Both GCC and Clang are supported as host compilers.
No runtime is needed after compilation. The generated program is a normal executable with no graph overhead, no garbage collector, and no VM.
Get it
Repository ·
Tutorial ·
Language reference ·
Architecture
View this webpage's source (ARR)