diff --git a/src/ast2lic.ml b/src/ast2lic.ml index f54e7b5b0f522b30a560dfcd50948ae1c58c849b..09bef49bf4d699c54a94657a5524a605447ead08 100644 --- a/src/ast2lic.ml +++ b/src/ast2lic.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 04/02/2013 (at 21:10) by Erwan JAHIER> *) +(* Time-stamp: <modified the 06/02/2013 (at 16:56) by Erwan Jahier> *) open Lxm @@ -275,14 +275,12 @@ and check_static_arg let neff = of_node node_id_solver ne in NodeStaticArgLic (id, neff.node_key_eff) (* node exp vs node *) - | (StaticArgNode (Predef_n (op,sargs)), ASP_node id) -> - (* ICI : campagne de suppression de Lic.PREDEF_CALL: pas de macros ! *) - assert (sargs = []); - let opeff = LicEvalType.make_node_exp_eff node_id_solver None op.it sa.src [] in + | (StaticArgNode (Predef_n (op)), ASP_node id) -> + let opeff = LicEvalType.make_node_exp_eff node_id_solver None op.it sa.src in NodeStaticArgLic (id, opeff.node_key_eff) - | (_, ASP_type _) -> nature_error "type" + | (_, ASP_type _) -> nature_error "type" | (_, ASP_const _) -> nature_error "constant" - | (_, ASP_node _) -> nature_error "node" + | (_, ASP_node _) -> nature_error "node" in res ) @@ -406,31 +404,7 @@ and (translate_val_exp : Lic.id_solver -> UnifyClock.subst -> AstCore.val_exp let s, vef_core = match by_pos_op with (* put that in another module ? yes, see above.*) - | Predef_n(op, sargs) -> ( - (* 12/07 SOLUTION INTERMEDIAIRE - - les macros predefs ne sont plus traitées ici - on les transforme en CALL standard - N.B. on garde pour l'instant la notion de - PREDEF_CALL pour les op simple, mais à terme - ça devrait disparaitre aussi ... - *) - match sargs with - | [] -> s, mk_by_pos_op(PREDEF_CALL (op.it,[])) - | _ -> - (* on re-construit une AstCore.node_exp srcflagged - parce que c'est ca qu'attend of_node ... - *) - let node_exp_f = flagit (AstPredef.op_to_idref op.it, sargs) op.src in - let neff = of_node id_solver node_exp_f in - let ceff = Lic.CALL (flagit neff.node_key_eff node_exp_f.src) in - Verbose.exe ~flag:dbg (fun () -> - Printf.fprintf stderr "#DBG: Ast2lic.translate_val_exp CALL '%!"; - AstV6Dump.print_node_exp stderr node_exp_f.it; - Printf.fprintf stderr " gives type: %s\n%!" - (Lic.string_of_type_profile (profile_of_node_exp neff)) - ) ; - (s, mk_by_pos_op ceff) - ) + | Predef_n(op) -> s, mk_by_pos_op(PREDEF_CALL (op.it)) | CALL_n node_exp_f -> let neff = of_node id_solver node_exp_f in let ceff = Lic.CALL (flagit neff.node_key_eff node_exp_f.src) in @@ -556,9 +530,8 @@ and node_of_static_arg id_solver node_or_node_ident lxm = id_solver.id2node id sargs lxm | StaticArgNode(CALL_n ne) -> of_node id_solver ne - | StaticArgNode(Predef_n (op,[])) -> - LicEvalType.make_node_exp_eff id_solver None op.it lxm [] - | StaticArgNode(Predef_n (op,_)) -> assert false + | StaticArgNode(Predef_n (op)) -> + LicEvalType.make_node_exp_eff id_solver None op.it lxm | StaticArgNode(_) -> assert false diff --git a/src/astCore.ml b/src/astCore.ml index 4138f7412191174d2cf75794c41d668461cbaf7c..b54519677ef5b5ab901c9855f40ad4f58f2baa25 100644 --- a/src/astCore.ml +++ b/src/astCore.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 01/02/2013 (at 14:59) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/02/2013 (at 16:56) by Erwan Jahier> *) (** (Raw) Abstract syntax tree of source Lustre Core programs. *) @@ -88,7 +88,7 @@ and slice_info = { and by_pos_op = (* zeroaire *) - | Predef_n of AstPredef.op srcflagged * static_arg srcflagged list (* e.g., map<<toto,3>> *) + | Predef_n of AstPredef.op srcflagged | CALL_n of node_exp srcflagged (* e.g., a_node<<xx>> *) | IDENT_n of Ident.idref (* constant or variable *) diff --git a/src/astRecognizePredef.ml b/src/astRecognizePredef.ml index 842fbc75c3199a8332c5816ecd30620bd138bbd5..9f2700a7c9edcb2f90c15659343750e0da998673 100644 --- a/src/astRecognizePredef.ml +++ b/src/astRecognizePredef.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 01/02/2013 (at 15:00) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/02/2013 (at 17:00) by Erwan Jahier> *) let (get_predef : Ident.idref -> AstPredef.op option) = @@ -37,9 +37,9 @@ and r_pack_info pi = { pi with pa_def = r_pack_def pi.pa_def } and r_model_info mi = { mi with - mo_needs = List.map (flag r_static_param) mi.mo_needs; - mo_provides = r_item_info_flg_list mi.mo_provides; - mo_body = r_packbody mi.mo_body; + mo_needs = List.map (flag r_static_param) mi.mo_needs; + mo_provides = r_item_info_flg_list mi.mo_provides; + mo_body = r_packbody mi.mo_body; } and r_pack_def = function @@ -60,49 +60,48 @@ and r_by_name_static_arg (id,arg) = let arg_it = match arg.it with | StaticArgIdent(idref) -> ( - match get_predef idref with - | None -> StaticArgIdent idref - | Some predef -> StaticArgNode (Predef_n (flagit predef arg.src,[])) - ) + match get_predef idref with + | None -> StaticArgIdent idref + | Some predef -> StaticArgNode (Predef_n (flagit predef arg.src)) + ) | StaticArgConst(ve) -> StaticArgConst(r_val_exp ve) | StaticArgType(te) -> StaticArgType(te) | StaticArgNode(by_pos_op) -> StaticArgNode(r_by_pos_op (flagit by_pos_op arg.src)) in - id, Lxm.flagit arg_it arg.src + id, Lxm.flagit arg_it arg.src and r_static_arg arg = match arg.it with | StaticArgIdent(idref) -> ( - match get_predef idref with - | None -> StaticArgIdent idref - | Some predef -> StaticArgNode (Predef_n (flagit predef arg.src,[])) - ) + match get_predef idref with + | None -> StaticArgIdent idref + | Some predef -> StaticArgNode (Predef_n (flagit predef arg.src)) + ) | StaticArgConst(ve) -> StaticArgConst(r_val_exp ve) | StaticArgType(te) -> StaticArgType(te) | StaticArgNode(by_pos_op) -> StaticArgNode(r_by_pos_op (flagit by_pos_op arg.src)) and r_by_pos_op arg = - match arg.it with - | Predef_n(op,args) -> Predef_n(op,args) (* assert false *) - | CALL_n { src=lxm;it=(idref,sargs) } -> ( + match arg.it with + | CALL_n { src=lxm;it=(idref,sargs) } -> ( match get_predef idref with - | None -> CALL_n { src=lxm;it= r_node_exp (idref,sargs) } - | Some op -> Predef_n (flagit op arg.src, List.map (flag2 r_static_arg) sargs) + | None -> CALL_n { src=lxm;it= r_node_exp (idref,sargs) } + | Some op -> assert (sargs=[]); Predef_n (flagit op arg.src) ) - | IDENT_n(idref) -> ( + | IDENT_n(idref) -> ( match get_predef idref with - | None -> IDENT_n(idref) - | Some op -> Predef_n (flagit op arg.src,[]) + | None -> IDENT_n(idref) + | Some op -> Predef_n (flagit op arg.src) ) - | ARRAY_ACCES_n(val_exp) -> ARRAY_ACCES_n(r_val_exp val_exp) - | ARRAY_SLICE_n(slice_info) -> ARRAY_SLICE_n(r_slice_info slice_info) + | ARRAY_ACCES_n(val_exp) -> ARRAY_ACCES_n(r_val_exp val_exp) + | ARRAY_SLICE_n(slice_info) -> ARRAY_SLICE_n(r_slice_info slice_info) - | x -> x + | x -> x and r_node_exp (idref, sargs) = (idref, List.map (flag2 r_static_arg) sargs) - + and r_slice_info si = { si_first = r_val_exp si.si_first; si_last = r_val_exp si.si_last; @@ -118,7 +117,7 @@ and r_val_exp = function let cl = List.map (fun (id,ve) -> (id, r_val_exp ve)) cl in Merge_n (ec,cl) | Merge_bool_n(id, t, f) -> Merge_bool_n(id, r_val_exp t, r_val_exp f) - + and r_item_info_flg_list = function | None -> None | Some iil -> Some (List.map (flag r_item_info) iil) @@ -162,7 +161,7 @@ and r_node_def = function and r_packbody pb = Hashtbl.iter (fun id i -> Hashtbl.replace pb.pk_const_table id (flag r_const_info i)) - pb.pk_const_table; + pb.pk_const_table; Hashtbl.iter (fun id i -> Hashtbl.replace pb.pk_type_table id (flag r_type_info i)) pb.pk_type_table; diff --git a/src/astV6Dump.ml b/src/astV6Dump.ml index 932820bcc744a6638f0fe94637ed7ca2fac9efa0..1c6474dd9c0f50358b90106baded8b4b21694a2c 100644 --- a/src/astV6Dump.ml +++ b/src/astV6Dump.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 01/02/2013 (at 17:51) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/02/2013 (at 17:00) by Erwan Jahier> *) open Lxm @@ -15,9 +15,7 @@ let rec (op2string : AstCore.by_pos_op -> string) = fun op -> match op with (* unaires *) - | Predef_n(op,sargs) -> (AstPredef.op2string op.it) ^ - (if sargs = [] then "" else - "<<" ^ (String.concat ", " (List.map static_arg_to_string sargs)) ^ ">>") + | Predef_n(op) -> (AstPredef.op2string op.it) | (CALL_n ne) -> string_of_node_exp ne.it | (PRE_n ) -> "pre" | (CURRENT_n) -> "current" @@ -357,10 +355,10 @@ and dump_val_exp (os: Format.formatter) (x: val_exp) = ( | CallByPos ( {it=oper; src=lxm} , pars ) -> dump_by_pos_exp os oper pars | CallByName ({it=oper; src=lxm},nm_pars) -> dump_by_name_exp os oper nm_pars | Merge_n (id, _) -> (* finish me *) - fprintf os "merge %s (...) " (Ident.to_string id.it) + fprintf os "merge %s (...) " (Ident.to_string id.it) | Merge_bool_n(id, t, f) -> - fprintf os "merge %s (true -> %a) (false -> %a)" - (Ident.to_string id.it) dump_val_exp t dump_val_exp f + fprintf os "merge %s (true -> %a) (false -> %a)" + (Ident.to_string id.it) dump_val_exp t dump_val_exp f ) and dump_val_exp_list (os : formatter) (xl: val_exp list) = ( match xl with @@ -381,7 +379,7 @@ and dump_by_pos_exp (os: Format.formatter) (oper: by_pos_op) (pars: operands) = | (FBY_n, Oper [p0;p1]) -> dump_binary_exp os "fby" p0 p1 | (WHEN_n _, Oper [p0;p1]) -> dump_binary_exp os "when" p0 p1 - | (Predef_n (x,_), _) -> ( + | (Predef_n (x), _) -> ( match (x.it, pars) with | (TRUE_n, Oper []) -> dump_leaf_exp os "true" | (FALSE_n, Oper []) -> dump_leaf_exp os "false" diff --git a/src/evalClock.ml b/src/evalClock.ml index 42014c7f0e3ef4667e02a14c67a6776b04cda1b8..3e8482fb3e52bb6afcfaac7b67558778a0d8f547 100644 --- a/src/evalClock.ml +++ b/src/evalClock.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 04/02/2013 (at 20:53) by Erwan JAHIER> *) +(* Time-stamp: <modified the 06/02/2013 (at 16:46) by Erwan Jahier> *) open AstPredef @@ -386,7 +386,7 @@ and (eval_by_pos_clock : Lic.id_solver -> Lic.by_pos_op -> Lxm.t -> Lic.val_exp let (_,clk,s) = f_aux id_solver s (List.hd args) in clk,s - | Lic.PREDEF_CALL (op,sargs),args -> + | Lic.PREDEF_CALL (op),args -> let args, clk_args, s = f_list id_solver s args in let flat_clk_args = List.flatten clk_args in (* => mono-clock! *) let _,flat_clk_args = List.split flat_clk_args in @@ -395,7 +395,7 @@ and (eval_by_pos_clock : Lic.id_solver -> Lic.by_pos_op -> Lxm.t -> Lic.val_exp let _clk,s = UnifyClock.list lxm flat_clk_args s in List.map (List.map (apply_subst s)) clk_args, s in - LicEvalClock.f id_solver op lxm sargs s clk_list + LicEvalClock.f id_solver op lxm s clk_list (* may have tuples as arguments *) | Lic.TUPLE,args diff --git a/src/evalConst.ml b/src/evalConst.ml index ff4a0e3d306136cd726c6ade0797026105470ecf..d9f6b3ac168f51be4c2c1048b39b56f486acf609 100644 --- a/src/evalConst.ml +++ b/src/evalConst.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 01/02/2013 (at 17:24) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/02/2013 (at 17:01) by Erwan Jahier> *) open Printf @@ -330,14 +330,9 @@ let rec f | CURRENT_n -> not_evaluable_construct "current" | PRE_n -> not_evaluable_construct "pre" - | Predef_n(op,sargs) - -> - if sargs = [] then - let effargs = (List.map rec_eval_const args) in + | Predef_n(op) -> + let effargs = (List.map rec_eval_const args) in LicEvalConst.f env op.it lxm [] effargs - else - (* Well, it migth be possible after all... TODO *) - not_evaluable_construct (op2string op.it) ) (* FIN DE : eval_by_pos_const *) diff --git a/src/evalType.ml b/src/evalType.ml index 99c94c29c16782b0d982b119440af6df8b057d10..ac99160234caf49b8913026fd385bc8e548f0300 100644 --- a/src/evalType.ml +++ b/src/evalType.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 01/02/2013 (at 14:29) by Erwan Jahier> *) +(** Time-stamp: <modified the 06/02/2013 (at 16:36) by Erwan Jahier> *) open AstPredef @@ -65,23 +65,22 @@ let rec (f : Lic.id_solver -> Lic.val_exp -> Lic.val_exp * Lic.type_ list) = ) in { ve_core = ve_core; ve_typ = tl ; ve_clk = ve.ve_clk }, tl - and eval_by_pos_type - (id_solver: Lic.id_solver) + (id_solver: Lic.id_solver) (posop: Lic.by_pos_op) (lxm: Lxm.t) (args: Lic.val_exp list) : ( - Lic.by_pos_op option (* For op that hold a val_exp, we return the modified op *) - * Lic.val_exp list (* The args with type info added *) - * Lic.type_ list (* The type of the val_exp "posop(args)" *) + Lic.by_pos_op option (* For op that hold a val_exp, we return the modified op *) + * Lic.val_exp list (* The args with type info added *) + * Lic.type_ list (* The type of the val_exp "posop(args)" *) ) = match posop with - | PREDEF_CALL (op,sargs) -> ( + | PREDEF_CALL (op) -> ( let args, targs = List.split (List.map (f id_solver) args) in (* ICI pas de matches possible ? *) - let tve = LicEvalType.f id_solver op lxm sargs targs in + let tve = LicEvalType.f id_solver op lxm targs in None, args, tve ) | Lic.CALL nkf -> diff --git a/src/l2lCheckLoops.ml b/src/l2lCheckLoops.ml index fd13a2fbcba95cd9a3684ef3781956d665b1afc0..e105ba10ca3fd0bb65015eee4f68138ffe2a182b 100644 --- a/src/l2lCheckLoops.ml +++ b/src/l2lCheckLoops.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 01/02/2013 (at 08:42) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/02/2013 (at 16:27) by Erwan Jahier> *) open Lxm open Errors @@ -30,11 +30,11 @@ and | CallByNameLic(_, _) -> s and vars_of_by_pos_op s = function - | PREDEF_CALL(_, sargs) -> List.fold_left vars_of_static_arg s sargs | VAR_REF id -> IdSet.add id s | WITH ve | HAT(_,ve) -> vars_of_exp s ve | ARRAY(vel) -> List.fold_left vars_of_exp s vel + | PREDEF_CALL(_) | ARRAY_SLICE _ | ARRAY_ACCES _ | ARROW | FBY | CURRENT | WHEN _ | STRUCT_ACCESS _ | TUPLE | CONCAT | CONST_REF _ | CALL _ -> s diff --git a/src/l2lExpandArrays.ml b/src/l2lExpandArrays.ml index 34f116e238137b4ce753507cef50ff6480c20741..f859e52eef0164aa2314aa27e8cd9f0de4b77030 100644 --- a/src/l2lExpandArrays.ml +++ b/src/l2lExpandArrays.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 04/02/2013 (at 21:22) by Erwan JAHIER> *) +(** Time-stamp: <modified the 06/02/2013 (at 16:28) by Erwan Jahier> *) (* Replace structures and arrays by as many variables as necessary. Since structures can be recursive, it migth be a lot of new variables... @@ -375,8 +375,7 @@ and (break_tuple : Lxm.t -> left list -> val_exp -> Lic.eq_info srcflagged list) ve1l ve2l - | CallByPosLic ({it= PREDEF_CALL(IF_n,[]); src=lxm}, OperLic [cond; ve1; ve2]) -> - + | CallByPosLic ({it= PREDEF_CALL(IF_n); src=lxm}, OperLic [cond; ve1; ve2]) -> let ve1l, ve2l = aux ve1, aux ve2 in if (List.length ve1l <> List.length ve2l) then let vel2str vel = @@ -392,7 +391,7 @@ and (break_tuple : Lxm.t -> left list -> val_exp -> Lic.eq_info srcflagged list) List.map2 (fun ve1 ve2 -> { ve with ve_core = - CallByPosLic ({it= PREDEF_CALL(IF_n,[]); src=lxm}, + CallByPosLic ({it= PREDEF_CALL(IF_n); src=lxm}, OperLic [cond;ve1;ve2])} ) ve1l diff --git a/src/l2lExpandMetaOp.ml b/src/l2lExpandMetaOp.ml index ab0945378f32cf1cf636611257c91334bac20e6a..29120d1c4c0917ad1b5c87299b727b7c124aee28 100644 --- a/src/l2lExpandMetaOp.ml +++ b/src/l2lExpandMetaOp.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 04/02/2013 (at 21:14) by Erwan JAHIER> *) +(** Time-stamp: <modified the 06/02/2013 (at 16:28) by Erwan Jahier> *) open Lxm open Lic @@ -68,7 +68,7 @@ let (val_exp_of_int : int -> Lic.val_exp) = { ve_clk = [BaseLic]; ve_typ = [Int_type_eff]; - ve_core = CallByPosLic({it=PREDEF_CALL(id_of_int i,[]);src=lxm},OperLic[]) + ve_core = CallByPosLic({it=PREDEF_CALL(id_of_int i);src=lxm},OperLic[]) } let rec (elt_type_of_array : Lic.type_ -> Lic.type_) = @@ -99,7 +99,7 @@ let (node_to_val_exp : Lic.node_key -> Lic.type_ list -> val_exp list -> val_exp } let (binop_to_val_exp : AstPredef.op -> val_exp -> val_exp -> val_exp) = fun op ve1 ve2 -> - let op = { it = PREDEF_CALL(op,[]) ; src = lxm } in + let op = { it = PREDEF_CALL(op) ; src = lxm } in { ve_clk = ve1.ve_clk; ve_typ = ve1.ve_typ; @@ -107,7 +107,7 @@ let (binop_to_val_exp : AstPredef.op -> val_exp -> val_exp -> val_exp) = } let (ite_to_val_exp : val_exp -> val_exp -> val_exp -> val_exp) = fun ve1 ve2 ve3 -> - let ite_op = { it = PREDEF_CALL(AstPredef.IF_n,[]); src = lxm } in + let ite_op = { it = PREDEF_CALL(AstPredef.IF_n); src = lxm } in { ve_clk = ve2.ve_clk; ve_typ = ve2.ve_typ; diff --git a/src/l2lRmPoly.ml b/src/l2lRmPoly.ml index eb0e203141ccea0cfaeafe60e7cb7a4d972bf23d..f2ce1919bb88cf22a952f7275791655616724951 100644 --- a/src/l2lRmPoly.ml +++ b/src/l2lRmPoly.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 04/02/2013 (at 21:23) by Erwan JAHIER> *) +(* Time-stamp: <modified the 06/02/2013 (at 16:28) by Erwan Jahier> *) (* Source 2 source transformation : @@ -95,12 +95,7 @@ let rec doit (inprg : LicPrg.t) : LicPrg.t = | CallByPosLic (posop, OperLic ops) -> ( let ops' = OperLic (List.map (do_exp m) ops) in match posop.it with - | PREDEF_CALL (pop,sas) -> - (* 12/07 ICI version provisoise : - les macros predef n'existe plus ! (ce sont des calls classiques) - *) - assert (sas = []); - CallByPosLic (posop, ops') + | PREDEF_CALL (pop) -> CallByPosLic (posop, ops') | CALL nk -> let ne = match LicPrg.find_node inprg nk.it with diff --git a/src/l2lSplit.ml b/src/l2lSplit.ml index 9a82d4ca44e7c267792c3bd1331367f6d6b61918..d27bfbad311934c522628c8f5a48956ec1848868 100644 --- a/src/l2lSplit.ml +++ b/src/l2lSplit.ml @@ -58,7 +58,7 @@ let to_be_broken = function | CallByPosLic({ it = Lic.CURRENT }, _) -> true | CallByPosLic({ it = Lic.TUPLE }, _) -> true | CallByPosLic({ it = Lic.WHEN _ }, _) -> true - | CallByPosLic({ it = Lic.PREDEF_CALL(AstPredef.IF_n, []) }, _) -> true + | CallByPosLic({ it = Lic.PREDEF_CALL(AstPredef.IF_n) }, _) -> true | _ -> false @@ -67,7 +67,7 @@ let (break_it_do : val_exp -> val_exp list) = fun ve -> let nvel = match ve.ve_core with - | CallByPosLic({it=Lic.PREDEF_CALL(AstPredef.IF_n,[]);src=lxm}, OperLic [c;ve1;ve2]) -> + | CallByPosLic({it=Lic.PREDEF_CALL(AstPredef.IF_n);src=lxm}, OperLic [c;ve1;ve2]) -> let vel1 = get_vel_from_tuple ve1 and vel2 = get_vel_from_tuple ve2 in @@ -75,7 +75,7 @@ let (break_it_do : val_exp -> val_exp list) = List.map2 (fun ve1 ve2 -> { ve_core = - CallByPosLic({it=Lic.PREDEF_CALL(AstPredef.IF_n,[]);src=lxm}, + CallByPosLic({it=Lic.PREDEF_CALL(AstPredef.IF_n);src=lxm}, OperLic [c;ve1;ve2]); ve_typ = ve1.ve_typ; ve_clk = ve1.ve_clk; @@ -181,10 +181,10 @@ and (split_val_exp : bool -> bool -> LicPrg.id_generator -> Lic.val_exp -> | Merge(ce,cl) -> ve, ([],[]) (* Should we deal with complex flow in merge ? *) | CallByPosLic({it=Lic.VAR_REF _}, _) -> ve, ([],[]) | CallByPosLic({it=Lic.CONST_REF _}, _) -> ve, ([],[]) - | CallByPosLic({src=lxm;it=Lic.PREDEF_CALL(AstPredef.TRUE_n,_)}, _) - | CallByPosLic({src=lxm;it=Lic.PREDEF_CALL(AstPredef.FALSE_n,_)}, _) - | CallByPosLic({src=lxm;it=Lic.PREDEF_CALL(AstPredef.ICONST_n _,_)}, _) - | CallByPosLic({src=lxm;it=Lic.PREDEF_CALL(AstPredef.RCONST_n _,_)}, _) + | CallByPosLic({src=lxm;it=Lic.PREDEF_CALL(AstPredef.TRUE_n)}, _) + | CallByPosLic({src=lxm;it=Lic.PREDEF_CALL(AstPredef.FALSE_n)}, _) + | CallByPosLic({src=lxm;it=Lic.PREDEF_CALL(AstPredef.ICONST_n _)}, _) + | CallByPosLic({src=lxm;it=Lic.PREDEF_CALL(AstPredef.RCONST_n _)}, _) (* We do not create an intermediary variable for those, but *) -> if not when_flag then diff --git a/src/lic.ml b/src/lic.ml index 269266a54da70d9dec59e37f771a4f1e830c70e5..1869b8938e650a400f3d76d014dd5e31874dcf21 100644 --- a/src/lic.ml +++ b/src/lic.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 04/02/2013 (at 21:00) by Erwan JAHIER> *) +(* Time-stamp: <modified the 06/02/2013 (at 16:11) by Erwan Jahier> *) (** Define the Data Structure representing Compiled programs. *) @@ -200,7 +200,7 @@ and by_name_op = and by_pos_op = - | PREDEF_CALL of AstPredef.op * static_arg list + | PREDEF_CALL of AstPredef.op | CALL of node_key srcflagged (* | IDENT of Ident.idref (* should be an Ident.t or long, really... *) *) | CONST_REF of Ident.long diff --git a/src/licDump.ml b/src/licDump.ml index f81a6584b1a5d911ee922b11d9fe3ea1d97386de..2b07d2c0dacf9f89703523703fd608b109cb50d9 100644 --- a/src/licDump.ml +++ b/src/licDump.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 04/02/2013 (at 19:02) by Erwan JAHIER> *) +(* Time-stamp: <modified the 06/02/2013 (at 16:33) by Erwan Jahier> *) open Errors open Printf @@ -261,16 +261,16 @@ and (string_of_by_pos_op_eff: Lic.by_pos_op srcflagged -> Lic.val_exp list -> st in let str = match posop.it,vel with - | PREDEF_CALL (AstPredef.NOT_n,_), [ve1] -> + | PREDEF_CALL (AstPredef.NOT_n), [ve1] -> ((op2string AstPredef.NOT_n) ^ " " ^ (if is_a_tuple ve1 then (tuple_par [ve1]) else sov ve1)) - | PREDEF_CALL (AstPredef.DIESE_n,_), [ve1] -> + | PREDEF_CALL (AstPredef.DIESE_n), [ve1] -> if !Global.lv4 then sov ve1 (* lv4 does no accept to apply # on One var only! *) else ((op2string AstPredef.DIESE_n) ^ (tuple_par [ve1])) - | PREDEF_CALL (AstPredef.IF_n,_), [ve1; ve2; ve3] -> + | PREDEF_CALL (AstPredef.IF_n), [ve1; ve2; ve3] -> let ve2str = string_of_val_exp_eff ve2 in let ve2str = if is_a_tuple ve2 then "("^ve2str^")" else ve2str in let ve3str = string_of_val_exp_eff ve3 in @@ -278,7 +278,7 @@ and (string_of_by_pos_op_eff: Lic.by_pos_op srcflagged -> Lic.val_exp list -> st " if " ^ (string_of_val_exp_eff ve1) ^ " then " ^ ve2str ^ " else " ^ ve3str - | PREDEF_CALL(op,sargs), vel -> + | PREDEF_CALL(op), vel -> if AstPredef.is_infix op then ( match vel with | [ve1; ve2] -> @@ -288,18 +288,13 @@ and (string_of_by_pos_op_eff: Lic.by_pos_op srcflagged -> Lic.val_exp list -> st ) else ((op2string op) ^ - (if sargs = [] then - match op with - | AstPredef.ICONST_n _ | AstPredef.RCONST_n _ | AstPredef.NOT_n - | AstPredef.UMINUS_n | AstPredef.IUMINUS_n | AstPredef.RUMINUS_n - | AstPredef.FALSE_n | AstPredef.TRUE_n -> - tuple vel - | _ -> tuple_par vel - else - "<<" ^ - (String.concat ", " (List.map (static_arg2string) sargs)) - ^ ">>" ^ (tuple_par vel))) - + (match op with + | AstPredef.ICONST_n _ | AstPredef.RCONST_n _ | AstPredef.NOT_n + | AstPredef.UMINUS_n | AstPredef.IUMINUS_n | AstPredef.RUMINUS_n + | AstPredef.FALSE_n | AstPredef.TRUE_n -> tuple vel + | _ -> tuple_par vel + ) + ) | (CALL nkl,_) -> ( let nk = nkl.it in if !Global.lv4 then @@ -398,10 +393,10 @@ and (string_of_by_pos_op_eff: Lic.by_pos_op srcflagged -> Lic.val_exp list -> st let do_not_parenthesize = function | VAR_REF _,_ | CONST_REF _,_ - | PREDEF_CALL((AstPredef.ICONST_n _), _),_ - | PREDEF_CALL((AstPredef.RCONST_n _), _),_ - | PREDEF_CALL((AstPredef.FALSE_n), _),_ - | PREDEF_CALL((AstPredef.TRUE_n), _),_ + | PREDEF_CALL((AstPredef.ICONST_n _)),_ + | PREDEF_CALL((AstPredef.RCONST_n _)),_ + | PREDEF_CALL((AstPredef.FALSE_n)),_ + | PREDEF_CALL((AstPredef.TRUE_n)),_ | ARRAY_ACCES _,_ | STRUCT_ACCESS _,_ -> true | _,_ -> false diff --git a/src/licEvalClock.ml b/src/licEvalClock.ml index d70539a8d08525c26b3e1cc187d8fabbef985789..831a26836a6e4b98c4214d99f7c3c61fc7ac7445 100644 --- a/src/licEvalClock.ml +++ b/src/licEvalClock.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 13/12/2012 (at 11:32) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/02/2013 (at 16:45) by Erwan Jahier> *) open AstPredef @@ -25,7 +25,7 @@ let (op_profile: clocker) = | [] -> assert false -let if_clock_profile lxm sargs s = +let if_clock_profile lxm s = function | [clk1; clk2; clk3] -> clk2, s | _ -> assert false @@ -39,7 +39,6 @@ let f (id_solver: Lic.id_solver) (op: op) (lxm: Lxm.t) - (sargs: Lic.static_arg list) : clocker = fun s -> match op with | TRUE_n | FALSE_n | ICONST_n _ | RCONST_n _ -> @@ -54,6 +53,6 @@ let f | NOR_n | DIESE_n -> op_profile s - | IF_n -> if_clock_profile lxm sargs s + | IF_n -> if_clock_profile lxm s diff --git a/src/licEvalClock.mli b/src/licEvalClock.mli index cc09811754202984c42116a01421a006c942676d..2d37667fe1326c800819adea356eccf0641eaaeb 100644 --- a/src/licEvalClock.mli +++ b/src/licEvalClock.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 13/12/2012 (at 11:32) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/02/2013 (at 16:46) by Erwan Jahier> *) (** Performs static evaluations of predefined operators in clocks expressions *) @@ -8,4 +8,4 @@ type clocker = UnifyClock.subst -> Lic.id_clock list list -> Lic.id_clock list * UnifyClock.subst -val f: Lic.id_solver -> AstPredef.op -> Lxm.t -> Lic.static_arg list -> clocker +val f: Lic.id_solver -> AstPredef.op -> Lxm.t -> clocker diff --git a/src/licEvalConst.ml b/src/licEvalConst.ml index 09559bb446948d9a7b8f58578d7e4f462e693133..a32e61f643bffdcddda8c4d767fe371f1894168f 100644 --- a/src/licEvalConst.ml +++ b/src/licEvalConst.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 13/12/2012 (at 11:32) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/02/2013 (at 16:36) by Erwan Jahier> *) open AstPredef open Lic @@ -128,7 +128,7 @@ let f : const_evaluator = fun ll -> (* we first check the type so that we do not need to check it during the const evaluation *) - ignore (LicEvalType.f id_solver op lxm sargs (List.map (List.map Lic.type_of_const) ll)); + ignore (LicEvalType.f id_solver op lxm (List.map (List.map Lic.type_of_const) ll)); match op with | TRUE_n -> sb_evaluator true ll | FALSE_n -> sb_evaluator false ll diff --git a/src/licEvalType.ml b/src/licEvalType.ml index dd4f9045a5d8ed4272606bab2f1e4f97cf95f24b..b77ca891a9a8216ac5b2cdeca512e3b7e3ccf579 100644 --- a/src/licEvalType.ml +++ b/src/licEvalType.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 04/02/2013 (at 21:24) by Erwan JAHIER> *) +(* Time-stamp: <modified the 06/02/2013 (at 16:35) by Erwan Jahier> *) open AstPredef open Lxm @@ -262,7 +262,6 @@ let op2profile (id_solver_opt: Lic.id_solver option) (op: AstPredef.op) (lxm: Lxm.t) - (sargs: Lic.static_arg list) : Lic.node_profile = let res = match op with @@ -295,19 +294,18 @@ let op2profile res (* exported *) -(* VERSION GÉNÉRALE, valable - pour les MACROS, et qui necessite donc un Lic.id_solver +(* VERSION GÉNÉRALE, valable pour les MACROS, et qui necessite donc + un Lic.id_solver *) let make_node_exp_eff (id_solver: Lic.id_solver) (has_mem: bool option) (op: op) (lxm: Lxm.t) - (sargs: Lic.static_arg list) : Lic.node_exp = let id = AstPredef.op_to_long op in - let (lti,lto) = op2profile (Some id_solver) op lxm sargs in + let (lti,lto) = op2profile (Some id_solver) op lxm in let i = ref 0 in (* let is_polymorphic = ref false in *) let to_var_info_eff nature (vid, te) = @@ -328,7 +326,7 @@ let make_node_exp_eff let outlist_eff = (i:=0;List.map (to_var_info_eff AstCore.VarOutput) lto) in let res = { - node_key_eff = id,sargs ; + node_key_eff = id,[]; inlist_eff = inlist_eff; outlist_eff = outlist_eff; loclist_eff = None; @@ -354,7 +352,7 @@ let make_simple_node_exp_eff : Lic.node_exp = let id = AstPredef.op_to_long op in - let (lti,lto) = op2profile None op lxm [] in + let (lti,lto) = op2profile None op lxm in let i = ref 0 in (* let is_polymorphic = ref false in *) let to_var_info_eff nature (vid, te) = @@ -396,7 +394,6 @@ let f (id_solver: Lic.id_solver) (op: op) (lxm: Lxm.t) - (sargs: Lic.static_arg list) : typer = fun ll -> match op with | IF_n -> ( @@ -421,7 +418,7 @@ let f [Bool_type_eff] | _ -> (* general case *) - let node_eff = make_node_exp_eff id_solver (Some false) op lxm sargs in + let node_eff = make_node_exp_eff id_solver (Some false) op lxm in let lti = List.map (fun v -> v.var_type_eff) node_eff.inlist_eff and lto = List.map (fun v -> v.var_type_eff) node_eff.outlist_eff in let l = List.flatten ll in diff --git a/src/licEvalType.mli b/src/licEvalType.mli index ea01063c13a44ba8a36dcab673c120f9da7da237..e9c3225c9662d8501ba2cc0b8ceb5e8ecd352d85 100644 --- a/src/licEvalType.mli +++ b/src/licEvalType.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 13/12/2012 (at 11:32) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/02/2013 (at 16:36) by Erwan Jahier> *) (** Performs static evaluations of predefined operators in type expressions *) @@ -15,7 +15,7 @@ val raise_type_error : Lic.type_ list -> Lic.type_ list -> string -> 'a the provided types are ok, and returns the list of the operator output types. *) -val f : Lic.id_solver -> AstPredef.op -> Lxm.t -> Lic.static_arg list -> typer +val f : Lic.id_solver -> AstPredef.op -> Lxm.t -> typer (** Does not work for NOR_n and DIESE_n! *) @@ -24,7 +24,7 @@ val f : Lic.id_solver -> AstPredef.op -> Lxm.t -> Lic.static_arg list -> typer - l'autre pour les noeuds simple qui peut être utilisée statiquement *) val make_node_exp_eff : - Lic.id_solver -> bool option -> AstPredef.op -> Lxm.t -> Lic.static_arg list -> Lic.node_exp + Lic.id_solver -> bool option -> AstPredef.op -> Lxm.t -> Lic.node_exp val make_simple_node_exp_eff : bool option -> AstPredef.op -> Lxm.t -> Lic.node_exp diff --git a/src/licTab.ml b/src/licTab.ml index 3622f8eba3ec75f419ffbae5db2fd5683281da99..e575671514e397d91f3c3fed0b8ef3720d1a082f 100644 --- a/src/licTab.ml +++ b/src/licTab.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 04/02/2013 (at 21:27) by Erwan JAHIER> *) +(* Time-stamp: <modified the 06/02/2013 (at 17:02) by Erwan Jahier> *) open Lxm @@ -1055,7 +1055,7 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t -> (* 12/07 SOLUTION INTERMEDIAIRE - les macros predefs sont traitées comme des call *) - | Predef_n(op, []) -> + | Predef_n(op) -> let predef_op = op.it in let _ = match predef_op with | AstPredef.NOR_n | AstPredef.DIESE_n -> @@ -1064,14 +1064,14 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t -> in let predef_op_eff = LicEvalType.make_node_exp_eff node_id_solver - (Some node_def.it.has_mem) predef_op lxm [] + (Some node_def.it.has_mem) predef_op lxm in predef_op_eff - | Predef_n(op, sargs) -> + | Predef_n(op) -> (* on re-construit une AstCore.node_exp srcflagged parce que c'est ca qu'attend of_node ... *) - let node_alias = flagit (AstPredef.op_to_idref op.it, sargs) op.src in + let node_alias = flagit (AstPredef.op_to_idref op.it, []) op.src in Ast2lic.of_node node_id_solver node_alias | CALL_n(node_alias) -> Ast2lic.of_node node_id_solver node_alias diff --git a/src/parserUtils.ml b/src/parserUtils.ml index b230a3852f95c60eee6aa44be639d6690ddd8c12..73c815c08b25ae4a6124ee2cc76527b3656a69f2 100644 --- a/src/parserUtils.ml +++ b/src/parserUtils.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 01/02/2013 (at 17:50) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/02/2013 (at 17:03) by Erwan Jahier> *) (** *) @@ -161,41 +161,41 @@ let save_make_merge_op (enum_clk:Lxm.t) (l:(Ident.idref srcflagged * val_exp) li let make_predef_posop lxm op = let op = flagit op lxm in - {src = lxm ; it = Predef_n (op,[]) } + {src = lxm ; it = Predef_n (op) } let leafexp lxm op = CallByPos({src = lxm ; it = op }, Oper []) let leafexp_predef lxm op = let op = flagit op lxm in - CallByPos({src = lxm ; it = Predef_n (op,[]) }, Oper []) + CallByPos({src = lxm ; it = Predef_n (op) }, Oper []) let unexp lxm op e1 = CallByPos( {src = lxm ; it = op }, Oper [e1] ) let unexp_predef lxm op e1 = let op = flagit op lxm in - CallByPos( {src = lxm ; it = Predef_n (op,[]) }, Oper [e1] ) + CallByPos( {src = lxm ; it = Predef_n (op) }, Oper [e1] ) let binexp lxm op e1 e2 = CallByPos( {src = lxm ; it = op }, Oper [e1 ; e2] ) let binexp_predef lxm op e1 e2 = let op = flagit op lxm in - CallByPos( {src = lxm ; it = Predef_n (op,[]) }, Oper [e1 ; e2] ) + CallByPos( {src = lxm ; it = Predef_n (op) }, Oper [e1 ; e2] ) let ternexp lxm op e1 e2 e3 = CallByPos( {src = lxm ; it = op }, Oper [e1 ; e2; e3] ) let ternexp_predef lxm op e1 e2 e3 = let op = flagit op lxm in - CallByPos( {src = lxm ; it = Predef_n (op,[]) }, Oper [e1 ; e2; e3] ) + CallByPos( {src = lxm ; it = Predef_n (op) }, Oper [e1 ; e2; e3] ) let naryexp lxm op elst = CallByPos( {src = lxm ; it = op }, Oper elst ) let naryexp_predef lxm op elst = let op = flagit op lxm in - CallByPos( {src = lxm ; it = Predef_n (op,[]) }, Oper elst ) + CallByPos( {src = lxm ; it = Predef_n (op) }, Oper elst ) let bynameexp lxm op nelst = CallByName( {src = lxm ; it = op } , nelst ) @@ -497,7 +497,7 @@ let (threat_slice_start : Lxm.t -> val_exp -> val_exp option -> slice_info srcfl try ignore (int_of_string istr); let ic = flagit (ICONST_n (Ident.of_string(istr))) lxm in - CallByPos(flagit (Predef_n (ic, [])) lxm, Oper []) + CallByPos(flagit (Predef_n (ic)) lxm, Oper []) with _ -> CallByPos(flagit (IDENT_n (Ident.idref_of_string(istr))) lxm, Oper []) in diff --git a/src/unifyClock.ml b/src/unifyClock.ml index 23de6e6ce89443b1ca30a5062d8eb23547479bc4..92ad572daf6de7ca391d1a24a9f51d87a45898bb 100644 --- a/src/unifyClock.ml +++ b/src/unifyClock.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 04/02/2013 (at 20:42) by Erwan JAHIER> *) +(* Time-stamp: <modified the 06/02/2013 (at 16:33) by Erwan Jahier> *) open LicDump @@ -287,11 +287,11 @@ let rec (const_to_val_eff: Lxm.t -> bool -> subst -> const -> subst * val_exp) = let id_of_int i = Ident.of_string (string_of_int i) in match const with | Bool_const_eff b -> - s, mk_by_pos_op (PREDEF_CALL((if b then AstPredef.TRUE_n else AstPredef.FALSE_n), [])) + s, mk_by_pos_op (PREDEF_CALL((if b then AstPredef.TRUE_n else AstPredef.FALSE_n))) | Int_const_eff i -> - s, mk_by_pos_op (PREDEF_CALL((AstPredef.ICONST_n (id_of_int i)),[])) + s, mk_by_pos_op (PREDEF_CALL((AstPredef.ICONST_n (id_of_int i)))) | Real_const_eff r -> - s, mk_by_pos_op (PREDEF_CALL((AstPredef.RCONST_n (Ident.of_string r)),[])) + s, mk_by_pos_op (PREDEF_CALL((AstPredef.RCONST_n (Ident.of_string r)))) | Enum_const_eff (l, _) | Extern_const_eff (l, _) -> s, mk_by_pos_op (CONST_REF l) diff --git a/test/lus2lic.sum b/test/lus2lic.sum index ce96debf45f2c8869c3cb2bb4018529225b3ad69..d2f6a5cc93ad559a3175d4dd6c59d65555ae937e 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,4 +1,4 @@ -Test Run By jahier on Mon Feb 4 21:28:30 2013 +Test Run By jahier on Wed Feb 6 17:03:32 2013 Native configuration is i686-pc-linux-gnu === lus2lic tests === diff --git a/test/lus2lic.time b/test/lus2lic.time index dfafd0d5f66e96dd46ecf60b6e57e68a094e9177..4ac89b10a875b7fdbdd807f103b329fbf36ac663 100644 --- a/test/lus2lic.time +++ b/test/lus2lic.time @@ -1,2 +1,2 @@ testcase ./lus2lic.tests/non-reg.exp completed in 23 seconds -testcase ./lus2lic.tests/progression.exp completed in 0 seconds +testcase ./lus2lic.tests/progression.exp completed in 1 seconds diff --git a/todo.org b/todo.org index 821e977e5800aadf4312fbc71c01f60534373d28..2a5c7537a2aa9987a941cc83b9ff071e9812c88a 100644 --- a/todo.org +++ b/todo.org @@ -47,10 +47,6 @@ in particular, are nodes using extern nodes generated properly? ** TODO les (nouveaux) tests ne capturent pas les changements de # lignes dans les should_fail - State "TODO" from "" [2013-01-11 Fri 11:15] -** TODO Certains programmes dans should_fail n'echouent qu'en ec (ou bien c'est ec2c) ou l'inverse - - State "TODO" from "STARTED" [2013-01-23 Wed 18:26] -du coup les stats sont un peu fausses. a revoir. - * Aesthetes issues ** TODO Nommage des variables fraiches : Reprendre LicVarName.ml @@ -79,11 +75,6 @@ du with ? comment fait caml ? - State "TODO" from "" [2012-10-26 Fri 14:59] -** TODO on devrait se passer de 'static_arg list' pour le champ =PREDEF_CALL= -(c'est censé marcher) -cf file:./src/eff.ml::206 - - State "TODO" from "" [2012-10-26 Fri 14:59] - ** TODO L'ideal serait de se passer du PREDEF_CALL (et de passer par le CALL normal) - State "TODO" from "" [2012-10-26 Fri 14:59] diff --git a/todo.org_archive b/todo.org_archive index c9ce8d8201123a370a60c1037a1d8ef956fcd393..63b12ff139b04407462daa7c66d748dc7a4685d2 100644 --- a/todo.org_archive +++ b/todo.org_archive @@ -369,6 +369,31 @@ cf file:test/perf/ contenant les resultats de gprof et ocamlprof sur ec.lus -----> ca y est, j'ai trouvé : encore une histoire de Verbose pas lazy !!! +* TODO Certains programmes dans should_fail n'echouent qu'en ec (ou bien c'est ec2c) ou l'inverse + - State "TODO" from "STARTED" [2013-01-23 Wed 18:26] + :PROPERTIES: + :ARCHIVE_TIME: 2013-02-06 Wed 16:09 + :ARCHIVE_FILE: ~/lus2lic/todo.org + :ARCHIVE_OLPATH: Testing process + :ARCHIVE_CATEGORY: lv6 + :ARCHIVE_TODO: TODO + :END: +du coup les stats sont un peu fausses. a revoir. + +* TODO on devrait se passer de 'static_arg list' pour le champ =PREDEF_CALL= + :PROPERTIES: + :ARCHIVE_TIME: 2013-02-06 Wed 17:06 + :ARCHIVE_FILE: ~/lus2lic/todo.org + :ARCHIVE_OLPATH: Aesthetes issues + :ARCHIVE_CATEGORY: lv6 + :ARCHIVE_TODO: TODO + :END: +(c'est censé marcher) +cf file:./src/lic.ml::206 + - State "TODO" from "" [2012-10-26 Fri 14:59] + + +