Fixed conflict in parsing with split

This commit is contained in:
Cédric Pasteur 2011-05-02 09:59:24 +02:00
parent 2b2cba8e2d
commit ebf8b354bd
4 changed files with 9 additions and 10 deletions

View file

@ -99,10 +99,6 @@ slist(S, x) :
delim_slist(S, L, R, x) :
| {[]}
| L l=slist(S, x) R {l}
/* Separated list with delimiter, even for empty list*/
adelim_slist(S, L, R, x) :
| L R {[]}
| L l=slist(S, x) R {l}
/*Separated Nonempty list */
snlist(S, x) :
| x=x {[x]}
@ -112,6 +108,10 @@ optsnlist(S,x) :
| x=x {[x]}
| x=x S {[x]}
| x=x S r=optsnlist(S,x) {x::r}
/* Separated list with delimiter, even for empty list*/
adelim_slist(S, L, R, x) :
| L R {[]}
| L l=snlist(S, x) R {l}
%inline tuple(x) : LPAREN h=x COMMA t=snlist(COMMA,x) RPAREN { h::t }
%inline soption(P,x):
@ -442,7 +442,7 @@ _exp:
/* node call*/
| n=qualname p=call_params LPAREN args=exps RPAREN
{ Eapp(mk_app (Enode n) p , args) }
| SPLIT n=exp e=exp
| SPLIT n=ident LPAREN e=exp RPAREN
{ Esplit(n, e) }
| NOT exp
{ mk_op_call "not" [$2] }

View file

@ -77,7 +77,7 @@ and edesc =
| Eiterator of iterator_type * app * exp * exp list * exp list
| Ewhen of exp * constructor_name * var_name
| Emerge of var_name * (constructor_name * exp) list
| Esplit of exp * exp
| Esplit of var_name * exp
and app = { a_op: op; a_params: exp list; }

View file

@ -111,10 +111,9 @@ and edesc funs acc ed = match ed with
| Ewhen (e, c, x) ->
let e, acc = exp_it funs acc e in
Ewhen (e, c, x), acc
| Esplit (e1, e2) ->
let e1, acc = exp_it funs acc e1 in
| Esplit (x, e2) ->
let e2, acc = exp_it funs acc e2 in
Esplit(e1, e2), acc
Esplit(x, e2), acc
| Eapp (app, args) ->
let app, acc = app_it funs acc app in
let args, acc = mapfold (exp_it funs) acc args in

View file

@ -287,7 +287,7 @@ and translate_desc loc env = function
List.map fun_c_e c_e_list in
Heptagon.Emerge (x, c_e_list)
| Esplit (x, e1) ->
let x = translate_exp env x in
let x = translate_exp env (mk_exp (Evar x) loc) in
let e1 = translate_exp env e1 in
Heptagon.Esplit(x, e1)