1. Statements & Scope
Every statement must terminate with a semicolon (;). CalcLang operates with a single global scope:
-
let <id> = <expr>;
Declares a variable. Duplicate declarations are rejected by the semantic analyzer. A variable cannot reference itself in its own initializer. -
print <expr>;
Evaluates the expression and outputs the integer value followed by a newline. -
// comment
Single-line comments are ignored by the tokenizer.