diff --git a/Makefile b/Makefile index b4d3aa511463ce0c6733a0c5a365d493f55e8b22..34b009288d32288a5b8be077900a90c1cd7d1c05 100644 --- a/Makefile +++ b/Makefile @@ -63,12 +63,12 @@ SOURCES = \ $(OBJDIR)/astTab.mli \ $(OBJDIR)/astTab.ml \ $(OBJDIR)/lic.ml \ + $(OBJDIR)/idSolver.ml \ $(OBJDIR)/licName.mli \ $(OBJDIR)/licName.ml \ $(OBJDIR)/licDump.ml \ $(OBJDIR)/licPrg.mli \ $(OBJDIR)/licPrg.ml \ - $(OBJDIR)/uglyStuff.ml \ $(OBJDIR)/unifyType.mli \ $(OBJDIR)/unifyType.ml \ $(OBJDIR)/unifyClock.mli \ diff --git a/src/ast2lic.ml b/src/ast2lic.ml index 25753eab61334ed0cbb62c95acbacb831a0cf513..7b5518139d7be27fa5bc6af2c8dd9ba047a3842f 100644 --- a/src/ast2lic.ml +++ b/src/ast2lic.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 07/02/2013 (at 16:06) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 18:22) by Erwan Jahier> *) open Lxm @@ -6,6 +6,7 @@ open AstPredef open AstV6 open AstCore open Lic +open IdSolver open Errors open Ident @@ -16,7 +17,7 @@ let dbg = Some(Verbose.get_flag "lazyc") exception Ast2licType_error of string (* exported *) -let rec (of_type: Lic.id_solver -> AstCore.type_exp -> Lic.type_) = +let rec (of_type: IdSolver.t -> AstCore.type_exp -> Lic.type_) = fun env texp -> match texp.it with | Bool_type_exp -> Bool_type_eff @@ -34,7 +35,7 @@ let rec (of_type: Lic.id_solver -> AstCore.type_exp -> Lic.type_) = -let (add_pack_name : id_solver -> Lxm.t -> Ident.idref -> Ident.idref) = +let (add_pack_name : IdSolver.t -> Lxm.t -> Ident.idref -> Ident.idref) = fun id_solver lxm cc -> try match Ident.pack_of_idref cc with @@ -49,19 +50,19 @@ let (add_pack_name : id_solver -> Lxm.t -> Ident.idref -> Ident.idref) = (* exported *) -let rec (of_clock : Lic.id_solver -> AstCore.var_info -> Lic.id_clock)= +let rec (of_clock : IdSolver.t -> AstCore.var_info -> Lic.id_clock)= fun id_solver v -> match v.var_clock with | Base -> v.var_name, BaseLic | NamedClock({ it=(cc,cv) ; src=lxm }) -> let cc = add_pack_name id_solver lxm cc in - let vi = id_solver.id2var (Ident.to_idref cv) lxm in + let vi = id_solver.id2var cv lxm in let id, clk = vi.var_clock_eff in v.var_name, On((cc,cv), clk) (******************************************************************************) (* Checks that the left part has the same type as the right one. *) -and (type_check_equation: Lic.id_solver -> Lxm.t -> Lic.left list -> +and (type_check_equation: IdSolver.t -> Lxm.t -> Lic.left list -> Lic.val_exp -> unit) = fun id_solver lxm lpl_eff ve_eff -> let lpl_teff = List.map Lic.type_of_left lpl_eff in @@ -93,7 +94,7 @@ and (type_check_equation: Lic.id_solver -> Lxm.t -> Lic.left list -> right_part (* Checks that the left part has the same clock as the right one. *) -and (clock_check_equation:Lic.id_solver -> Lxm.t -> UnifyClock.subst -> +and (clock_check_equation:IdSolver.t -> Lxm.t -> UnifyClock.subst -> Lic.left list -> Lic.val_exp -> unit) = fun id_solver lxm s lpl_eff ve_eff -> let clk_list = List.map Lic.clock_of_left lpl_eff in @@ -168,7 +169,7 @@ let get_abstract_static_params (* exported *) let rec of_node - (id_solver : Lic.id_solver) (ne: AstCore.node_exp srcflagged) : Lic.node_exp = + (id_solver : IdSolver.t) (ne: AstCore.node_exp srcflagged) : Lic.node_exp = Verbose.exe ~flag:dbg (fun () -> Printf.fprintf stderr "\n\n#DBG: ENTERING Ast2lic.of_node \'"; @@ -232,7 +233,7 @@ let rec of_node res and check_static_arg - (node_id_solver: Lic.id_solver) + (node_id_solver: IdSolver.t) (asp: abstract_static_param) (sa: AstCore.static_arg srcflagged) : Lic.static_arg = @@ -287,7 +288,7 @@ and check_static_arg (******************************************************************************) (* exported *) -and (of_eq: Lic.id_solver -> AstCore.eq_info srcflagged -> Lic.eq_info srcflagged) = +and (of_eq: IdSolver.t -> AstCore.eq_info srcflagged -> Lic.eq_info srcflagged) = fun id_solver eq_info -> let (lpl, ve) = eq_info.it in let lpl_eff = List.map (translate_left_part id_solver) lpl @@ -298,15 +299,12 @@ and (of_eq: Lic.id_solver -> AstCore.eq_info srcflagged -> Lic.eq_info srcflagge flagit (lpl_eff, ve_eff) eq_info.src -and (translate_left_part : id_solver -> AstCore.left_part -> Lic.left) = +and (translate_left_part : IdSolver.t -> AstCore.left_part -> Lic.left) = fun id_solver lp_top -> match lp_top with | LeftVar id -> - let vi_eff = - id_solver.id2var (Ident.idref_of_string (Ident.to_string id.it)) id.src - in + let vi_eff = id_solver.id2var id.it id.src in LeftVarLic (vi_eff, id.src) - | LeftField (lp, id) -> ( let lp_eff = translate_left_part id_solver lp in let teff = Lic.type_of_left lp_eff in @@ -346,7 +344,7 @@ and (translate_left_part : id_solver -> AstCore.left_part -> Lic.left) = ) -and (translate_val_exp : Lic.id_solver -> UnifyClock.subst -> AstCore.val_exp +and (translate_val_exp : IdSolver.t -> UnifyClock.subst -> AstCore.val_exp -> UnifyClock.subst * Lic.val_exp) = fun id_solver s ve -> (match ve with @@ -425,7 +423,7 @@ and (translate_val_exp : Lic.id_solver -> UnifyClock.subst -> AstCore.val_exp (s, mk_by_pos_op ceff) | IDENT_n idref -> ( try - let var = id_solver.id2var idref lxm in + let var = id_solver.id2var idref.id_id lxm in s, mk_by_pos_op(Lic.VAR_REF var.var_name_eff) with _ -> let s, const = UnifyClock.const_to_val_eff lxm false s @@ -482,20 +480,20 @@ and (translate_val_exp : Lic.id_solver -> UnifyClock.subst -> AstCore.val_exp s, vef ) and translate_by_name_op id_solver op s = - let get_pack_name idref = + let to_long idref = match Ident.pack_of_idref idref with | None -> (* If no pack name is provided, we lookup it in the symbol table *) let id = Ident.of_idref idref in let pn = AstTabSymbol.find_pack_of_type id_solver.global_symbols id op.src in - pn - | Some pn -> pn + Ident.make_long pn idref.id_id + | Some pn -> Ident.make_long pn idref.id_id in let s, nop = match op.it with | STRUCT_anonymous_n -> s, STRUCT_anonymous - | STRUCT_n idref -> s, STRUCT (get_pack_name idref, idref, None) + | STRUCT_n idref -> s, STRUCT (to_long idref, None) | STRUCT_WITH_n (idref1, idref2) -> - s, STRUCT (get_pack_name idref1,idref1, Some(idref2)) + s, STRUCT (to_long idref1, Some(idref2.id_id)) in s, flagit nop op.src @@ -541,7 +539,7 @@ and node_of_static_arg id_solver node_or_node_ident lxm = | StaticArgType _ | StaticArgConst _ -> raise (Compile_error(lxm, "a node was expected")) -and (translate_slice_info : Lic.id_solver -> AstCore.slice_info -> +and (translate_slice_info : IdSolver.t -> AstCore.slice_info -> Lxm.t -> Lic.slice_info) = fun id_solver si lxm -> EvalConst.eval_array_slice id_solver si lxm @@ -549,7 +547,7 @@ and (translate_slice_info : Lic.id_solver -> AstCore.slice_info -> (**********************************************************************************) (* exported *) -let (of_assertion : Lic.id_solver -> AstCore.val_exp Lxm.srcflagged -> +let (of_assertion : IdSolver.t -> AstCore.val_exp Lxm.srcflagged -> Lic.val_exp Lxm.srcflagged) = fun id_solver vef -> let s, val_exp_eff = translate_val_exp id_solver UnifyClock.empty_subst vef.it in diff --git a/src/ast2lic.mli b/src/ast2lic.mli index 645c377cfbba5dfc07730eeb4b8028cc2bac514c..befa1317a34544e82a2b39a98e64e32ec9a4b2fc 100644 --- a/src/ast2lic.mli +++ b/src/ast2lic.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 13/12/2012 (at 14:41) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 18:06) by Erwan Jahier> *) (** Translate Ast to lic. @@ -12,8 +12,8 @@ - checks the arguments and the parameters are compatible (i.e., that they unify) *) -val of_type : Lic.id_solver -> AstCore.type_exp -> Lic.type_ -val of_clock : Lic.id_solver -> AstCore.var_info -> Lic.id_clock +val of_type : IdSolver.t -> AstCore.type_exp -> Lic.type_ +val of_clock : IdSolver.t -> AstCore.var_info -> Lic.id_clock (** A [node_exp] is a name plus a list of static arguments. @@ -23,11 +23,11 @@ val of_clock : Lic.id_solver -> AstCore.var_info -> Lic.id_clock - check they are compatible with the node signature check the type of the static arguments ( *) -val of_node : Lic.id_solver -> AstCore.node_exp Lxm.srcflagged -> +val of_node : IdSolver.t -> AstCore.node_exp Lxm.srcflagged -> Lic.node_exp -val of_eq : Lic.id_solver -> AstCore.eq_info Lxm.srcflagged -> +val of_eq : IdSolver.t -> AstCore.eq_info Lxm.srcflagged -> Lic.eq_info Lxm.srcflagged -val of_assertion : Lic.id_solver -> AstCore.val_exp Lxm.srcflagged -> +val of_assertion : IdSolver.t -> AstCore.val_exp Lxm.srcflagged -> Lic.val_exp Lxm.srcflagged diff --git a/src/errors.ml b/src/errors.ml index 808d88aa890532750c3a7c114be3b063510449dc..3f1ff667c6c87a01cda9297eb2bd3761acab494b 100644 --- a/src/errors.ml +++ b/src/errors.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 22/01/2013 (at 13:45) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 18:23) by Erwan Jahier> *) (** *) @@ -93,7 +93,7 @@ Une erreur associ exception Compile_error of Lxm.t * string exception Unknown_constant of Lxm.t * string -exception Unknown_var of Lxm.t * Ident.idref +exception Unknown_var of Lxm.t * Ident.t (** --------------------------------------------------------------------- Une erreur plus generale diff --git a/src/evalClock.ml b/src/evalClock.ml index c31ec820af532619d4e95464b89951115d9988d4..c09f48bc0c725778e7282dce5a2185ffcb22c063 100644 --- a/src/evalClock.ml +++ b/src/evalClock.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 07/02/2013 (at 14:52) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/02/2013 (at 08:49) by Erwan Jahier> *) open AstPredef @@ -6,6 +6,7 @@ open LicEvalConst open AstV6 open AstCore open Lic +open IdSolver open Printf open Lxm open Errors @@ -178,7 +179,7 @@ let ci2str = LicDump.string_of_clock2 (******************************************************************************) (** Now we can go on and define [f]. *) -let rec (f : Lxm.t -> Lic.id_solver -> subst -> Lic.val_exp -> Lic.clock list -> +let rec (f : Lxm.t -> IdSolver.t -> subst -> Lic.val_exp -> Lic.clock list -> Lic.val_exp * Lic.id_clock list * subst) = fun lxm id_solver s ve exp_clks -> (* we split f so that we can reinit the fresh clock var generator *) @@ -212,7 +213,7 @@ and f_aux id_solver s ve = ) | Merge(ce, cl) -> let ce_id, (merge_clk : Lic.clock) = - var_info_eff_to_clock_eff (UglyStuff.var_info_of_ident id_solver ce.it ce.src) + var_info_eff_to_clock_eff (IdSolver.var_info_of_ident id_solver ce.it ce.src) in let check_case s (c,ve) = (* Check that ve is on c(ce) on merge_clk *) @@ -240,7 +241,7 @@ and f_aux id_solver s ve = apply_subst_val_exp s ve, cel, s (* iterate f on a list of expressions *) -and (f_list : Lic.id_solver -> subst -> Lic.val_exp list -> +and (f_list : IdSolver.t -> subst -> Lic.val_exp list -> Lic.val_exp list * Lic.id_clock list list * subst) = fun id_solver s args -> let aux (args,acc,s) arg = @@ -253,7 +254,7 @@ and (f_list : Lic.id_solver -> subst -> Lic.val_exp list -> let cil = List.map (List.map(fun (id,clk) -> id, apply_subst2 s clk)) cil in args, cil, s -and (eval_by_pos_clock : Lic.id_solver -> Lic.by_pos_op -> Lxm.t -> Lic.val_exp list -> +and (eval_by_pos_clock : IdSolver.t -> Lic.by_pos_op -> Lxm.t -> Lic.val_exp list -> subst -> Lic.id_clock list * subst) = fun id_solver posop lxm args s -> let apply_subst s (id,clk) = id, UnifyClock.apply_subst s clk in @@ -272,9 +273,7 @@ and (eval_by_pos_clock : Lic.id_solver -> Lic.by_pos_op -> Lxm.t -> Lic.val_exp match clk_exp with | Base -> BaseLic, BaseLic | NamedClock { it = (cc,c) ; src = lxm } -> - let id, c_clk = - (id_solver.id2var (Ident.to_idref c) lxm).var_clock_eff - in + let id, c_clk = (id_solver.id2var c lxm).var_clock_eff in c_clk, On((cc,c), c_clk) in let aux_when exp_clk s = @@ -340,17 +339,17 @@ and (eval_by_pos_clock : Lic.id_solver -> Lic.by_pos_op -> Lxm.t -> Lic.val_exp | Lic.VAR_REF id,args -> - let vi = UglyStuff.var_info_of_ident id_solver id lxm in + let vi = IdSolver.var_info_of_ident id_solver id lxm in ([var_info_eff_to_clock_eff vi], s) | Lic.CONST_REF idl,args -> - let _const = UglyStuff.const_eff_of_item_key id_solver idl lxm in + let _const = IdSolver.const_eff_of_item_key id_solver idl lxm in let s, clk = UnifyClock.new_clock_var s in ([Ident.of_long idl, clk], s) | Lic.CALL nkf,args -> let node_key = nkf.it in - let node_exp_eff = UglyStuff.node_exp_of_node_key id_solver node_key lxm in + let node_exp_eff = IdSolver.node_exp_of_node_key id_solver node_key lxm in let (cil_arg, cil_res) = get_clock_profile node_exp_eff in let s, rel_base = UnifyClock.new_clock_var s in (* the value of the base clock of a node is actually relative @@ -423,13 +422,13 @@ and (eval_by_pos_clock : Lic.id_solver -> Lic.by_pos_op -> Lxm.t -> Lic.val_exp clk_list, s ) -and (eval_by_name_clock : Lic.id_solver -> Lic.by_name_op -> Lxm.t -> +and (eval_by_name_clock : IdSolver.t -> Lic.by_name_op -> Lxm.t -> (Ident.t Lxm.srcflagged * Lic.val_exp) list -> subst -> Lic.id_clock list * subst) = fun id_solver namop lxm namargs s -> match namop with | Lic.STRUCT_anonymous -> assert false (* cf EvalType.E *) - | Lic.STRUCT(_, _, dft_opt) -> + | Lic.STRUCT(_, dft_opt) -> let apply_subst s (id,clk) = id, UnifyClock.apply_subst s clk in let args = List.map (fun (id,ve) -> ve) namargs in (* XXX The 3 following lines duplicates the code of TUPLE_eff and co *) diff --git a/src/evalClock.mli b/src/evalClock.mli index 7e3984d8591dd5108a90f95d9aec652df6c1b483..94074c286fca6b0dee53d7c8a537e47205fbbfdb 100644 --- a/src/evalClock.mli +++ b/src/evalClock.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 30/01/2013 (at 16:25) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 18:06) by Erwan Jahier> *) (** Static evaluation of clocks. *) @@ -11,7 +11,7 @@ open UnifyClock nb : if [cl] is empty, no check is done (should be an option type) *) -val f : Lxm.t -> Lic.id_solver -> subst -> Lic.val_exp -> Lic.clock list -> +val f : Lxm.t -> IdSolver.t -> subst -> Lic.val_exp -> Lic.clock list -> Lic.val_exp * Lic.id_clock list * subst diff --git a/src/evalConst.ml b/src/evalConst.ml index c4c6d63d998f152ad29dea605a53026ffaeca29b..ff6483c79070f165d0430aaffeb414db55297b87 100644 --- a/src/evalConst.ml +++ b/src/evalConst.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 07/02/2013 (at 16:07) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 18:07) by Erwan Jahier> *) open Printf @@ -6,6 +6,7 @@ open Lxm open Errors open AstV6 open Lic +open IdSolver open AstCore open AstPredef open LicEvalConst @@ -148,7 +149,7 @@ let make_struct_const (teff : Lic.type_) (id_opt : Ident.idref option) Evaluation récursive des expressions constantes ------------------------------------------------------ f : - - entrées : Lic.id_solver et val_exp + - entrées : IdSolver.t et val_exp - sortie : Lic.const list - Lic.t de bord : Compile_error Rôle : @@ -156,7 +157,7 @@ R -> gère les appels récursifs (évaluation des arguments) ----------------------------------------------------*) let rec f - (env : Lic.id_solver) + (env : IdSolver.t) (vexp : val_exp) = ( (*----------------------------------- @@ -389,7 +390,7 @@ let rec f EvalArray_error "bad array size, type int expected but get <t>" si t pas int EvalArray_error "bad array size <n>" si n <= 0 ----------------------------------------------------------------------*) -and (eval_array_size: Lic.id_solver -> val_exp -> int) = +and (eval_array_size: IdSolver.t -> val_exp -> int) = fun id_solver szexp -> match (f id_solver szexp) with | [Int_const_eff sz] -> @@ -416,7 +417,7 @@ and (eval_array_size: Lic.id_solver -> val_exp -> int) = EvalArray_error msg si pas bon ----------------------------------------------------------------------*) and eval_array_index - (env : Lic.id_solver) + (env : IdSolver.t) (ixexp : val_exp) (lxm : Lxm.t) = @@ -454,7 +455,7 @@ and eval_array_index Rôle : Entrées : - Lic.id_solver, slice_info, size du tableau, + IdSolver.t, slice_info, size du tableau, lxm (source de l'opération slice pour warning) Lic.Sor : slice_info_eff, i.e. @@ -465,7 +466,7 @@ and eval_array_index Lic.ts de bord : EvalArray_error msg si pas bon ----------------------------------------------------------------------*) -and eval_array_slice (env : Lic.id_solver) (sl : slice_info) (lxm : Lxm.t) = +and eval_array_slice (env : IdSolver.t) (sl : slice_info) (lxm : Lxm.t) = try let first_ix = eval_array_index env sl.si_first lxm in let last_ix = eval_array_index env sl.si_last lxm in diff --git a/src/evalConst.mli b/src/evalConst.mli index 0c1f37ef6a656b5f98f5c4c5d929ab00181737b0..470e361e0c36ad550341e2858d1492c752b05033 100644 --- a/src/evalConst.mli +++ b/src/evalConst.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 13/12/2012 (at 11:50) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 18:07) by Erwan Jahier> *) (** Static evaluation of constants. *) @@ -9,10 +9,10 @@ PARAMETRES : Pour avoir qq chose de générique, les fonctions - sont paramétrées par un "Lic.id_solver", qui contient deux fonctions : + sont paramétrées par un "IdSolver.t", qui contient deux fonctions : (voir Lic. - type Lic.id_solver = { + type IdSolver.t = { id2const : Ident.idref -> Lxm.t -> const_eff id2type : Ident.idref -> Lxm.t -> const_eff } @@ -22,7 +22,7 @@ FONCTION PRINCIPALE : Elle lève "Compile_error lxm msg" en cas d'erreur. eval_const - (env : Lic.id_solver) + (env : IdSolver.t) (vexp : val_exp) -> const_eff list @@ -34,14 +34,14 @@ FONCTIONS DERIVEES : (permet de pr se qui permet de récupérer l'erreur. eval_array_size - (env : Lic.id_solver) + (env : IdSolver.t) (vexp : val_exp) -> int (N.B. ne renvoie que des taille correctes : > 0) eval_array_index - (env : Lic.id_solver) + (env : IdSolver.t) (vexp : val_exp) (sz : int) -> int @@ -49,7 +49,7 @@ FONCTIONS DERIVEES : (permet de pr (N.B. on doit préciser la taille sz du tableau) eval_array_slice - (env : Lic.id_solver) + (env : IdSolver.t) (sl : slice_info srcflagged) (sz : int) (lxm : Lxm.t) @@ -63,7 +63,7 @@ FONCTIONS DERIVEES : (permet de pr exception EvalArray_error of string -val f : Lic.id_solver -> AstCore.val_exp -> Lic.const list +val f : IdSolver.t -> AstCore.val_exp -> Lic.const list (** Rôle : calcule une taille de tableau @@ -77,7 +77,7 @@ val f : Lic.id_solver -> AstCore.val_exp -> Lic.const list EvalArray_error "bad array size, type int expected but get <t>" si t pas int EvalArray_error "bad array size <n>" si n <= 0 *) -val eval_array_size : Lic.id_solver -> AstCore.val_exp -> int +val eval_array_size : IdSolver.t -> AstCore.val_exp -> int (** Rôle : @@ -91,7 +91,7 @@ val eval_array_size : Lic.id_solver -> AstCore.val_exp -> int Lic.ts de bord : EvalArray_error msg si pas bon *) -val eval_array_index : Lic.id_solver -> AstCore.val_exp -> Lxm.t -> int +val eval_array_index : IdSolver.t -> AstCore.val_exp -> Lxm.t -> int (** Rôle : @@ -109,4 +109,4 @@ val eval_array_index : Lic.id_solver -> AstCore.val_exp -> Lxm.t -> int EvalArray_error msg si pas bon *) val eval_array_slice : - Lic.id_solver -> AstCore.slice_info -> Lxm.t -> Lic.slice_info + IdSolver.t -> AstCore.slice_info -> Lxm.t -> Lic.slice_info diff --git a/src/evalType.ml b/src/evalType.ml index 4c23dd819695b69584b06e77689728dc4ac1e70f..4667f046e415b714d4e7b61cf56a591a2d3e73ef 100644 --- a/src/evalType.ml +++ b/src/evalType.ml @@ -1,10 +1,11 @@ -(** Time-stamp: <modified the 07/02/2013 (at 15:48) by Erwan Jahier> *) +(** Time-stamp: <modified the 13/02/2013 (at 08:49) by Erwan Jahier> *) open AstPredef open AstV6 open AstCore open Lic +open IdSolver open Printf open Lxm open Errors @@ -25,15 +26,7 @@ let dbgpoly = Some (Verbose.get_flag "poly") (******************************************************************************) let finish_me msg = print_string ("\n\tXXX evalType.ml:"^msg^" -> finish me!\n") - -(******************************** -ACCES AUX INFOS DEJA COMPILEES, -SOLUTION INTERMEDIARE A REVOIR : -voir UglyStuff -*) - - -let rec (f : Lic.id_solver -> Lic.val_exp -> Lic.val_exp * Lic.type_ list) = +let rec (f : IdSolver.t -> Lic.val_exp -> Lic.val_exp * Lic.type_ list) = fun id_solver ve -> let ve_core, tl = match ve.ve_core with @@ -67,7 +60,7 @@ let rec (f : Lic.id_solver -> Lic.val_exp -> Lic.val_exp * Lic.type_ list) = { 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: IdSolver.t) (posop: Lic.by_pos_op) (lxm: Lxm.t) (args: Lic.val_exp list) @@ -86,7 +79,7 @@ and eval_by_pos_type | Lic.CALL nkf -> let node_key = nkf.it in (* let node_exp_eff = id_solver.id2node node_key lxm in *) - let node_exp_eff = UglyStuff.node_exp_of_node_key id_solver node_key lxm in + let node_exp_eff = IdSolver.node_exp_of_node_key id_solver node_key lxm in let (lti, lto) = Lic.profile_of_node_exp node_exp_eff in let args, t_argsl = List.split (List.map (f id_solver) args) in let t_args = List.flatten t_argsl in @@ -120,12 +113,12 @@ and eval_by_pos_type in (None, args, tve) | Lic.CONST_REF idl -> - let ceff = UglyStuff.const_eff_of_item_key id_solver idl lxm in + let ceff = IdSolver.const_eff_of_item_key id_solver idl lxm in let tve = Lic.types_of_const ceff in None, [], tve | Lic.VAR_REF id -> let tve = [ - (UglyStuff.var_info_of_ident id_solver id lxm).var_type_eff + (IdSolver.var_info_of_ident id_solver id lxm).var_type_eff ] in None, [], tve | Lic.TUPLE -> @@ -238,7 +231,7 @@ and eval_by_pos_type let _ = match clk_exp with | Base -> () | NamedClock( { it = (cc,cv) ; src = lxm }) -> - let vi = id_solver.id2var (Ident.to_idref cv) lxm in + let vi = id_solver.id2var cv lxm in (match vi.var_type_eff with | Lic.Bool_type_eff | Lic.Enum_type_eff _ -> () @@ -273,7 +266,7 @@ and eval_by_pos_type (** Juste pour les structures ... *) -and eval_by_name_type (id_solver: Lic.id_solver) (namop: Lic.by_name_op) (lxm: Lxm.t) +and eval_by_name_type (id_solver: IdSolver.t) (namop: Lic.by_name_op) (lxm: Lxm.t) (namargs: (Ident.t Lxm.srcflagged * Lic.val_exp) list ) (* renvoie la liste de modif de champs compilée + le type du résultat *) : (Ident.t Lxm.srcflagged * Lic.val_exp) list * Lic.type_ list @@ -291,8 +284,8 @@ and eval_by_name_type (id_solver: Lic.id_solver) (namop: Lic.by_name_op) (lxm: finish_me "anonymous struct not yet supported"; assert false - | Lic.STRUCT (pn,opid,dft_opt) -> - let struct_type = id_solver.id2type opid lxm in + | Lic.STRUCT (opid,dft_opt) -> + let struct_type = id_solver.id2type (Ident.idref_of_long opid) lxm in match struct_type with | Struct_type_eff(sn, fl) -> let do_field_assign (fn, fv) = @@ -331,26 +324,28 @@ and eval_by_name_type (id_solver: Lic.id_solver) (namop: Lic.by_name_op) (lxm: with Not_found -> let msg = Printf.sprintf "Error: the field '%s' of structure '%s' is undefined" - (id) (Ident.string_of_idref opid) + (id) (Ident.string_of_long opid) in raise (Compile_error(lxm, msg)) ) - | Some (idref),[] -> - + | Some (id_with),[] -> let (type_of_struct_field : Ident.t -> Lic.type_ -> Lic.type_) = fun id t -> match t with | Struct_type_eff(l,fl) -> - (try fst(List.assoc id fl) with Not_found -> assert false) + (try fst(List.assoc id fl) + with Not_found -> + print_string ("field " ^id^" not foudn in "); + print_string (Lic.string_of_type t); + assert false) | _ -> assert false in - let (get_field_of_idref : Ident.idref -> Ident.t -> Lxm.t -> + let (get_field_of_id : Ident.t -> Ident.t -> Lxm.t -> Ident.t Lxm.srcflagged * Lic.val_exp) = - fun idref id lxm -> - let vi = id_solver.id2var idref lxm in + fun id_with id lxm -> + let vi = id_solver.id2var id_with lxm in let dft_ve = - {ve_core = CallByPosLic - ((flagit (VAR_REF (Ident.of_idref idref)) lxm),OperLic[]); + {ve_core = CallByPosLic(flagit (VAR_REF id_with) lxm,OperLic[]); ve_typ = [vi.var_type_eff]; ve_clk = [snd vi.var_clock_eff] } @@ -364,17 +359,17 @@ and eval_by_name_type (id_solver: Lic.id_solver) (namop: Lic.by_name_op) (lxm: in (flagit id lxm), ve in - get_field_of_idref idref id lxm + get_field_of_id id_with id lxm ) fl in (namargs, [struct_type]) | _ -> raise (Compile_error(lxm, "type error: a structure is expected")) -and (eval_merge : Lic.id_solver -> Ident.t -> Lxm.t -> +and (eval_merge : IdSolver.t -> Ident.t -> Lxm.t -> (Lic.const Lxm.srcflagged * Lic.val_exp) list -> Lic.val_exp_core * Lic.type_ list) = fun id_solver clk lxm nargs -> - let tclk = (UglyStuff.var_info_of_ident id_solver clk lxm).var_type_eff in + let tclk = (IdSolver.var_info_of_ident id_solver clk lxm).var_type_eff in let nargs,tl_opt = List.fold_left (fun (acc,tl_opt) (c,ve) -> diff --git a/src/evalType.mli b/src/evalType.mli index f5bd8e3671f91787af223fd056ceee4c5738df63..a434de6ec87fa42e9ae15a0e59e243af85b83fd2 100644 --- a/src/evalType.mli +++ b/src/evalType.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 30/01/2013 (at 11:10) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 18:07) by Erwan Jahier> *) (** Static evaluation of types. *) @@ -6,9 +6,9 @@ its "type_" field updated (and ditto for the type of its sub expr). Modif 12/07 : -- Travaille au niveau Lic. donc on vire Lic.id_solver qui +- Travaille au niveau Lic. donc on vire IdSolver.t qui travaille au niveau syntaxique *) -val f : Lic.id_solver -> Lic.val_exp -> Lic.val_exp * Lic.type_ list +val f : IdSolver.t -> Lic.val_exp -> Lic.val_exp * Lic.type_ list diff --git a/src/idSolver.ml b/src/idSolver.ml new file mode 100644 index 0000000000000000000000000000000000000000..d3abc6a2a3eb0e41eea12758771e9e0b4ff8e033 --- /dev/null +++ b/src/idSolver.ml @@ -0,0 +1,98 @@ +(* Time-stamp: <modified the 13/02/2013 (at 08:51) by Erwan Jahier> *) + +(** Utilities for managing node environements (items tables) *) + + +type t = { + id2const : Ident.idref -> Lxm.t -> Lic.const; + id2type : Ident.idref -> Lxm.t -> Lic.type_; + id2node : Ident.idref -> Lic.static_arg list -> Lxm.t -> Lic.node_exp; + + id2var : Ident.t -> Lxm.t -> Lic.var_info; + global_symbols : AstTabSymbol.t; +} + +type local_env = { + lenv_node_key : Lic.node_key ; +(* lenv_globals : pack_env ; *) + lenv_types : (Ident.t, Lic.type_) Hashtbl.t ; + lenv_const : (Ident.t, Lic.const) Hashtbl.t ; + lenv_nodes : (Ident.t, Lic.node_key) Hashtbl.t ; + lenv_vars : (Ident.t, Lic.var_info) Hashtbl.t ; +} + + +let (make_local_env : Lic.node_key -> local_env) = + fun nk -> + let res = + { + lenv_node_key = nk; + lenv_types = Hashtbl.create 0; + lenv_const = Hashtbl.create 0; + lenv_nodes = Hashtbl.create 0; + lenv_vars = Hashtbl.create 0; + } + in + (* fill tables using static arg info *) + List.iter + (function + | Lic.ConstStaticArgLic(id,ce) -> Hashtbl.add res.lenv_const id ce + | Lic.TypeStaticArgLic(id,te) -> Hashtbl.add res.lenv_types id te + | Lic.NodeStaticArgLic(id, nk) -> Hashtbl.add res.lenv_nodes id nk + ) + (snd nk); + + res + +let dump_local_env oc e = + let pt i t = Printf.fprintf oc "# type %s = %s\n" i (Lic.string_of_type t) in + Hashtbl.iter pt e.lenv_types; + let pc i t = Printf.fprintf oc "# const %s = %s\n" i (Lic.string_of_const t) in + Hashtbl.iter pc e.lenv_const; + (* let pn i (n,_,_) = Printf.fprintf oc "# node %s = %s\n" i (string_of_node_key n) in *) + let pn i nk = Printf.fprintf oc "# node %s = %s\n" i (Lic.string_of_node_key nk) in + Hashtbl.iter pn e.lenv_nodes; + + +(* Grouping those 2 ones is sometimes useful *) +type node_env = { + local : local_env; + global: t; +} + +let (lookup_type: local_env -> Ident.idref -> Lxm.t -> Lic.type_) = + fun env id lxm -> + Hashtbl.find env.lenv_types (Ident.of_idref id) + +let (lookup_node : local_env -> Ident.idref -> Lxm.t -> Lic.node_key) = + fun env id lxm -> + Hashtbl.find env.lenv_nodes (Ident.of_idref id) + +let (lookup_const: local_env -> Ident.idref -> Lxm.t -> Lic.const) = + fun env id lmx -> + Hashtbl.find env.lenv_const (Ident.of_idref id) + +let (lookup_var: local_env -> Ident.t -> Lxm.t -> Lic.var_info) = + fun env id lmx -> + Hashtbl.find env.lenv_vars id + + + +let node_exp_of_node_key + (id_solver: t) (node_key: Lic.node_key) (lxm : Lxm.t) + : Lic.node_exp = + let (id, sargs) = node_key in + id_solver.id2node (Ident.idref_of_long id) sargs lxm + +let var_info_of_ident + (id_solver: t) (id: Ident.t) (lxm : Lxm.t) + : Lic.var_info = + id_solver.id2var id lxm + +let const_eff_of_item_key + (id_solver: t) (id: Lic.item_key) (lxm : Lxm.t) + : Lic.const = + id_solver.id2const (Ident.idref_of_long id) lxm + + + diff --git a/src/lic.ml b/src/lic.ml index 8ed26cf37986b09008204df1eee6e5e654ebd616..6a42dda0823a130a4bf5b9a8838e131c810e7e59 100644 --- a/src/lic.ml +++ b/src/lic.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 07/02/2013 (at 16:09) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/02/2013 (at 08:45) by Erwan Jahier> *) (** Define the Data Structure representing Compiled programs. *) @@ -57,10 +57,6 @@ (initialisation) et dans CheckNode pour la partie node/template qui est faite à la demande. - - local_env : - structure qui gère l'environnement de compilation - d'un noeud/template. - TYPES FONCTIONNEL : - id_solver (en fait, une structure qui contient plusieurs fonctions, @@ -84,27 +80,6 @@ open AstV6 let dbg = Some (Verbose.get_flag "lazyc") -(*--------------------------------------------------------------------- -Type : id_solver ------------------------------------------------------------------------ - Joue le rôle d'environnemnt : contient des fonctions - pour résoudre les réferences aux idents. - (voir par exemple EvalConst, EvalType) - -N.B. - -- On fournit les constructeurs des id_solver courants - -----------------------------------------------------------------------*) -type id_solver = { - (* XXX I should not have [idref] in this module !!! *) - id2const : Ident.idref -> Lxm.t -> const; - id2type : Ident.idref -> Lxm.t -> type_; - id2node : Ident.idref -> static_arg list -> Lxm.t -> node_exp; - id2var : Ident.idref -> Lxm.t -> var_info; - global_symbols : AstTabSymbol.t; -} - (*--------------------------------------------------------------------- Type : type ----------------------------------------------------------------------- @@ -115,7 +90,7 @@ type id_solver = { - taille des tableaux résolues ----------------------------------------------------------------------*) -and type_ = +type type_ = | Bool_type_eff | Int_type_eff | Real_type_eff @@ -170,7 +145,7 @@ and left = and eq_info = left list * val_exp and val_exp = - { ve_core : val_exp_core ; + { ve_core : val_exp_core ; ve_typ : type_ list ; (* An empty list means that its type has not been computed (EvalType.f) yet. a cleaner solution would be to define two versions of val_exp: one with @@ -192,17 +167,17 @@ and val_exp_core = (by_name_op srcflagged * (Ident.t srcflagged * val_exp) list) | Merge of Ident.t srcflagged * (const srcflagged * val_exp) list -and operands = OperLic of val_exp list +and operands = OperLic of val_exp list (* Essayer d'y virer voir si ca marche encore *) and by_name_op = - | STRUCT of Ident.pack_name * Ident.idref * - Ident.idref option (* 'Some' if the struct is defined via a 'with' *) + | STRUCT of Ident.long * + Ident.t option (* XXX devrait etre une expression !!! *) + (* 'Some' if the struct is defined via a 'with' *) | STRUCT_anonymous and by_pos_op = | 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 | VAR_REF of Ident.t @@ -215,8 +190,8 @@ and by_pos_op = | TUPLE | CONCAT - | HAT of int * val_exp - | ARRAY of val_exp list + | HAT of int * val_exp (* XXX mettre ce val_exp dans les operands *) + | ARRAY of val_exp list (* XXX mettre ce val_exp dans les operands *) | STRUCT_ACCESS of Ident.t (* those are different from [by_pos_op] *) @@ -408,44 +383,6 @@ let (profile_of_node_exp : node_exp -> profile) = It would not be difficult to handle that here though. *) -type local_env = { - lenv_node_key : node_key ; -(* lenv_globals : pack_env ; *) - lenv_types : (Ident.t, type_) Hashtbl.t ; - lenv_const : (Ident.t, const) Hashtbl.t ; - (* lenv_nodes : (Ident.t, sarg_node_eff) Hashtbl.t ; *) - lenv_nodes : (Ident.t, node_key) Hashtbl.t ; - - lenv_vars : (Ident.t, var_info) Hashtbl.t ; -} - -(* Just to group those 2 ones *) -type node_env = { - local : local_env; - global: id_solver; -} - - -let (lookup_type: local_env -> Ident.idref -> Lxm.t -> type_) = - fun env id lxm -> - Hashtbl.find env.lenv_types (Ident.name_of_idref id) - -let lookup_node - (env: local_env) - (id: Ident.idref) - (sargs: static_arg list) - (lxm: Lxm.t) -(* : sarg_node_eff = *) -: node_key = - Hashtbl.find env.lenv_nodes (Ident.name_of_idref id) - -let (lookup_const: local_env -> Ident.idref -> Lxm.t -> const) = - fun env id lmx -> - Hashtbl.find env.lenv_const (Ident.name_of_idref id) - -let (lookup_var: local_env -> Ident.t -> Lxm.t -> var_info) = - fun env id lmx -> - Hashtbl.find env.lenv_vars id (****************************************************************************) @@ -534,8 +471,7 @@ let rec subst_matches (matches: type_matches) (t: type_) : type_ = | Abstract_type_eff(l,td) -> Verbose.exe ~flag:Global.paranoid ( fun () -> let t' = Abstract_type_eff(l,subst_matches matches td) in - if t <> t' then - assert false + if t <> t' then assert false ); t | Struct_type_eff(l,fl) -> @@ -543,8 +479,7 @@ let rec subst_matches (matches: type_matches) (t: type_) : type_ = let t' = Struct_type_eff( l, List.map (fun (id,(teff,copt)) -> (id,(subst_matches matches teff, copt))) fl) in - if t <> t' then - assert false + if t <> t' then assert false ); t | TypeVar tvar -> @@ -624,14 +559,12 @@ let (true_type_of_const: const -> type_) = | Abstract_const_eff (s, teff, _v, _is_exported) -> teff | teff -> type_of_const teff - let (type_of_left: left -> type_) = function | LeftVarLic(vi,lxm) -> vi.var_type_eff | LeftFieldLic(_, _, t) -> t | LeftArrayLic(_, _, t) -> t | LeftSliceLic(_, _, t) -> t - let rec (var_info_of_left: left -> var_info) = function @@ -689,11 +622,9 @@ and string_of_const = function (string_of_type t) (String.concat "; " (List.map string_of_field fl)) | Array_const_eff (ctab, t) -> - Printf.sprintf "[%s]" - (String.concat ", " (List.map string_of_const ctab)) + Printf.sprintf "[%s]" (String.concat ", " (List.map string_of_const ctab)) | Tuple_const_eff cl -> - Printf.sprintf "(%s)" - (String.concat ", " (List.map string_of_const cl)) + Printf.sprintf "(%s)" (String.concat ", " (List.map string_of_const cl)) and string_of_var_info x = (AstCore.string_of_var_nature x.var_nature_eff) ^ " " ^ @@ -764,37 +695,3 @@ Une erreur associ ----------------------------------------------------------------------*) exception Compile_node_error of node_key * Lxm.t * string exception Global_node_error of node_key * string - -let (make_local_env : node_key -> local_env) = - fun nk -> - Verbose.exe ~flag:dbg (fun () -> - printf "#make_local_env %s\n" (string_of_node_key nk)); - let res = - { - lenv_node_key = nk; - lenv_types = Hashtbl.create 0; - lenv_const = Hashtbl.create 0; - lenv_nodes = Hashtbl.create 0; - lenv_vars = Hashtbl.create 0; - } - in - (* fill tables using static arg info *) - List.iter - (function - | ConstStaticArgLic(id,ce) -> Hashtbl.add res.lenv_const id ce - | TypeStaticArgLic(id,te) -> Hashtbl.add res.lenv_types id te - (* | NodeStaticArgLic(id, ne, _) -> Hashtbl.add res.lenv_nodes id ne *) - | NodeStaticArgLic(id, nk) -> Hashtbl.add res.lenv_nodes id nk - ) - (snd nk); - - res - -let dump_local_env oc e = - let pt i t = Printf.fprintf oc "# type %s = %s\n" i (string_of_type t) in - Hashtbl.iter pt e.lenv_types; - let pc i t = Printf.fprintf oc "# const %s = %s\n" i (string_of_const t) in - Hashtbl.iter pc e.lenv_const; - (* let pn i (n,_,_) = Printf.fprintf oc "# node %s = %s\n" i (string_of_node_key n) in *) - let pn i nk = Printf.fprintf oc "# node %s = %s\n" i (string_of_node_key nk) in - Hashtbl.iter pn e.lenv_nodes; diff --git a/src/licDump.ml b/src/licDump.ml index 3432f7a657c74736cd2875c05797a9348c432745..5779fc2ea8c99baae7f2e73b1db7a41065cf7dad 100644 --- a/src/licDump.ml +++ b/src/licDump.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 07/02/2013 (at 15:55) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 18:03) by Erwan Jahier> *) open Errors open Printf @@ -513,13 +513,7 @@ and string_of_val_exp_eff_core ve_core = ) | CallByNameLic(by_name_op_eff, fl) -> (match by_name_op_eff.it with - | STRUCT (pn,idref, _dft_opt) -> ( - match Ident.pack_of_idref idref with - | Some pn -> Ident.string_of_idref idref - | None -> - let idref = Ident.make_idref pn (Ident.of_idref idref) in - Ident.string_of_idref idref - ) + | STRUCT (long, _dft_opt) -> (Ident.string_of_long long) | STRUCT_anonymous -> "" ) ^ ( "{" ^ (String.concat ";" diff --git a/src/licEvalClock.ml b/src/licEvalClock.ml index 831a26836a6e4b98c4214d99f7c3c61fc7ac7445..b2d0d944a0d888d18d7d782da5d3a3e63075d3ab 100644 --- a/src/licEvalClock.ml +++ b/src/licEvalClock.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 06/02/2013 (at 16:45) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 17:51) by Erwan Jahier> *) open AstPredef @@ -36,7 +36,7 @@ let rec fill x n = if n > 0 then (x::(fill x (n-1))) else [] (* This table contains the clock profile of predefined operators *) let f - (id_solver: Lic.id_solver) + (id_solver: IdSolver.t) (op: op) (lxm: Lxm.t) : clocker = fun s -> diff --git a/src/licEvalClock.mli b/src/licEvalClock.mli index 2d37667fe1326c800819adea356eccf0641eaaeb..08e6012d9404d07f06fc1ddf4590ccb20ae05e92 100644 --- a/src/licEvalClock.mli +++ b/src/licEvalClock.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 06/02/2013 (at 16:46) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 18:07) 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 -> clocker +val f: IdSolver.t -> AstPredef.op -> Lxm.t -> clocker diff --git a/src/licEvalConst.ml b/src/licEvalConst.ml index a32e61f643bffdcddda8c4d767fe371f1894168f..c56e9b9e790f6fafee1fc8752d786893c8e7ccc1 100644 --- a/src/licEvalConst.ml +++ b/src/licEvalConst.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 06/02/2013 (at 16:36) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 17:51) by Erwan Jahier> *) open AstPredef open Lic @@ -121,7 +121,7 @@ let (boolred_evaluator : int -> int -> const_evaluator) = (* exported *) let f - (id_solver: Lic.id_solver) + (id_solver: IdSolver.t) (op: op) (lxm: Lxm.t) (sargs: Lic.static_arg list) diff --git a/src/licEvalConst.mli b/src/licEvalConst.mli index 298b2122dc72f689bbf74c743e7f00f4acb1937a..ddb6a1a50576fdf2b0a24c43e17cf0a5396acdb9 100644 --- a/src/licEvalConst.mli +++ b/src/licEvalConst.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 13/12/2012 (at 11:32) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 18:07) by Erwan Jahier> *) (** Performs static evaluations of predefined operators in constant expressions *) @@ -14,5 +14,5 @@ val arity_error_const : Lic.const list -> string -> 'a type const_evaluator = Lic.const AstPredef.evaluator (* That function says how to statically evaluate constants *) -val f: Lic.id_solver -> AstPredef.op -> Lxm.t -> Lic.static_arg list -> const_evaluator +val f: IdSolver.t -> AstPredef.op -> Lxm.t -> Lic.static_arg list -> const_evaluator diff --git a/src/licEvalType.ml b/src/licEvalType.ml index b77ca891a9a8216ac5b2cdeca512e3b7e3ccf579..f04e4f18483da7476b7e4031cf65158c4ee8a20d 100644 --- a/src/licEvalType.ml +++ b/src/licEvalType.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 06/02/2013 (at 16:35) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/02/2013 (at 08:49) by Erwan Jahier> *) open AstPredef open Lxm @@ -115,7 +115,7 @@ let get_id_type vi = vi.var_name_eff, vi.var_type_eff let condact_profile - (id_solver: Lic.id_solver) + (id_solver: IdSolver.t) (lxm: Lxm.t) (sargs: Lic.static_arg list) : Lic.node_profile = @@ -134,7 +134,7 @@ let condact_profile | _ -> assert false in (* recherche le profil de nk ... *) - let ne = UglyStuff.node_exp_of_node_key id_solver nk lxm in + let ne = IdSolver.node_exp_of_node_key id_solver nk lxm in let inlist = ne.inlist_eff in let outlist = ne.outlist_eff in @@ -158,7 +158,7 @@ let condact_profile let map_profile - (id_solver: Lic.id_solver) + (id_solver: IdSolver.t) (lxm: Lxm.t) (sargs: Lic.static_arg list) : Lic.node_profile = @@ -172,7 +172,7 @@ Gen a node of type : a_1^c * ... * a_n^c -> b_1^c * ... * b_k^c --------------------------------------------------------------------*) let (nk, c) = get_node_and_int_const lxm sargs in (* recherche le profil de nk ... *) - let ne = UglyStuff.node_exp_of_node_key id_solver nk lxm in + let ne = IdSolver.node_exp_of_node_key id_solver nk lxm in let inlist = ne.inlist_eff in let outlist = ne.outlist_eff in let lti = type_to_array_type inlist c in @@ -181,7 +181,7 @@ Gen a node of type : a_1^c * ... * a_n^c -> b_1^c * ... * b_k^c res let fillred_profile - (id_solver: Lic.id_solver) + (id_solver: IdSolver.t) (lxm: Lxm.t) (sargs: Lic.static_arg list) : Lic.node_profile = @@ -196,7 +196,7 @@ Gen a node : aa * a_1^c * ... * a_n^c -> aa * b_1^c * ... * b_k^c let (nk, c) = get_node_and_int_const lxm sargs in (* recherche le profil de nk ... *) - let ne = UglyStuff.node_exp_of_node_key id_solver nk lxm in + let ne = IdSolver.node_exp_of_node_key id_solver nk lxm in let inlist = ne.inlist_eff in let outlist = ne.outlist_eff in @@ -239,7 +239,7 @@ Gen a node : aa * a_1^c * ... * a_n^c -> aa * b_1^c * ... * b_k^c returns the profile bool^k -> bool *) let boolred_profile - (id_solver: Lic.id_solver) + (id_solver: IdSolver.t) (lxm: Lxm.t) (sargs: Lic.static_arg list) : Lic.node_profile = @@ -259,7 +259,7 @@ let boolred_profile let op2profile (* BEQUILLE *) - (id_solver_opt: Lic.id_solver option) + (id_solver_opt: IdSolver.t option) (op: AstPredef.op) (lxm: Lxm.t) : Lic.node_profile = @@ -295,10 +295,10 @@ let op2profile (* exported *) (* VERSION GÉNÉRALE, valable pour les MACROS, et qui necessite donc - un Lic.id_solver + un IdSolver.t *) let make_node_exp_eff - (id_solver: Lic.id_solver) + (id_solver: IdSolver.t) (has_mem: bool option) (op: op) (lxm: Lxm.t) @@ -391,7 +391,7 @@ let make_simple_node_exp_eff (* exported *) let f - (id_solver: Lic.id_solver) + (id_solver: IdSolver.t) (op: op) (lxm: Lxm.t) : typer = fun ll -> diff --git a/src/licEvalType.mli b/src/licEvalType.mli index e9c3225c9662d8501ba2cc0b8ceb5e8ecd352d85..1f96bbf6a49234a6a881e5c24be7eb684f2956d4 100644 --- a/src/licEvalType.mli +++ b/src/licEvalType.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 06/02/2013 (at 16:36) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 18:06) by Erwan Jahier> *) (** Performs static evaluations of predefined operators in type expressions *) @@ -15,16 +15,16 @@ 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 -> typer +val f : IdSolver.t -> AstPredef.op -> Lxm.t -> typer (** Does not work for NOR_n and DIESE_n! *) (** PIS ALLER : 2 versions - - une pour les macros, qui nécessite un Lic.id_solver pour traiter les Lic.static_arg list + - une pour les macros, qui nécessite un IdSolver.t pour traiter les Lic.static_arg list - 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.node_exp + IdSolver.t -> 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 d4690141fe7b6780f0781321d3e1c98e05d4112e..c4707729487bee1c16fd68051619d188afdac446 100644 --- a/src/licTab.ml +++ b/src/licTab.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 06/02/2013 (at 18:01) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/02/2013 (at 08:21) by Erwan Jahier> *) open Lxm @@ -6,6 +6,7 @@ open Errors open AstV6 open AstCore open Lic +open IdSolver (** DEBUG FLAG POUR CE MODULE : *) let dbg = Some (Verbose.get_flag "lazyc") @@ -509,7 +510,7 @@ and (type_check_do: t -> Ident.long -> Lxm.t -> AstTabSymbol.t -> bool -> try ( (* Solveur d'idref pour les appels à eval_type/eval_const *) let id_solver = { - id2var = (fun idref lxm -> raise (Unknown_var(lxm,idref)) (* should not occur *)); + id2var = (fun id lxm -> raise (Unknown_var(lxm,id)) (* should not occur *)); id2const = solve_const_idref this symbols provide_flag pack_name; id2type = solve_type_idref this symbols provide_flag pack_name; id2node = solve_node_idref this symbols provide_flag pack_name; @@ -760,7 +761,7 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t -> Verbose.exe ~flag:dbg (fun () -> Printf.printf "# local_env while entering (node_check_do %s):\n" (Lic.string_of_node_key nk); - Lic.dump_local_env stderr local_env; + IdSolver.dump_local_env stderr local_env; flush stdout ) in @@ -770,23 +771,24 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t -> one. *) id2var = (* var can only be local to the node *) (fun id lxm -> - try lookup_var local_env (Ident.of_idref id) lxm + try IdSolver.lookup_var local_env id lxm with Not_found -> raise (Unknown_var(lxm,id)) ); id2const = (fun id lxm -> - try lookup_const local_env id lxm + try IdSolver.lookup_const local_env id lxm with Not_found -> solve_const_idref this symbols provide_flag pack_name id lxm ); id2type = (fun id lxm -> - try lookup_type local_env id lxm + try IdSolver.lookup_type local_env id lxm with Not_found -> Verbose.exe ~level:3 ( fun () -> - Printf.printf "*** Dont find type %s in local_env\n" (Ident.string_of_idref id); + Printf.printf "*** Dont find type %s in local_env\n" + (Ident.string_of_idref id); Printf.printf "*** local_env.lenv_types contain def for: "; Hashtbl.iter (fun id t -> @@ -798,7 +800,7 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t -> id2node = (fun id sargs lxm -> (try - let (node_id,sargs) = Lic.lookup_node local_env id sargs lxm in + let (node_id,sargs) = IdSolver.lookup_node local_env id lxm in let node_id = Ident.idref_of_long node_id in solve_node_idref this symbols provide_flag pack_name node_id sargs lxm (* node_check this (node_id,[]) lxm *) @@ -819,7 +821,7 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t -> Verbose.exe ~level:3 (fun () -> Printf.printf "*** local_env while entering (make_node_eff %s):\n" (Ident.to_string id); - Lic.dump_local_env stderr local_env + IdSolver.dump_local_env stderr local_env ); (********************************************************) (* LOCAL CONSTANTS are evaluated and added to local_env *) @@ -1151,7 +1153,7 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t -> (aliased_node: node_exp) (alias_nk: node_key) (local_env: local_env) - (node_id_solver: id_solver) + (node_id_solver: IdSolver.t) (vil: var_info list) (vol: var_info list) (lxm: Lxm.t) diff --git a/src/main.ml b/src/main.ml index 84d7a0d88b4d5a389036508e9a88dcfea574e77e..4b86a84360ab20984ad363690e88586c3067b318 100644 --- a/src/main.ml +++ b/src/main.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 23/01/2013 (at 16:47) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/02/2013 (at 08:22) by Erwan Jahier> *) @@ -181,7 +181,7 @@ let main = ( print_compile_error (Lxm.last_made ()) "syntax error"; my_exit 1 | Unknown_var(lxm,id) -> - print_compile_error lxm ("unknown variable (" ^ (Ident.string_of_idref id) ^")") + print_compile_error lxm ("unknown variable (" ^ (Ident.to_string id) ^")") | Unknown_constant(lxm,str) -> print_compile_error lxm ("unknown constant (" ^ str ^")") | Compile_error(lxm,msg) -> diff --git a/src/uglyStuff.ml b/src/uglyStuff.ml deleted file mode 100644 index 1ed25936ff80119ee8911024444653d8e1dd6900..0000000000000000000000000000000000000000 --- a/src/uglyStuff.ml +++ /dev/null @@ -1,30 +0,0 @@ - -(** XXX REMOVE ME : Crutch for make it works - - Des béquilles et autres trucs moches qui devraient etre refaits ... -*) - - -(** -ACCES AUX INFOS DEJA COMPILEES, - -- EvalType utilise le mécanisme id_solver pour acceder aux -infos déjà compilées, alors que c'est pas fait pour... -- Y'a un probleme de gestion d'environnement a revoir ... -*) -let node_exp_of_node_key - (id_solver: Lic.id_solver) (node_key: Lic.node_key) (lxm : Lxm.t) - : Lic.node_exp = - let (id, sargs) = node_key in - id_solver.Lic.id2node (Ident.idref_of_long id) sargs lxm - -let var_info_of_ident - (id_solver: Lic.id_solver) (id: Ident.t) (lxm : Lxm.t) - : Lic.var_info = - id_solver.Lic.id2var (Ident.idref_of_id id) lxm - -let const_eff_of_item_key - (id_solver: Lic.id_solver) (id: Lic.item_key) (lxm : Lxm.t) - : Lic.const = - id_solver.Lic.id2const (Ident.idref_of_long id) lxm - diff --git a/src/unifyClock.ml b/src/unifyClock.ml index e52a73094a3faa2eac23710a043a3b610d8a3555..4b785df043ceae7d05fe210fc3a58d4ef32b44b8 100644 --- a/src/unifyClock.ml +++ b/src/unifyClock.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 07/02/2013 (at 14:32) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/02/2013 (at 18:06) by Erwan Jahier> *) open LicDump @@ -328,8 +328,7 @@ let rec (const_to_val_eff: Lxm.t -> bool -> subst -> const -> subst * val_exp) = | Struct_type_eff(sname, _) -> sname | _ -> assert false in - let pack = Ident.pack_of_long sname in - let name_op_flg = flagit (STRUCT(pack, Ident.idref_of_long sname, None)) lxm in + let name_op_flg = flagit (STRUCT(sname, None)) lxm in let s, fl = List.fold_left (fun (s,fl) (id,const) -> diff --git a/test/lus2lic.log.ref b/test/lus2lic.log.ref index 83fff7e8dbe3c9aa8585e2de621af57be7267aab..375f4569812a6cc1e18b10564b66efcb2d28d738 100644 --- a/test/lus2lic.log.ref +++ b/test/lus2lic.log.ref @@ -1,4 +1,4 @@ -Test Run By jahier on Thu Feb 7 15:49:50 2013 +Test Run By jahier on Thu Feb 7 16:15:01 2013 Native configuration is i686-pc-linux-gnu === lus2lic tests === @@ -835,6 +835,16 @@ spawn ./lus2lic -ec -o /tmp/ts04.ec should_work/ts04.lus PASS: ./lus2lic {-ec -o /tmp/ts04.ec should_work/ts04.lus} spawn ./ec2c -o /tmp/ts04.c /tmp/ts04.ec PASS: ./ec2c {-o /tmp/ts04.c /tmp/ts04.ec} +spawn ./lus2lic -o /tmp/bug_map_fby.lic should_work/bug_map_fby.lus +*** Error in file "/home/jahier/lus2lic/test/should_work/bug_map_fby.lus", line 33, col 13 to 15, token 'fby': +*** Bad static argument nature, a node was expected + +FAIL: without any option: ./lus2lic {-o /tmp/bug_map_fby.lic should_work/bug_map_fby.lus} +spawn ./lus2lic -ec -o /tmp/bug_map_fby.ec should_work/bug_map_fby.lus +*** Error in file "/home/jahier/lus2lic/test/should_work/bug_map_fby.lus", line 33, col 13 to 15, token 'fby': +*** Bad static argument nature, a node was expected + +FAIL: Generate ec code : ./lus2lic {-ec -o /tmp/bug_map_fby.ec should_work/bug_map_fby.lus} spawn ./lus2lic -o /tmp/multiclock.lic should_work/multiclock.lus PASS: ./lus2lic {-o /tmp/multiclock.lic should_work/multiclock.lus} spawn ./lus2lic -ec -o /tmp/multiclock.ec should_work/multiclock.lus @@ -1754,11 +1764,12 @@ spawn ./lus2lic -o /tmp/activation1.lic should_fail/semantics/broken/activation1 XPASS: Test bad programs (semantics): lus2lic {-o /tmp/activation1.lic should_fail/semantics/broken/activation1.lus} spawn ./lus2lic -o /tmp/bug.lic should_fail/semantics/broken/bug.lus XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/semantics/broken/bug.lus} -testcase ./lus2lic.tests/progression.exp completed in 1 seconds +testcase ./lus2lic.tests/progression.exp completed in 0 seconds === lus2lic Summary === # of expected passes 744 +# of unexpected failures 2 # of unexpected successes 11 # of expected failures 37 -runtest completed at Thu Feb 7 15:50:15 2013 +runtest completed at Thu Feb 7 16:15:25 2013 diff --git a/test/lus2lic.sum b/test/lus2lic.sum index 0aece9bbd02cf34a46d19032bcb80c55b9972316..7572ddc4c7273a8bffd684bf413adf07fbf812c0 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,4 +1,4 @@ -Test Run By jahier on Thu Feb 7 16:10:22 2013 +Test Run By jahier on Wed Feb 13 09:20:45 2013 Native configuration is i686-pc-linux-gnu === lus2lic tests === @@ -420,6 +420,8 @@ PASS: ./ec2c {-o /tmp/left.c /tmp/left.ec} PASS: ./lus2lic {-o /tmp/ts04.lic should_work/ts04.lus} PASS: ./lus2lic {-ec -o /tmp/ts04.ec should_work/ts04.lus} PASS: ./ec2c {-o /tmp/ts04.c /tmp/ts04.ec} +FAIL: without any option: ./lus2lic {-o /tmp/bug_map_fby.lic should_work/bug_map_fby.lus} +FAIL: Generate ec code : ./lus2lic {-ec -o /tmp/bug_map_fby.ec should_work/bug_map_fby.lus} PASS: ./lus2lic {-o /tmp/multiclock.lic should_work/multiclock.lus} PASS: ./lus2lic {-ec -o /tmp/multiclock.ec should_work/multiclock.lus} PASS: ./ec2c {-o /tmp/multiclock.c /tmp/multiclock.ec} @@ -805,5 +807,6 @@ XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/seman === lus2lic Summary === # of expected passes 744 +# of unexpected failures 2 # of unexpected successes 11 # of expected failures 37 diff --git a/test/should_work/bug_map_fby.lus b/test/should_work/bug_map_fby.lus new file mode 100644 index 0000000000000000000000000000000000000000..723eb88c82bbe2ae95af1302ba86af5fbb6525fc --- /dev/null +++ b/test/should_work/bug_map_fby.lus @@ -0,0 +1,35 @@ +type state = struct { + idy : int; + leader : int; + level : int +}; +const n=5; +const inits = [ + state { idy = 33; leader = 5; level = 2} , + state { idy = 41; leader = 5; level = 3} , + state { idy = 21; leader = 5; level = 4} , + state { idy = 10; leader = 10; level = 0} , + state { idy = 75; leader = 75; level = 0} +] ; +const O = false; +const I = true; +const connect = [ + [ O, I, O, O, I ], + [ I, O, I, O, O ], + [ O, I, O, I, O ], + [ O, O, I, O, I ], + [ I, O, O, I, O ] +]; +node algo (clk: bool; ps: state; neigh: bool^5) returns (ns: state); +let + ns = if clk then + state { idy = ps.idy ; leader = ps.leader; level = ps.level + 1 } + else + state { idy = ps.idy ; leader = ps.leader; level = ps.level }; +tel +node simu(ck:bool^5) returns (s: state^n); +var ps : state^n; +let + ps = map<<fby, 5>>(inits, s); + s = map<<algo, n>> (ck, ps, connect); +tel diff --git a/todo.org b/todo.org index e09a4718a586e505c8d4e9949946cb98509f60a7..9c6262f7b4d182ac3ccbd130680c18cb3bcb9ec7 100644 --- a/todo.org +++ b/todo.org @@ -59,69 +59,22 @@ Pascal a introduit un mecanisme qui shunte LicName -> en discuter avec lui. ** TODO Définir les fonctions de UglyStuff proprement - State "TODO" from "" [2012-12-10 Mon 16:38] file:~/lus2lic/src/uglyStuff.ml +bon j'y ai mis dans IdSolver ; c'est pas si choquant maintenant que +ces fonctions ne sont plus dans Lic. -** TODO Refaire une passe pour virer une fois pour toute cette histoire d'idref dans Eff. - cf file:/~/lus2lic/src/eff.ml line 189 -QU: Pascal l'a fait ? - -* Languages issues -** TODO Verifier les boucles combinatoires meme quand on ne genere pas de ec - - State "TODO" from "STARTED" [2013-01-29 Tue 09:49] +** TODO Mettre tout les val_exp dans les operand dans Lic + - State "TODO" from "" [2013-02-12 Tue 18:30] - ./lus2lic should_fail/semantics/deploop.lus +XXX essayer de virer le constructeur Oper qui n'a pas l'air de servir à grand chose -On pourrait utiliser file:src/misc.ml pour prendre finement en compte les -struct et les arrays. +** TODO definir un Lic.STRUCT_WITH plutot que de passer par un type option + - State "TODO" from "" [2013-02-12 Tue 18:32] -** TODO operateurs iterables - - State "TODO" from "" [2012-03-30 Fri 17:03] -- mettre dans la doc -- voir si on ne pourrait pas completer la liste -en mettant tous les operateurs unaires de - file:~/lus2lic/src/syntaxTreeCore.ml::91 -dans - file:~/lus2lic/src/predef.ml::62 -- tout au moins, eviter les assert false sur -#+BEGIN_CENTER lustre :exports bug_map_fby.lus -type state = struct { - idy : int; - leader : int; - level : int -}; -const n=5; -const inits = [ - state { idy = 33; leader = 5; level = 2} , - state { idy = 41; leader = 5; level = 3} , - state { idy = 21; leader = 5; level = 4} , - state { idy = 10; leader = 10; level = 0} , - state { idy = 75; leader = 75; level = 0} -] ; -const O = false; -const I = true; -const connect = [ - [ O, I, O, O, I ], - [ I, O, I, O, O ], - [ O, I, O, I, O ], - [ O, O, I, O, I ], - [ I, O, O, I, O ] -]; -node algo (clk: bool; ps: state; neigh: bool^5) returns (ns: state); -let - ns = if clk then - state { idy = ps.idy ; leader = ps.leader; level = ps.level + 1 } - else - state { idy = ps.idy ; leader = ps.leader; level = ps.level }; -tel -node simu(ck:bool^5) returns (s: state^n); -var ps : state^n; -let - ps = map<<fby, 5>>(inits, s); - s = map<<algo, n>> (ck, ps, connect); -tel -#+END_CENTER +** TODO fixer le commentaire "OBSOLETE ET UN PEU FAUX" + - State "TODO" from "" [2013-02-13 Wed 08:41] + file:/~/lus2lic/src/lic.ml::440 - * Divers ** STARTED Intégrer le résultat de mly2bnf dans le manuel ** TODO lic2c : le jour ou on genere du code C, y'a peut-etre des trucs a recuperer @@ -135,6 +88,8 @@ des tableaux Style 'mk_tab__param_struct::toto_toto_3' alors qu'aucun package ne s'appelle 'mk_tab__param_struct' +** TODO le with devrait opérer sur une val_exp, pas sur un ident. + - State "TODO" from "" [2013-02-12 Tue 18:31] * Types alias ** WAITING Ya un probleme avec ce fichier lustre (compilait avant) @@ -192,7 +147,7 @@ des "type_ref of string" (Ce qui simplifiera la travail des passes ultérieures, style lic2c). Bon, je ferai ca quand tous les tests fonctionneront et pendant que -j'essairais de me passer de ulglyStuff/id_solver. A vois aussi ce qui +j'essairais de me passer de ulglyStuff/id_solver. A voir aussi ce qui sera le plus pratique quand je me remettrai à bosser sur le lic2c/licexe @@ -219,3 +174,61 @@ du with ? comment fait caml ? - State "TODO" from "" [2012-10-26 Fri 14:59] + +** TODO operateurs iterables + - State "TODO" from "" [2012-03-30 Fri 17:03] +- mettre dans la doc +- voir si on ne pourrait pas completer la liste +en mettant tous les operateurs unaires de + file:~/lus2lic/src/syntaxTreeCore.ml::91 +dans + file:~/lus2lic/src/predef.ml::62 +- tout au moins, eviter les assert false sur +#+BEGIN_CENTER lustre :exports bug_map_fby.lus +type state = struct { + idy : int; + leader : int; + level : int +}; +const n=5; +const inits = [ + state { idy = 33; leader = 5; level = 2} , + state { idy = 41; leader = 5; level = 3} , + state { idy = 21; leader = 5; level = 4} , + state { idy = 10; leader = 10; level = 0} , + state { idy = 75; leader = 75; level = 0} +] ; +const O = false; +const I = true; +const connect = [ + [ O, I, O, O, I ], + [ I, O, I, O, O ], + [ O, I, O, I, O ], + [ O, O, I, O, I ], + [ I, O, O, I, O ] +]; +node algo (clk: bool; ps: state; neigh: bool^5) returns (ns: state); +let + ns = if clk then + state { idy = ps.idy ; leader = ps.leader; level = ps.level + 1 } + else + state { idy = ps.idy ; leader = ps.leader; level = ps.level }; +tel +node simu(ck:bool^5) returns (s: state^n); +var ps : state^n; +let + ps = map<<fby, 5>>(inits, s); + s = map<<algo, n>> (ck, ps, connect); +tel +#+END_CENTER + +bon, y'a plus d'erreur, mais ca ne compile pas. Est-ce choquant ? + +** TODO Verifier les boucles combinatoires meme quand on ne genere pas de ec + - State "TODO" from "STARTED" [2013-01-29 Tue 09:49] + + ./lus2lic should_fail/semantics/deploop.lus + +On pourrait utiliser file:src/misc.ml pour prendre finement en compte les +struct et les arrays. + diff --git a/todo.org_archive b/todo.org_archive index 064882592ea8060e5aa333803a78abc0fafa372b..f06f5be5f6c23aceb5869513b433dfefffd9490d 100644 --- a/todo.org_archive +++ b/todo.org_archive @@ -443,6 +443,66 @@ main peut-on l'appeller with ? file:test/should_work/struct_with.lus +* TODO Refaire une passe pour virer une fois pour toute cette histoire d'idref dans Eff. + :PROPERTIES: + :ARCHIVE_TIME: 2013-02-13 Wed 09:22 + :ARCHIVE_FILE: ~/lus2lic/todo.org + :ARCHIVE_OLPATH: Aesthetes issues + :ARCHIVE_CATEGORY: lv6 + :ARCHIVE_TODO: TODO + :END: + cf file:/~/lus2lic/src/lic.ml::189 +QU: Pascal l'a fait ? + + +En fait, il y a 3 types d'idents +- long : + + pack+nom + + Sert à dénoter les items (node/type/const) externes au pack courant + +- t : + + juste le nom + + Sert à dénoter les items locaux au pack courant + les variables + +- idref : + + le pack est en option + + utile dans les premieres phases de la compil + + actuellement utilisé comme machin pour ranger des trucs dont on + ne sait pas trop s'il s'agit d'Ident.t ou Ident.long et qui + permet d'entretenir une espece de flou désagréable dans le code + et mon esprit... + + +les idref sont sensé disparaitre une fois que tous les problemes +d'identificateurs ont été résolu (ce qui n'est pas le cas +actuellement). + +Le Lic.id_solver est là pour résoudre les ident.t ; bizzarement, il +prend en entrée ces fameux idref que je voudrais voir disparaitre de +Lic. + +Le truc, c'est que cet id_solver permet aussi de récuperer des infos +sur les long, d'ou le idref qui est plus versatile... + +sol 1 : dupliquer id2const, id2type, etc et créer des long2const, etc. +du coup, plus d'idref ! + +* TODO Définir les fonctions de UglyStuff proprement + - State "TODO" from "" [2012-12-10 Mon 16:38] + :PROPERTIES: + :ARCHIVE_TIME: 2013-02-13 Wed 09:23 + :ARCHIVE_FILE: ~/lus2lic/todo.org + :ARCHIVE_OLPATH: Aesthetes issues + :ARCHIVE_CATEGORY: lv6 + :ARCHIVE_TODO: TODO + :END: +file:~/lus2lic/src/uglyStuff.ml +bon j'y ai mis dans IdSolver ; c'est pas si choquant maintenant que +ces fonctions ne sont plus dans Lic. + + + +