Expand description
Recursive-descent parser for the throw-extended lambda calculus.
Grammar:
expr ::= seq_expr
seq_expr ::= right_expr (";" right_expr)*
right_expr ::= lambda | let | fix | extend | throw_expr | try_expr | assign_expr
lambda ::= "\" ident "." expr
let ::= "let" ident "=" expr "in" expr
fix ::= "fix" ident "." expr
extend ::= "extend" atom object_lit
throw_expr ::= "throw" right_expr
try_expr ::= "try" right_expr "catch" ident "." right_expr
assign_expr ::= app_expr (":=" right_expr)?
app_expr ::= atom atom*
atom ::= base_atom ("." ident)*
base_atom ::= ident | "(" expr ")" | "ref" atom | "!" atom | object_lit
object_lit ::= "{" props? "}"
props ::= property ("," property)*
property ::= ident "=" right_exprPrecedence, loosest to tightest: ;, :=, application, field access,
prefix ref/!, atoms. The dot token is overloaded three ways: as the
lambda head separator (after \ident), the catch-arm separator (after
catch ident), and the field-access infix (after an atom). The parser
disambiguates by syntactic position.
Functionsยง
- parse
- Parse a full expression from a token slice.