You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
520 B
25 lines
520 B
%token LEFT_PAR RIGHT_PAR |
|
%token <string> VAR |
|
%token DOT |
|
%token LAMBDA |
|
%token SPACE |
|
%left SPACE |
|
%token END |
|
|
|
%start <Lambda.term> termc |
|
|
|
%% |
|
|
|
(* |
|
mainc: |
|
| t = termc END { t }*) |
|
|
|
termc: |
|
| x = VAR { Lambda.to_var x } |
|
| LAMBDA ; x = VAR ; DOT; SPACE; t = termc { Lambda.to_lambda x t } |
|
| LEFT_PAR ; t = termc ; SPACE ; u = termc ; RIGHT_PAR { Lambda.to_app t u } |
|
| LEFT_PAR ; t = termc ; RIGHT_PAR { t } |
|
(*| tu = separated_pair (termc, SPACE, termc) {let (t, u) = tu in Lambda.to_app t u }*) |
|
|
|
(* %inline sp: |
|
| SPACE { ( ) } *) |