Skip to content

Language reference

Gremlin is a small language for fixed-width integer programs. It has a readable source form and a schema-version-1 JSON IR; both can represent branches and loops. Source modules can also make typed internal calls and recurse.

AreaContract
Valuesbool, u8/u16/u32/u64, and i8/i16/i32/i64
Function interfaceZero to four integer arguments and one integer return value
ExpressionsPrefix calls with explicit types—no implicit conversions, inference, casts, or infix expressions
Control flowif, while, loop, break, and continue
ExecutionA bounded, deterministic step budget and call-depth limit
fn candidate(x: u64) -> u64 {
let a: u64 = xor(x, 0x12345678u64);
let b: u64 = mul(a, 7u64);
return add(b, 3u64);
}

Every operation is written as a call, and every binding declares its type. See the affine example in the repository for the complete file.