We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Cryn

From Esolang
Jump to navigation Jump to search
Cryn
Paradigm(s) Imperative
Designed by Vextoly
Appeared in 2026
Computational class Turing complete
Reference implementation Cryn

Cryn is a statically typed imperative programming language created by Vextoly. It is designed around a small set of primitive operations and an explicit machine model.

Rather than providing the usual high-level constructs found in imperative languages, such as if, while, assignment operators, and conventional pointer syntax, Cryn exposes a small abstract machine directly. Programs manipulate a working value, navigate through cells using focus, and use a value stack for temporary values.

Despite this, Cryn is intended to be capable of writing general-purpose programs.

Syntax

Cryn uses English-like words instead of symbolic operators. Whitespace has no semantic meaning, and there are no semicolons or braces.

Comments are enclosed in [# and #].

Names consist of letters, digits, and underscores, must begin with a letter or underscore, and are case-sensitive.

The following program prints Hello, world!:

define main
    make string "Hello, world!\n" greeting
    address greeting
    output text
    return
end

Execution begins at the main transformation.

Machine model

Cryn is centered around four concepts.

The working value (wv) is the value currently being manipulated. Most operations either modify it or use it as an operand.

Cells are typed storage locations. They may be local to a transformation, global world cells, or heap allocations.

Focus identifies the cell currently being operated on. The move command changes the focus, while read and write operate on the focused cell.

The value stack stores temporary working values and is also used when passing arguments to transformations.

For example:

make int64 number

move number
set 42
write

read
output

Values and arithmetic

Cryn has signed and unsigned integers, floating-point numbers, characters, booleans, addresses, arrays, and transformation references.

Values are placed into the working value with set:

set 10
add 5
multiply 2

Arithmetic is performed using primitive commands such as add, subtract, multiply, divide, remainder, and negate.

Type conversion is explicit:

convert int32

Integer overflow wraps according to the width of the integer type. Floating-point to integer conversion saturates at the target type's range.

Control flow

Cryn does not have separate if, while, or for statements.

Instead, control flow is constructed from comparisons, labels, and jumps.

set 10
compare 20
jump smaller when less

set 0
jump done

mark smaller
set 1

mark done
output
return

compare records a three-way comparison. jump can test the result using conditions such as less, equal, greater, different, less-or-equal, and greater-or-equal.

The same mechanism can be used for loops:

set 0

mark loop
    add 1
    compare 10
    jump loop when less

output
return

Thus a loop is not a separate language construct; it is built from the same primitives as other control flow.

Transformations

Transformations are Cryn's functions. They may take typed parameters and optionally return a value.

define add int a int b result int
    move a
    read
    push

    move b
    read
    add

    return
end

Arguments are passed using the value stack and transformations are invoked with call.

Transformations may also be represented as values. Their addresses can be stored and later used for indirect calls.

Memory

Cryn exposes addresses explicitly.

make 10 of int64 buffer
address buffer

The resulting address refers to the allocated block. Addresses can be moved through objects using address arithmetic.

Heap allocations are released with free.

The runtime checks bounds and validates addresses. Accessing a freed allocation, freeing an invalid address, or moving outside an allocation produces a runtime error.

Input and output

input reads one byte from the current input stream.

input
output

output prints values according to their type. Byte sequences can be printed with output text.

make string "Hello!\n" text
address text
output text

Files are represented by numbered handles. They can be opened with open, selected with use, flushed with flush, and closed with close.

Cryn also provides system, which executes a command using the host system's shell.

Concurrency

Cryn provides basic concurrency through spawn and wait.

define worker
    ...
end

define main
    spawn worker
    wait
    return
end

Each spawned transformation runs in its own execution context. World cells and heap allocations can be shared between contexts.

The exchange command atomically swaps the working value with a focused cell and provides acquire/release synchronization.

Implementation

The reference implementation is a bootstrap compiler written in portable C11.

The compiler processes Cryn source in several stages:

Cryn source
    |
    v
lexer
    |
    v
parser
    |
    v
semantic checker
    |
    v
typed IR
    |
    v
optimizer
    |
    v
C backend
    |
    v
self-contained C11 source
    |
    v
host C compiler
    |
    v
native executable

The semantic checker models the Cryn machine and produces a typed intermediate representation. The C backend is separate from the semantic layer.

Examples

A simple counter can be written as:

define main
    make int64 counter

    move counter
    set 0
    write

    mark loop
        move counter
        read
        add 1
        write

        read
        output

        compare 10
        jump loop when less

    return
end

External resources