Suggested path: start with fundamentals, then move through control flow, functions and data, and finally the async and robotics-facing material.

Program structure

The parser recognizes these top-level forms: functions, imports, shared globals, external functions, structs, and enums. Public functions and async functions are handled explicitly by the parser.

fn main() -> int {
    return 0;
}

Functions

Functions use fn, a name, a parameter list, an optional -> return type, and a block body. Parameters are written as name: type. The parser also supports pub fn and async fn.

fn add(a: int, b: int) -> int {
    a + b
}

async fn compute(x: int) -> int {
    return await other(x);
}

Types

The inspected parser directly handles these type forms.

Surface formParser behavior
intParsed as Type::Int.
i64Parsed as Type::I64.
boolParsed as Type::Bool.
stringParsed as Type::String.
voidParsed as Type::Void.
NameParsed as a named type.
Name<T, U>Named types may carry one or more recursively parsed type arguments.
[T; 10]Parsed as a fixed-size array; the size must be an integer literal.
*mut TParsed as a pointer type; the parser requires mut after *.
The current parser source inspected here does not directly establish a separate float/f64 type spelling, so this page does not mark those forms as verified.

Statements and blocks

The parser has dedicated statement parsers for let, return, arena, loop, while, break, continue, and for. Other expressions can appear as expression statements.

let x: int = 10;

while x > 0 {
    break;
}

for i = 0 .. 10 {
    continue;
}

A block may also end in a tail expression; the parser stores that expression separately from ordinary statements.

Expressions and operators

The parser handles literals, variables, calls, assignments, field access, enum access, arrays and indexing, unary operations, binary operations, conditionals, match expressions, and async/await expressions. The AST also contains additional expression variants such as struct initialization and casts.

The binary-operator parser recognizes logical, comparison, and arithmetic operators including ||, &&, ==, !=, <, <=, >, >=, +, -, *, /, and %. Assignment is parsed separately and is right-associative in the parser implementation.

The inspected unary parser explicitly handles dereference with *expr, address-of with &mut expr, and unary operators including negation and logical-not.

Postfix parsing supports calls, field access with ., and indexing with [...]. Names followed by :: are parsed through enum/module-style access.

Match patterns

The AST supports variant patterns, wildcard patterns, integer, boolean and string patterns, multiple patterns, integer ranges, and bindings.

match value {
    1 => ...
    3..5 => ...
    _ => ...
}

Verified parser forms include _, integer literals, inclusive integer ranges written start..=end, boolean and string literals, identifier/variant patterns, multiple patterns separated by |, and nested variant subpatterns.

Async and await

The parser recognizes async fn functions and an await expression form. The supplied project material also contains async test programs, but runtime/channel behavior is documented separately from the core syntax reference.

async fn add(x: int, y: int) -> int {
    return x + y;
}

async fn main_async() -> int {
    return await add(10, 20);
}

Reference status

This page is source-derived. “Verified” here means the construct is directly supported by the inspected parser/AST material; it is not a claim that the implementation is a frozen language specification. Lexer token definitions and parser tests will be audited next to complete the reference.