at15 / reika

[WIP] A DSL for query and benchmark TSDB
MIT License
1 stars 0 forks source link

[tapl][antlr] Untyped lambda-calculus is not parsed correctly when abstraction body contains application #7

Closed at15 closed 7 years ago

at15 commented 7 years ago

From #6 , we got trouble when parsing lambda-calculus when function body is a function application

(lambda x. x) (lambda x. x x); 

currently we have

term: ID # Var
    | 'lambda' ID '.' term # Abs
    | term term # App
    | '(' term ')' # Brackets
    ;

image

the function body is x x, but we didn't parse it correctly

at15 commented 7 years ago

after change the order of application and abstraction, we got the correct result

term: ID # Var
    | term term # App
    | 'lambda' ID '.' term # Abs
    | '(' term ')' # Brackets
    ;

image