2. Language basics
This chapter covers how to write tokens, represent values, bind variables and evaluate expressions.
- Lexical structure: comments, keywords, identifiers and escapes.
- Types and literals: booleans, numbers, strings, null, objects and lists.
- Numbers and precision: bases, numeric widths and rounding.
- Variables and assignment: declarations, rebinding and new data structures.
- Expressions and operators: arithmetic, comparisons, logic, bits and conditions.
var price = 20;
var quantity = 3;
var total = price * quantity;
return {"total": total, "discounted": total >= 50};
The result is {"total":60,"discounted":true}. Variables hold values, expressions calculate values, and objects organize output fields.