diff --git a/compiler/heptagon/parsing/hept_parser.mly b/compiler/heptagon/parsing/hept_parser.mly index f86c698..8d5d7a4 100644 --- a/compiler/heptagon/parsing/hept_parser.mly +++ b/compiler/heptagon/parsing/hept_parser.mly @@ -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] } diff --git a/compiler/heptagon/parsing/hept_parsetree.ml b/compiler/heptagon/parsing/hept_parsetree.ml index 1f04bd3..41b74b3 100644 --- a/compiler/heptagon/parsing/hept_parsetree.ml +++ b/compiler/heptagon/parsing/hept_parsetree.ml @@ -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; } diff --git a/compiler/heptagon/parsing/hept_parsetree_mapfold.ml b/compiler/heptagon/parsing/hept_parsetree_mapfold.ml index 1b30c2d..3546530 100644 --- a/compiler/heptagon/parsing/hept_parsetree_mapfold.ml +++ b/compiler/heptagon/parsing/hept_parsetree_mapfold.ml @@ -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 diff --git a/compiler/heptagon/parsing/hept_scoping.ml b/compiler/heptagon/parsing/hept_scoping.ml index 3adf2bc..35c48eb 100644 --- a/compiler/heptagon/parsing/hept_scoping.ml +++ b/compiler/heptagon/parsing/hept_scoping.ml @@ -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)