Expand description
The Python surface: recursive descent for statements, Pratt for expressions.
docs/02-syntax.md §2.8: “hand-written recursive descent +
Pratt for expressions. Not a parser generator. Rationale: error messages and error
recovery are the top-two UX properties of a new language.”
The output is the same Node tree the S-expression reader produces — that equivalence is
asserted directly in tests/surfaces.rs, and it is the whole claim of §2.2. Two surface rules
carry most of the weight:
- The block rule (§2.3): any call written
f(args):followed by an indented block desugars tof(args, do=quote(block)). That single rule buys the entire Lisp special-form vocabulary with Python punctuation —ui:,atomically:,retry(times=3):are all ordinary calls. - Decorators are AST transforms (§2.3):
@on(server)before adefbecomes(decorate (on server) (def ...)), so the decorator receives the definition’s AST rather than a function object.
Structs§
Functions§
- parse_
expr_ str - Parse a single expression — used by
beck astand by tests. - parse_
module - Parse a whole module.