15 lines
436 B
Plaintext
15 lines
436 B
Plaintext
LambdaTerm = Application / Abstraction / Variable
|
|
|
|
Application = LPAREN _ left:LambdaTerm _ right:LambdaTerm RPAREN { return { application: { left, right } }; }
|
|
|
|
Abstraction = LPAREN _ LAMBDA _ param:Variable _ DOT _ body:LambdaTerm RPAREN { return { abstraction: { param, body } }; }
|
|
|
|
Variable = param:[a-zA-Z0-9]+ { return param.join(""); }
|
|
|
|
LPAREN = "("
|
|
RPAREN = ")"
|
|
DOT = "."
|
|
LAMBDA = "λ" / "\\"
|
|
|
|
_ = ("\n" / " " / "\t" / "\r\n")*
|