cinderkit build main.ck -o main.cdx # front half: lex, parse, check, codegen
cinderkit check main.ck # type-check only
cinderc build main.cdx -o main.cdxb # assemble + verify (cindervm)
cinderc run main.cdxb # execute
fn main() -> i32 {
let total = 2 + 3 * 4; // let binds a frame local
if total > 10 { // condition must be bool
return 1;
} else {
return 0;
}
}
fn name() -> i32|bool|void { ... }let name = <expr>;if <bool-expr> { ... } else { ... }while <bool-expr> { ... }— loops are metered automaticallyreturn <expr>;— must match the declared typehelper();— expression statements; calls pack their arguments
| Operator | Meaning | Codegen |
|---|---|---|
+ - * / |
wrapping arithmetic | add sub mul div |
< |
signed less-than | lt |
> |
signed greater-than | lt on swapped operands |
== |
structural equality | eq |
error[E_TYPE_MISMATCH]: return type must be i32, found bool (at line 3)
error[E_UNKNOWN_FN]: unknown function `helper` (at line 5)
error[E_MISSING_RETURN]: function `main` may reach the end without returning (at line 1)
cinderkit build examples/fib.ck -o fib.cdx
cinderc build fib.cdx -o fib.cdxb
cinderc run fib.cdxbSee also: the README for the design rationale.