Commit 677a582e authored by Raphaël Cauderlier's avatar Raphaël Cauderlier
Browse files

Parse function applications

parent 35bb2e87
......@@ -18,6 +18,11 @@
let label l =
let l' = Label l in
Base.labels := insert1 l' !Base.labels; l'
let rec apply t = function
| [] -> t
| t1 :: tl -> apply (App (t, t1)) tl
%}
%token <string> ID CID SELECT UPDATE FUPD
......@@ -59,12 +64,18 @@ obj: ID { Var (Id ($1)) }
| LBRACK obj_elems RBRACK { Obj ($2) }
;
term: obj { $1 }
/* | term term { App ($1, $2) } */
sterm: obj { $1 }
| obj SELECT { Select ($1, label ($2)) }
;
app: /* empty */ { [] }
| sterm app { $1 :: $2 }
;
term: sterm app { apply $1 $2 }
| LAMBDA LPAR ID COLUMN ty RPAR term { Abst (Id ($3), $5, $7)}
| obj SELECT { Select ($1, label ($2)) }
| obj UPDATE meth { Update ($1, label ($2), $3) }
| obj FUPD term { Field_update ($1, label ($2), $3) }
| obj FUPD sterm { Field_update ($1, label ($2), $3) }
;
meth: SIGMA LPAR ID COLUMN ty RPAR term { Method (Id ($3), $5, $7) }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment