Skip to main content

Module parse

Module parse 

Source
Expand description

Precedence-climbing parser, lowering straight to the tatara-lisp quoted form.

The load-bearing design decision, made here and once: the parser’s output IS a tatara_lisp::Sexp. There is no private blue AST that later gets converted. That is Tenet 1 — blue source parses to tatara-lisp — and building it any other way would make homoiconicity a conversion step rather than an identity, which is the difference between blue’s macro story working and merely being claimed.

The consequence to keep in view: every surface construct must have a well-defined s-expression it means. Where the mapping is not obvious it is written down in the test module, because the tests are the specification of the surface until the mechanized spec exists.

Structs§

Comment
A comment, and where it sat.
Infix
What an infix operator binds like, and what it lowers to.
ParseError

Constants§

INFIX
The complete infix table. Precedence follows Ruby’s where Ruby has an opinion; |> (below) sits under everything so a |> f |> g chains without parentheses.
LOWERED_ASSERT
Every surface keyword that BEGINS an expression.
LOWERED_CONCAT
The callee string interpolation lowers to.
LOWERED_MAP
The callee a {...} map literal lowers to.
MAX_EXPR_DEPTH
Maximum expression nesting before the parser refuses.
SURFACE_KEYWORDS

Functions§

comments
Every comment in src, with its byte span and whether it sits alone on its line.
parse_expr
Parse a single blue expression. Convenience for tests and the REPL.
parse_program
Parse a blue program into a sequence of tatara-lisp forms.
parse_program_spanned
Parse, keeping each top-level form’s source span.