Renamed exp_ty label to ty for consistency
This commit is contained in:
parent
5e73f46f7e
commit
cae8d39f3d
5 changed files with 20 additions and 20 deletions
|
@ -177,7 +177,7 @@ let switch x ci_eqs_list =
|
|||
| [] | (_, []) :: _ -> []
|
||||
| (_, (y, { e_ty = ty; e_loc = loc }) :: _) :: _ ->
|
||||
let ci_e_list, ci_eqs_list = split ci_eqs_list in
|
||||
(y, mk_exp ~exp_ty:ty ~loc:loc (Emerge(x, ci_e_list))) ::
|
||||
(y, mk_exp ~ty:ty ~loc:loc (Emerge(x, ci_e_list))) ::
|
||||
distribute ci_eqs_list in
|
||||
|
||||
check ci_eqs_list;
|
||||
|
@ -221,25 +221,25 @@ let rec translate env
|
|||
Heptagon.e_loc = loc } =
|
||||
match desc with
|
||||
| Heptagon.Econst c ->
|
||||
Env.const env (mk_exp ~loc:loc ~exp_ty:ty (Econst c))
|
||||
Env.const env (mk_exp ~loc:loc ~ty:ty (Econst c))
|
||||
| Heptagon.Evar x ->
|
||||
Env.con env x (mk_exp ~loc:loc ~exp_ty:ty (Evar x))
|
||||
Env.con env x (mk_exp ~loc:loc ~ty:ty (Evar x))
|
||||
| Heptagon.Epre(None, e) ->
|
||||
mk_exp ~loc:loc ~exp_ty:ty (Efby(None, translate env e))
|
||||
mk_exp ~loc:loc ~ty:ty (Efby(None, translate env e))
|
||||
| Heptagon.Epre(Some c, e) ->
|
||||
mk_exp ~loc:loc ~exp_ty:ty (Efby(Some c, translate env e))
|
||||
mk_exp ~loc:loc ~ty:ty (Efby(Some c, translate env e))
|
||||
| Heptagon.Efby ({ Heptagon.e_desc = Heptagon.Econst c }, e) ->
|
||||
mk_exp ~loc:loc ~exp_ty:ty (Efby(Some c, translate env e))
|
||||
mk_exp ~loc:loc ~ty:ty (Efby(Some c, translate env e))
|
||||
| Heptagon.Estruct f_e_list ->
|
||||
let f_e_list = List.map
|
||||
(fun (f, e) -> (f, translate env e)) f_e_list in
|
||||
mk_exp ~loc:loc ~exp_ty:ty (Estruct f_e_list)
|
||||
mk_exp ~loc:loc ~ty:ty (Estruct f_e_list)
|
||||
| Heptagon.Eapp(app, e_list, reset) ->
|
||||
mk_exp ~loc:loc ~exp_ty:ty (Eapp (translate_app app,
|
||||
mk_exp ~loc:loc ~ty:ty (Eapp (translate_app app,
|
||||
List.map (translate env) e_list,
|
||||
translate_reset reset))
|
||||
| Heptagon.Eiterator(it, app, n, e_list, reset) ->
|
||||
mk_exp ~loc:loc ~exp_ty:ty
|
||||
mk_exp ~loc:loc ~ty:ty
|
||||
(Eiterator (translate_iterator_type it,
|
||||
translate_app app, n,
|
||||
List.map (translate env) e_list,
|
||||
|
@ -258,7 +258,7 @@ let rec rename_pat ni locals s_eqs = function
|
|||
let n_copy = Idents.fresh (sourcename n) in
|
||||
Evarpat n_copy,
|
||||
(mk_var_dec n_copy ty) :: locals,
|
||||
add n (mk_exp ~exp_ty:ty (Evar n_copy)) s_eqs
|
||||
add n (mk_exp ~ty:ty (Evar n_copy)) s_eqs
|
||||
) else
|
||||
Evarpat n, locals, s_eqs
|
||||
| Heptagon.Etuplepat(l), Tprod l_ty ->
|
||||
|
|
|
@ -129,8 +129,8 @@ type program = {
|
|||
|
||||
(*Helper functions to build the AST*)
|
||||
|
||||
let mk_exp ?(exp_ty = invalid_type) ?(clock = Cbase) ?(loc = no_location) desc =
|
||||
{ e_desc = desc; e_ty = exp_ty; e_ck = clock; e_loc = loc }
|
||||
let mk_exp ?(ty = invalid_type) ?(clock = Cbase) ?(loc = no_location) desc =
|
||||
{ e_desc = desc; e_ty = ty; e_ck = clock; e_loc = loc }
|
||||
|
||||
let mk_var_dec ?(loc = no_location) ?(clock = Cbase) ident ty =
|
||||
{ v_ident = ident; v_type = ty; v_clock = clock; v_loc = loc }
|
||||
|
|
|
@ -58,7 +58,7 @@ let is_op = function
|
|||
|
||||
let exp_list_of_static_exp_list se_list =
|
||||
let mk_one_const se =
|
||||
Minils.mk_exp ~exp_ty:se.se_ty (Minils.Econst se)
|
||||
Minils.mk_exp ~ty:se.se_ty (Minils.Econst se)
|
||||
in
|
||||
List.map mk_one_const se_list
|
||||
|
||||
|
|
|
@ -39,9 +39,9 @@ match l with
|
|||
| _ -> Etuplepat (List.map (fun vd -> Evarpat vd.v_ident) l)
|
||||
|
||||
let tuple_of_vd_list l =
|
||||
let el = List.map (fun vd -> mk_exp ~exp_ty:vd.v_type (Evar vd.v_ident)) l in
|
||||
let el = List.map (fun vd -> mk_exp ~ty:vd.v_type (Evar vd.v_ident)) l in
|
||||
let ty = Types.prod (List.map (fun vd -> vd.v_type) l) in
|
||||
mk_exp ~exp_ty:ty (Eapp (mk_app Etuple, el, None))
|
||||
mk_exp ~ty:ty (Eapp (mk_app Etuple, el, None))
|
||||
|
||||
let vd_of_arg ad =
|
||||
let n = match ad.a_name with None -> "_v" | Some n -> n in
|
||||
|
@ -68,10 +68,10 @@ let get_node_inp_outp app = match app.a_op with
|
|||
added equations. *)
|
||||
let mk_call app acc_eq_list =
|
||||
let new_inp, new_outp = get_node_inp_outp app in
|
||||
let args = List.map (fun vd -> mk_exp ~exp_ty:vd.v_type
|
||||
let args = List.map (fun vd -> mk_exp ~ty:vd.v_type
|
||||
(Evar vd.v_ident)) new_inp in
|
||||
let out_ty = Types.prod (List.map (fun vd -> vd.v_type) new_outp) in
|
||||
let e = mk_exp ~exp_ty:out_ty (Eapp (app, args, None)) in
|
||||
let e = mk_exp ~ty:out_ty (Eapp (app, args, None)) in
|
||||
match List.length new_outp with
|
||||
| 1 -> new_inp, e, acc_eq_list
|
||||
| _ ->
|
||||
|
|
|
@ -36,7 +36,7 @@ let equation (d_list, eq_list) e =
|
|||
let pat_list = List.map (fun n -> Evarpat n) var_list in
|
||||
let eq_list = (mk_equation (Etuplepat pat_list) e) :: eq_list in
|
||||
let e_list = List.map2
|
||||
(fun n ty -> mk_exp ~exp_ty:ty (Evar n)) var_list ty_list in
|
||||
(fun n ty -> mk_exp ~ty:ty (Evar n)) var_list ty_list in
|
||||
let e = Eapp(mk_app Etuple, e_list, None) in
|
||||
(d_list, eq_list), e
|
||||
| _ ->
|
||||
|
@ -287,9 +287,9 @@ and translate_list kind context e_list =
|
|||
|
||||
and fby kind context e v e1 =
|
||||
let mk_fby c e =
|
||||
mk_exp ~exp_ty:e.e_ty ~loc:e.e_loc (Efby(Some c, e)) in
|
||||
mk_exp ~ty:e.e_ty ~loc:e.e_loc (Efby(Some c, e)) in
|
||||
let mk_pre e =
|
||||
mk_exp ~exp_ty:e.e_ty ~loc:e.e_loc (Efby(None, e)) in
|
||||
mk_exp ~ty:e.e_ty ~loc:e.e_loc (Efby(None, e)) in
|
||||
match e1.e_desc, v with
|
||||
| Eapp({ a_op = Etuple } as app, e_list, r),
|
||||
Some { se_desc = Stuple se_list } ->
|
||||
|
|
Loading…
Reference in a new issue