LambdaTerm = Abstraction / Application / Variable Application = LPAREN _? left:LambdaTerm _? right:LambdaTerm _? RPAREN { return { left, right }; } Abstraction = LPAREN _? LAMBDA _? param:Variable _? DOT _? body:LambdaTerm _? RPAREN { return { param, body }; } Variable = name:([a-zA-Z][A-Z0-9a-z]*) { return { name: name[0] + name[1].join('') }; } LAMBDA = "λ" DOT = "." LPAREN = "(" RPAREN = ")" _ = (" " / "\n" / "\t" / "\t\n")+