Reference
Grammar and Surface Semantics
Look up syntax, contracts, layouts, algorithms, and exact behavior.
The grammar is PEG-based and statement-oriented. A source file is a sequence of class declarations and comments. Class bodies contain field definitions, functions, and a constructor. Function bodies contain definitions, reassignment, function calls, object construction, conditionals, loops, break, and return.
class Counter {
number value = 0;
constructor(number start) {
value = start;
}
func next() {
value = value + 1;
return value;
}
}Arithmetic expressions use conventional precedence by parsing additive tails over multiplicative terms. Boolean expressions compare two expressions with relational or equality operators. Function calls and scoped variables share the same scope prefix representation, which lets method calls and member access reuse the same scope-walk machinery.