Expand description
Recursive-descent parser for the extended lambda calculus surface syntax.
The grammar is:
expr ::= seq_expr
seq_expr ::= right_expr (";" right_expr)*
right_expr ::= lambda | let | fix | assign_expr
lambda ::= "\" ident "." expr
let ::= "let" ident "=" expr "in" expr
fix ::= "fix" ident "." expr
assign_expr ::= app_expr (":=" right_expr)?
app_expr ::= atom atom*
atom ::= ident | "(" expr ")" | "ref" atom | "!" atomPrecedence, from loosest to tightest: ;, :=, application, prefix
ref/!, atoms. Inside a lambda/let/fix body the parser admits a full
expr (so ; is consumed), but the right-hand side of := admits only
a right_expr, which keeps ; strictly above :=.
Functionsยง
- parse
- Parse a full expression from a token slice.