Commit 8fe77fdf authored by Raphaël Cauderlier's avatar Raphaël Cauderlier
Browse files

No ; after last record field

parent c01870cc
%{
open Parsetree
let rec insert k v = function
let rec insert (k, v) = function
| [] -> [(k, v)]
| (k', v') :: l when k < k' -> (k, v) :: (k', v') :: l
| (k', _) :: l when k = k' -> (k, v) :: l
......@@ -34,12 +34,16 @@ ty: CID { Tcid (Cid ($1)) }
| ty ARR ty { Tarr ($1, $3) }
;
type_elems: /* empty */ { [] }
| ID COLUMN ty SEMICOLUMN type_elems { insert (Label $1) $3 $5 }
type_elem: ID COLUMN ty { (label ($1), $3) };
several_type_elems: type_elem { [$1] }
| type_elem SEMICOLUMN several_type_elems { insert ($1) ($3) }
;
type_elems: /* empty */ { [] }
| several_type_elems { $1 }
;
term: ID { Var (Id ($1)) }
| LPAR term RPAR { Par ($2) }
obj: ID { Var (Id ($1)) }
| LPAR term RPAR { Par ($2) }
| LBRACK obj_elems RBRACK { Obj ($2) }
......@@ -56,8 +60,14 @@ term: obj { $1 }
meth: SIGMA LPAR ID COLUMN ty RPAR term { Method (Id ($3), $5, $7) }
;
obj_elems: /* empty */ { [] }
| ID EQUAL meth SEMICOLUMN obj_elems { insert (Label ($1)) $3 $5 }
obj_elem: ID EQUAL meth { (label ($1), $3) };
several_obj_elems: obj_elem { [ $1 ]}
| obj_elem SEMICOLUMN several_obj_elems { insert ($1) ($3) }
;
obj_elems: /* empty */ { [] }
| several_obj_elems { $1 }
;
%%
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