From d1e5090803978a55d244be7c56fec4ad2b43238c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Pasteur?= Date: Thu, 17 Jun 2010 09:22:26 +0200 Subject: [PATCH] Compile fix --- global/ident.ml | 2 +- heptagon/heptagon.ml | 2 +- heptagon/parsing/parsetree.ml | 8 ++++---- heptagon/parsing/scoping.ml | 18 ++++++++++-------- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/global/ident.ml b/global/ident.ml index 157af1d..152726c 100644 --- a/global/ident.ml +++ b/global/ident.ml @@ -80,4 +80,4 @@ module IdentSet = struct end -let print_ident ff id = fprintf ff "%s" (name id) +let print_ident ff id = Format.fprintf ff "%s" (name id) diff --git a/heptagon/heptagon.ml b/heptagon/heptagon.ml index 83697e1..d4c45e0 100644 --- a/heptagon/heptagon.ml +++ b/heptagon/heptagon.ml @@ -229,7 +229,7 @@ let switch e l = eqmake (Eswitch (e, l)) let op_from_app app = match app.a_op with - | Ecall ((op, _, Eop), _) -> op_from_app_name op + | Ecall ( { op_name = op; op_kind = Eop }, _) -> op_from_app_name op | _ -> raise Not_static let rec size_exp_of_exp e = diff --git a/heptagon/parsing/parsetree.ml b/heptagon/parsing/parsetree.ml index 17291a8..4512065 100644 --- a/heptagon/parsing/parsetree.ml +++ b/heptagon/parsing/parsetree.ml @@ -174,14 +174,14 @@ let mk_exp desc = let mk_app op = { a_op = op; } +let mk_op_desc ln params kind = + { op_name = ln; op_params = params; op_kind = kind } + let mk_call desc exps = Eapp (mk_app (Ecall desc), exps) let mk_op_call s params exps = - mk_call (Name s, params, Eop) exps - -let mk_op_desc ln params kind = - { op_name = ln; op_params = params; op_kind = kind } + mk_call (mk_op_desc (Name s) params Eop) exps let mk_array_op_call op exps = Eapp (mk_app (Earray_op op), exps) diff --git a/heptagon/parsing/scoping.ml b/heptagon/parsing/scoping.ml index e9f6572..37c3379 100644 --- a/heptagon/parsing/scoping.ml +++ b/heptagon/parsing/scoping.ml @@ -110,7 +110,7 @@ let translate_const = function let op_from_app loc app = match app.a_op with - | Ecall (op, _, Eop) -> op_from_app_name op + | Ecall { op_name = op; op_kind = Eop } -> op_from_app_name op | _ -> Error.message loc Error.Estatic_exp_expected let check_const_vars = ref true @@ -146,13 +146,16 @@ and translate_app const_env env app = | Efby -> Heptagon.Efby | Earrow -> Heptagon.Earrow | Eifthenelse -> Heptagon.Eifthenelse - | Ecall (ln, params, k) -> - let params = List.map (translate_size_exp const_env) params in - Heptagon.Ecall ((ln, params, translate_op_kind k), None) + | Ecall desc -> Heptagon.Ecall (translate_op_desc const_env desc, None) | Efield_update f -> Heptagon.Efield_update f | Earray_op op -> Heptagon.Earray_op (translate_array_op const_env env op) in { Heptagon.a_op = op; } + +and translate_op_desc const_env desc = + { Heptagon.op_name = desc.op_name; + Heptagon.op_params = List.map (translate_size_exp const_env) desc.op_params; + Heptagon.op_kind = translate_op_kind desc.op_kind } and translate_array_op const_env env = function | Eselect e_list -> Heptagon.Eselect (List.map (translate_size_exp const_env) e_list) @@ -161,10 +164,9 @@ and translate_array_op const_env env = function | Eselect_slice -> Heptagon.Eselect_slice | Econcat -> Heptagon.Econcat | Eselect_dyn -> Heptagon.Eselect_dyn - | Eiterator (it, (ln, params, k)) -> - let params = List.map (translate_size_exp const_env) params in - Heptagon.Eiterator (translate_iterator_type it, - (ln, params, translate_op_kind k), None) + | Eiterator (it, desc) -> + Heptagon.Eiterator (translate_iterator_type it, + translate_op_desc const_env desc, None) and translate_desc loc const_env env = function | Econst c -> Heptagon.Econst (translate_const c)