From 84b93e34d4f4e28c8090aea5de4d1ca8ff8bf82b Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Tue, 12 Feb 2008 09:26:41 +0100 Subject: [PATCH] Add tests for LazyCompiler.check_node. Better error msgs. Renaming idents. --- src/TODO | 27 +++- src/compiledData.ml | 14 +- src/errors.ml | 4 +- src/expandPack.ml | 8 +- src/lazyCompiler.ml | 223 +++++++++++++++++++---------- src/lxm.ml | 14 +- src/main.ml | 8 +- src/parser.mly | 24 ++-- src/symbolTab.ml | 35 ++--- src/symbolTab.mli | 21 +-- src/syntaxTreeCore.ml | 28 ++-- src/syntaxTreeDump.ml | 16 +-- src/test/Makefile | 12 +- src/test/test.res.exp | 316 +++++++++++++++++++++++++++++++----------- src/version.ml | 4 +- 15 files changed, 491 insertions(+), 263 deletions(-) diff --git a/src/TODO b/src/TODO index 66d2017b..6e46de7c 100644 --- a/src/TODO +++ b/src/TODO @@ -37,6 +37,7 @@ parce que dans lazyCompile.ml, ca s'appele "do_node" ... * "extern", "unsafe", and "memoryless" annotations + Rajouter ces 3 mots clefs dans la syntaxe. L'idée, c'est que par defaut, un noeud lustre est @@ -49,13 +50,25 @@ on pourra rajouter l'alias function == extern memoryless node pour la compatibilité ascendente -nb : pour les noeuds «internes», on peut se passer des annotations "memoryless", -et "unsafe" dans la mesure où on sait toujours les inferer. Mais laisser les gens -le mettre s'ils le veulent, ca ne mange pas de pain. - -nb2 : rejeter les noeuds sans memoire (resp faisant sans l'annotation "memoryless", -ca ne serait pas backward compatible. Mais on pourrait alors rajouter l'option ---infer-memoryless-annotation. +bon, non en fait, il n'y a pas besoin de rajouter tous ces mots clefs. + o memoryless -> function, qui existe deja + o extern -> y'a rien besoin de dire : on regarde juste s'il y a un + corps ou pas + o unsafe -> la, oui, il faut un mot clef. on y fera plus + tard. Plus precisement, on verifie la cohérence de declarations + avec ce qui est généré, puis on transmet l'info telle quelle à + lic si tout est correct. + + +nb : pour les noeuds «internes», on peut se passer de d'indiquer + qu'il s'agit d'une "function", qui est "unsafe" dans la mesure où on + sait toujours inferer ces infos. Mais laisser les gens le mettre + s'ils le veulent, ca ne mange pas de pain. + +nb2 : rejeter les noeuds sans memoire (ce faisant sans indiquer +"function", ca ne serait pas backward compatible. Mais on pourrait +alors rajouter l'option --infer-memoryless-annotation). Ou alors, on +se contente d'emmettre des warning. diff --git a/src/compiledData.ml b/src/compiledData.ml index bd359536..5c3a3919 100644 --- a/src/compiledData.ml +++ b/src/compiledData.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 07/02/2008 (at 15:01) by Erwan Jahier> *) +(** Time-stamp: <modified the 11/02/2008 (at 15:34) by Erwan Jahier> *) (** @@ -491,7 +491,6 @@ and string_of_type_eff_list = function ) - let rec string_of_node_key (nkey: node_key) = ( let arg2string (sa : static_arg_eff) = match sa with @@ -500,7 +499,7 @@ let rec string_of_node_key (nkey: node_key) = ( | OperStaticArgEff (id, opeff) -> ( match opeff with | PredefOper posop -> sprintf "operator %s" (SyntaxTreeDump.op2string posop) - | FuncOper feff -> sprintf "node %s" (Ident.to_string feff.fe_name) + | FuncOper feff -> sprintf "func %s" (Ident.to_string feff.fe_name) | NodeOper neff -> sprintf "node %s" (string_of_node_key neff.nf_key) ) in @@ -511,6 +510,15 @@ let rec string_of_node_key (nkey: node_key) = ( sprintf "%s<<%s>>" (Ident.string_of_long ik) (String.concat ", " astrings) ) +let (string_of_node_eff: node_eff -> string) = + fun neff -> + (string_of_node_key neff.nf_key) ^ + "(" ^ + (String.concat ", " (List.map string_of_type_eff neff.nf_in_types)) ^ + ") returns (" ^ + (String.concat ", " (List.map string_of_type_eff neff.nf_out_types)) ^ + ") on clock XXX\n" + let string_of_clock (ck : clock_eff) = ( match ck with BaseClockEff -> "<base>" diff --git a/src/errors.ml b/src/errors.ml index 66970c28..0e75d04e 100644 --- a/src/errors.ml +++ b/src/errors.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 18/12/2007 (at 14:55) by Erwan Jahier> *) +(** Time-stamp: <modified the 11/02/2008 (at 17:51) by Erwan Jahier> *) (*---------------------------------------------------------------------- module : Errors.ml @@ -106,7 +106,7 @@ exception Global_error of string Formatage standard des erreurs de compil ----------------------------------------------------------------------*) let compile_error_string lxm msg = ( - Printf.sprintf "Error. %s:\n---> %s" (Lxm.details lxm) msg + Printf.sprintf "*** Error %s: %s\n" (Lxm.details lxm) msg ) (*--------------------------------------------------------------------- diff --git a/src/expandPack.ml b/src/expandPack.ml index 73bc7c0b..d5be0b92 100644 --- a/src/expandPack.ml +++ b/src/expandPack.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 07/02/2008 (at 15:32) by Erwan Jahier> *) +(** Time-stamp: <modified the 11/02/2008 (at 09:37) by Erwan Jahier> *) open Lxm open SyntaxTree @@ -91,9 +91,9 @@ let (doit: | _ -> instance_error () in let ni = Node { - uname = s; - static_args = [] ; - def = NodeAlias (Some(inl,outl), ne) ; + uni_name = s; + uni_static_params = [] ; + uni_def = NodeAlias (Some(inl,outl), ne) ; } in let x = Lxm.flagit (NodeInfo ni) p.src in newprov := x::!newprov ; diff --git a/src/lazyCompiler.ml b/src/lazyCompiler.ml index eeef7b5b..bf9482df 100644 --- a/src/lazyCompiler.ml +++ b/src/lazyCompiler.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 07/02/2008 (at 15:22) by Erwan Jahier> *) +(** Time-stamp: <modified the 11/02/2008 (at 17:46) by Erwan Jahier> *) open Lxm @@ -18,12 +18,13 @@ exception BadCheckRef_error let recursion_error (lxm : Lxm.t) (stack : string list) = let rec string_of_stack = function - | [] -> "" + | [] -> "nostack" | s::[] -> s | s::l -> s^"\n > "^(string_of_stack l) in raise ( Compile_error (lxm, - "recursion loop detected:\n > "^(string_of_stack stack) + "recursion loop detected:\n > " + ^(string_of_stack stack) )) @@ -110,7 +111,7 @@ let x_check Hashtbl.add tab x_key Checking; let (x_pack,xn) = (pack_of_x_key x_key, name_of_x_key x_key) in let x_pack_symbols = SyntaxTab.pack_body_env this.src_tab x_pack in - let x_def = match find_x x_pack_symbols xn with + let x_def = match find_x x_pack_symbols xn lxm with | SymbolTab.Here x_def -> x_def | SymbolTab.NotHere _ -> assert false in @@ -132,7 +133,7 @@ let x_check_interface (* if [xp] have no provided symbol table, the whole package is exported. *) | Some xp_prov_symbols -> - let x_def = match find_x xp_prov_symbols xn with + let x_def = match find_x xp_prov_symbols xn lxm with | SymbolTab.Here x -> x | SymbolTab.NotHere _ -> assert false in @@ -146,7 +147,8 @@ let x_check_interface let lookup_x_eff x_label id_of_x_key x_tab x_key lxm = match Hashtbl.find x_tab x_key with | Checked res -> res - | Checking -> raise (Recursion_error (id_of_x_key x_key, [x_label^(Lxm.details lxm)])) + | Checking -> + raise (Recursion_error (id_of_x_key x_key, [x_label^(Lxm.details lxm)])) | Incorrect -> raise (BadCheckRef_error) let (lookup_type_eff: (item_key, CompiledData.type_eff check_flag) Hashtbl.t -> @@ -164,19 +166,20 @@ let (lookup_node_eff: (** solving type and constant references *) -let solve_x_idref - x_check_interface x_check find_x x_label this symbols currpack idr lxm = +let solve_x_idref + x_check_interface x_check find_x x_label to_x_key this symbols currpack idr lxm = let s = Ident.name_of_idref idr in match Ident.pack_of_idref idr with - | Some p -> x_check_interface this (Ident.make_long p s) lxm + | Some p -> x_check_interface this (to_x_key p s) lxm | None -> (* no pack name: we look it up in the symbols table *) - try - match (find_x symbols s) with - | SymbolTab.Here _ -> - x_check this (Ident.make_long currpack s) lxm + try + match (find_x symbols s lxm) with + | SymbolTab.Here _ -> x_check this (to_x_key currpack s) lxm | SymbolTab.NotHere fid -> - x_check_interface this fid lxm + x_check_interface this + (to_x_key (Ident.pack_of_long fid) (Ident.of_long fid)) + lxm with Not_found -> raise(Compile_error(lxm,"unbounded " ^ x_label ^ " ident")) @@ -214,20 +217,23 @@ and (solve_type_idref : t -> SymbolTab.t -> Ident.pack_name -> Ident.idref -> Lx -> CompiledData.type_eff) = fun this symbols currpack idr lxm -> solve_x_idref - type_check_interface type_check SymbolTab.find_type "type" + type_check_interface type_check SymbolTab.find_type "type" + (fun p id -> Ident.make_long p id) this symbols currpack idr lxm and (solve_const_idref : t -> SymbolTab.t -> Ident.pack_name -> Ident.idref -> Lxm.t -> CompiledData.const_eff) = fun this symbols currpack idr lxm -> solve_x_idref - const_check_interface const_check SymbolTab.find_const "const" + const_check_interface const_check SymbolTab.find_const "const" + (fun p id -> Ident.make_long p id) this symbols currpack idr lxm (* now the real work! *) and (type_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> - Ident.pack_name -> SyntaxTreeCore.type_info srcflagged -> CompiledData.type_eff) = + Ident.pack_name -> SyntaxTreeCore.type_info srcflagged -> + CompiledData.type_eff) = fun this type_name lxm prov_symbols pack_name type_def -> (* We type check the interface and the body. For non-abstract types, we also check that both effective types are @@ -355,7 +361,7 @@ and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> Ident.pack_name - raise ( Recursion_error (root, ("type ref "^(Lxm.details lxm))::stack)) ) -and (const_check_do : t -> Ident.long -> Lxm.t -> SymbolTab.t -> Ident.pack_name -> +and (const_check_do : t -> Ident.long -> Lxm.t -> SymbolTab.t -> Ident.pack_name -> SyntaxTreeCore.const_info srcflagged -> CompiledData.const_eff) = fun this cn lxm symbols currpack const_def -> (* [cn] and [lxm] are used for recursion errors. @@ -366,8 +372,8 @@ and (const_check_do : t -> Ident.long -> Lxm.t -> SymbolTab.t -> Ident.pack_name let eval_env = { id2const = (solve_const_idref this symbols currpack) ; id2type = (solve_type_idref this symbols currpack) ; - } - in + } + in match const_def.it with | ExternalConst (id, texp) -> Extern_const_eff ((Ident.make_long currpack id), @@ -414,59 +420,131 @@ and (const_check_do : t -> Ident.long -> Lxm.t -> SymbolTab.t -> Ident.pack_name (******************************************************************************) -let (node_check_interface_do: t -> CompiledData.node_key -> Lxm.t -> SymbolTab.t -> - Ident.pack_name -> SyntaxTreeCore.node_info srcflagged -> - CompiledData.node_eff) = - fun this nk lxm symbols pack_name node_def -> - assert false -let (node_check_do: t -> CompiledData.node_key -> Lxm.t -> SymbolTab.t -> +let rec (node_check_interface_do: t -> CompiledData.node_key -> Lxm.t -> + SymbolTab.t -> Ident.pack_name -> SyntaxTreeCore.node_info srcflagged -> + CompiledData.node_eff) = + fun this nk lxm symbols pack_name node_def -> + let body_node_eff = node_check this nk lxm in + let prov_node_eff = node_check_do this nk lxm symbols pack_name node_def in + if prov_node_eff = body_node_eff then + prov_node_eff + else + raise(Compile_error ( + node_def.src, + ("provided node \n\t" ^ + (string_of_node_eff prov_node_eff) ^ + "\n is not compatible with its implementation \n\t" ^ + (string_of_node_eff body_node_eff)))) + + +and (node_check_do: t -> CompiledData.node_key -> Lxm.t -> SymbolTab.t -> Ident.pack_name -> SyntaxTreeCore.node_info srcflagged -> CompiledData.node_eff) = fun this nk lxm symbols pack_name node_def -> - (* - checker un noeud = - - checked les types de ses arguments + (* + - verifier les params statiques ? + - verifier que le profil du noeud est le meme que la version du body + - y'a d'la redondance dans node_info. On verifie ici la cohérence ? *) - - match node_def.it with - | Node node_info -> - - let itl = [] in - let otl = [] in - let icl = [] in - let ocl = [] in - { - nf_key = nk ; - nf_in_types = itl; - nf_out_types = otl; - nf_in_formal_clocks = icl; - nf_out_formal_clocks = ocl; - } - - | ExtNode enode_info -> - assert false - -let (node_check: t -> CompiledData.node_key -> Lxm.t -> CompiledData.node_eff) = + let id_solver = { + id2const = solve_const_idref this symbols pack_name; + id2type = solve_type_idref this symbols pack_name; + } + in + let make_node_eff itl otl = + { + nf_key = nk; + nf_in_types = itl; + nf_out_types = otl; + nf_in_formal_clocks = []; (* XXX finish me! *) + nf_out_formal_clocks = []; (* XXX finish me! *) + } + in + match node_def.it with + | Node n -> + (match n.uni_def with + | NodeAlias (None, {src=_;it= CallPreDef(node)} ) -> + assert false + | NodeAlias (None, {src=_;it=CallUsrDef(idref, static_params)} ) -> + solve_node_idref this symbols pack_name idref lxm + + | NodeAlias (Some (vi_il, vi_ol), _) + | NodeExtern(vi_il, vi_ol) -> + let aux vi = EvalType.f id_solver vi.it.va_type in + make_node_eff (List.map aux vi_il) (List.map aux vi_ol) + + | NodeBody nb -> + let aux id = + let vi = Hashtbl.find nb.nbdy_vartable id in + EvalType.f id_solver vi.it.va_type + in + make_node_eff + (List.map aux nb.nbdy_inlist) + (List.map aux nb.nbdy_outlist) + ) + | ExtNode en -> + let aux (_,texp) = EvalType.f id_solver texp in + make_node_eff + (List.map aux en.eni_inputs) + (List.map aux en.eni_outputs) + + +(** solving node references *) +and (solve_node_idref : t -> SymbolTab.t -> Ident.pack_name -> Ident.idref -> Lxm.t + -> CompiledData.node_eff) = + fun this symbols currpack idr lxm -> + solve_x_idref + node_check_interface node_check SymbolTab.find_node "node" + (fun p id -> (Ident.make_long p id,[])) (* XXX faux !!! juste pour essayer...*) + this symbols currpack idr lxm + +and (node_check: t -> CompiledData.node_key -> Lxm.t -> CompiledData.node_eff) = fun this nk -> - x_check this.nodes SymbolTab.find_node node_check_do lookup_node_eff - (fun nk -> Ident.pack_of_long (fst nk)) + x_check this.nodes SymbolTab.find_node node_check_do lookup_node_eff + (fun nk -> Ident.pack_of_long (fst nk)) (fun nk -> Ident.of_long (fst nk)) this nk -let (node_check_interface: +and (node_check_interface: t -> CompiledData.node_key -> Lxm.t -> CompiledData.node_eff) = fun this nk -> - x_check_interface this.nodes SymbolTab.find_node node_check - node_check_interface_do lookup_node_eff - (fun nk -> Ident.pack_of_long (fst nk)) + x_check_interface this.prov_nodes SymbolTab.find_node node_check + node_check_interface_do lookup_node_eff + (fun nk -> Ident.pack_of_long (fst nk)) (fun nk -> Ident.of_long (fst nk)) this nk - + (*------------------------------------------------------------------------- Test/debug ---------------------------------------------------------------------------*) +let test_item this label x_check_interface string_of_x_key string_of_x_eff + to_key id item_def = + match item_def with + | SymbolTab.Here _item_def -> + let x_eff = x_check_interface this (to_key id) Lxm.dummy in + Printf.printf "\t\t%s %s = %s\n" + label (string_of_x_key (to_key id)) (string_of_x_eff x_eff) + + | SymbolTab.NotHere item_def -> + Printf.printf "\t\t%s %s = %s (imported)\n" + label (string_of_x_key (to_key id)) (Ident.string_of_long item_def) + + +let test_types pack_name this = + test_item this "type" type_check_interface Ident.string_of_long + string_of_type_eff (fun id -> Ident.make_long pack_name id) + +let test_constants pack_name this = + test_item this "const" const_check_interface Ident.string_of_long + string_of_const_eff (fun id -> Ident.make_long pack_name id) + +let test_nodes pack_name this = + test_item this "oper" node_check_interface CompiledData.string_of_node_key + string_of_node_eff (fun id -> (Ident.make_long pack_name id, [])) + + let test (this: t) = ( (* src_tab : SyntaxTab.t; *) let testpack pack_name = ( @@ -476,31 +554,22 @@ let test (this: t) = ( | Some tab -> tab | None -> SyntaxTab.pack_body_env this.src_tab pack_name in - let test_item label x_check_interface string_of_x_eff item item_def = - match item_def with - | SymbolTab.Here _item_def -> - let x_eff = - x_check_interface this (Ident.make_long pack_name item) Lxm.dummy - in - Printf.printf "\t\t%s %s = %s\n" - label (Ident.to_string item) (string_of_x_eff x_eff) - - | SymbolTab.NotHere item_def -> - Printf.printf "\t\t%s %s = %s (imported)\n" - label (Ident.to_string item) (Ident.string_of_long item_def); - in - let test_types = test_item "type" type_check_interface string_of_type_eff in - let test_constants = test_item "const" const_check_interface string_of_const_eff in -(* let test_operators = test_item "oper" in *) Verbose.print_string "\tExported types:\n"; - SymbolTab.iter_types prov_symbols test_types ; + SymbolTab.iter_types prov_symbols (test_types pack_name this); + flush stdout; Verbose.print_string "\tExported constants:\n"; - SymbolTab.iter_consts prov_symbols test_constants; -(* Verbose.print_string "\tExported operators:\n"; *) -(* SymbolTab.iter_consts prov_symbols test_operators *) + SymbolTab.iter_consts prov_symbols (test_constants pack_name this); + flush stdout; + Verbose.print_string "\tExported nodes:\n"; + SymbolTab.iter_nodes prov_symbols (test_nodes pack_name this); + flush stdout ) in let plist = SyntaxTab.pack_list this.src_tab in Verbose.print_string "*** Dump the exported items of the packages.\n"; - List.iter testpack plist + try + List.iter testpack plist + with + Recursion_error (root, stack) -> + recursion_error Lxm.dummy stack ) diff --git a/src/lxm.ml b/src/lxm.ml index 87601693..1ea8a528 100644 --- a/src/lxm.ml +++ b/src/lxm.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 07/02/2008 (at 11:26) by Erwan Jahier> *) +(** Time-stamp: <modified the 11/02/2008 (at 17:55) by Erwan Jahier> *) (** Common to lus2lic and lic2loc *) @@ -30,12 +30,12 @@ let cend x = (x._cend) (* affichage standard: *) let details lxm = ( - Printf.sprintf "'%s' (file:%s, line:%d, col:%d to %d)" - lxm._str lxm._file lxm._line lxm._cstart lxm._cend + Printf.sprintf "in file \"%s\", line %d, col %d to %d, token '%s'" + lxm._file lxm._line lxm._cstart lxm._cend lxm._str ) let position lxm = ( - Printf.sprintf "line:%d, col:%d to %d" - lxm._line lxm._cstart lxm._cend + Printf.sprintf "line:%d, col:%d to %d" + lxm._line lxm._cstart lxm._cend ) (* constructeur de type flaggé avec un lexeme *) @@ -45,8 +45,8 @@ type 'a srcflagged = { } (* flagage d'une valeur quelconque *) let (flagit : 'a -> t -> 'a srcflagged) = -function x -> function lxm -> -{ it = x; src = lxm } + fun x lxm -> + { it = x; src = lxm } let dummy = { _str = "dummy" ; _file = "dummy" ; _line = 0 ; _cstart = 0 ; _cend = 0 } diff --git a/src/main.ml b/src/main.ml index e9f92efd..2c90a6ed 100644 --- a/src/main.ml +++ b/src/main.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 05/02/2008 (at 11:21) by Erwan Jahier> *) +(** Time-stamp: <modified the 11/02/2008 (at 09:57) by Erwan Jahier> *) (** Here follows a description of the different modules used by this lus2lic compiler. @@ -170,11 +170,11 @@ let main = ( let inchannel = open_in _lus2lic_ARGS.infile in let lexbuf = Lexing.from_channel inchannel in match _lus2lic_ARGS.runmode with - | "tlex" -> test_lex lexbuf + | "tlex" -> test_lex lexbuf | "dump" -> let nsl = get_source_list _lus2lic_ARGS.infile lexbuf in - List.iter dump_ns nsl ; - + List.iter dump_ns nsl; + | _ -> ( (* Compile.compile (pkg_load lexbuf) _lus2lic_ARGS.main_node *) let nsl = get_source_list _lus2lic_ARGS.infile lexbuf in diff --git a/src/parser.mly b/src/parser.mly index 9a3bfda3..a1d633aa 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -158,9 +158,9 @@ let treat_external_node (* fabrique le extern_node_info *) let ext_nodestr = Lxm.id ext_nodelxm in let en_info = { - ename = ext_nodestr; - inputs = flat_ins; - outputs = flat_outs + eni_name = ext_nodestr; + eni_inputs = flat_ins; + eni_outputs = flat_outs } in (* range l'info correspondante dans la table des oper *) SyntaxTree.add_info oper_table "(extern) node" ext_nodelxm (ExtNode en_info) ; @@ -256,9 +256,9 @@ let treat_node_decl } in let nstr = Lxm.id nlxm in let ninfo = { - uname = nstr; - static_args = statics; - def = nval + uni_name = nstr; + uni_static_params = statics; + uni_def = nval } in (* On met le tout dans la table des oper *) SyntaxTree.add_info oper_table "(extern) node" nlxm (Node (ninfo)) ; @@ -273,9 +273,9 @@ let treat_node_alias ( let nstr = Lxm.id nlxm in let ninfo = { - uname = nstr; - static_args = statics; - def = NodeAlias (dyn, value) + uni_name = nstr; + uni_static_params = statics; + uni_def = NodeAlias (dyn, value) } in SyntaxTree.add_info oper_table "(extern) node" nlxm (Node (ninfo)) ; def_list := (OperItem nstr) :: !def_list @@ -501,9 +501,9 @@ sxOneProvide: let invars = clocked_ids_to_var_infos VarInput $3 in let outvars = clocked_ids_to_var_infos VarOutput $5 in let xn = Node { - uname = Lxm.id $2 ; - static_args = []; - def = NodeExtern (invars, outvars); + uni_name = Lxm.id $2 ; + uni_static_params = []; + uni_def = NodeExtern (invars, outvars); } in Lxm.flagit (NodeInfo xn) diff --git a/src/symbolTab.ml b/src/symbolTab.ml index e826886c..b1a9e1f5 100644 --- a/src/symbolTab.ml +++ b/src/symbolTab.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 07/02/2008 (at 15:22) by Erwan Jahier> *) +(** Time-stamp: <modified the 11/02/2008 (at 17:44) by Erwan Jahier> *) (* Sous-module pour SyntaxTab @@ -25,29 +25,20 @@ let create () = { st_nodes = Hashtbl.create 50; } -let find_type (this: t) (id: Ident.t) = ( - try - Hashtbl.find (this.st_types) id - with Not_found -> - print_string ("*** unknown type "^(Ident.to_string id)^"\n"); - assert false -) +let find_type (this: t) (id: Ident.t) lxm = + try Hashtbl.find (this.st_types) id + with Not_found -> raise (Compile_error(lxm, "unknown type")) + -let find_const (this: t) (id: Ident.t) = ( - try - Hashtbl.find (this.st_consts) id - with Not_found -> - print_string ("*** unknown const "^(Ident.to_string id)^"\n"); - assert false -) +let find_const (this: t) (id: Ident.t) lxm = + try Hashtbl.find (this.st_consts) id + with Not_found -> raise (Compile_error(lxm, "unknown constant")) + + +let find_node (this: t) (id: Ident.t) lxm = + try Hashtbl.find (this.st_nodes) id + with Not_found -> raise (Compile_error(lxm, "unknown operator")) -let find_node (this: t) (id: Ident.t) = ( - try - Hashtbl.find (this.st_nodes) id - with Not_found -> - print_string ("*** unknown operator "^(Ident.to_string id)^"\n"); - assert false -) (* Manip de SymbolTab.t *) let add_import_const (this: t) (id: Ident.t) (aid: Ident.long) = ( diff --git a/src/symbolTab.mli b/src/symbolTab.mli index a3271ff1..2b3c739f 100644 --- a/src/symbolTab.mli +++ b/src/symbolTab.mli @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 07/02/2008 (at 15:21) by Erwan Jahier> *) +(** Time-stamp: <modified the 11/02/2008 (at 17:34) by Erwan Jahier> *) (********************************************************** Sous-module pour SyntaxTab @@ -12,6 +12,7 @@ qui sont par d (const, type et oper). ***********************************************************) +open SyntaxTreeCore type 'a hereflagged = Here of 'a (* local items *) @@ -24,9 +25,9 @@ val create : unit -> t (* Manip de SymbolTab.t *) (* Recherche d'items *) -val find_type : t -> Ident.t -> (SyntaxTreeCore.type_info Lxm.srcflagged) hereflagged -val find_const : t -> Ident.t -> (SyntaxTreeCore.const_info Lxm.srcflagged) hereflagged -val find_node : t -> Ident.t -> (SyntaxTreeCore.node_info Lxm.srcflagged) hereflagged +val find_type : t -> Ident.t -> Lxm.t -> (type_info Lxm.srcflagged) hereflagged +val find_const : t -> Ident.t -> Lxm.t -> (const_info Lxm.srcflagged) hereflagged +val find_node : t -> Ident.t -> Lxm.t -> (node_info Lxm.srcflagged) hereflagged (* Ajout de nom d'item importés (via uses) *) val add_import_const : t -> Ident.t -> Ident.long -> unit @@ -34,18 +35,18 @@ val add_import_type : t -> Ident.t -> Ident.long -> unit val add_import_node : t -> Ident.t -> Ident.long -> unit (** Add local items declaration *) -val add_type : t -> Ident.t -> SyntaxTreeCore.type_info Lxm.srcflagged -> unit -val add_const : t -> Ident.t -> SyntaxTreeCore.const_info Lxm.srcflagged -> unit -val add_node : t -> Ident.t -> SyntaxTreeCore.node_info Lxm.srcflagged -> unit +val add_type : t -> Ident.t -> type_info Lxm.srcflagged -> unit +val add_const : t -> Ident.t -> const_info Lxm.srcflagged -> unit +val add_node : t -> Ident.t -> node_info Lxm.srcflagged -> unit (* Itérer sur les items *) val iter_types : - t -> (Ident.t -> (SyntaxTreeCore.type_info Lxm.srcflagged) hereflagged -> unit) -> unit + t -> (Ident.t -> (type_info Lxm.srcflagged) hereflagged -> unit) -> unit val iter_consts : - t -> (Ident.t -> (SyntaxTreeCore.const_info Lxm.srcflagged) hereflagged -> unit) -> unit + t -> (Ident.t -> (const_info Lxm.srcflagged) hereflagged -> unit) -> unit val iter_nodes : - t -> (Ident.t -> (SyntaxTreeCore.node_info Lxm.srcflagged) hereflagged -> unit) -> unit + t -> (Ident.t -> (node_info Lxm.srcflagged) hereflagged -> unit) -> unit val dump : t -> unit diff --git a/src/syntaxTreeCore.ml b/src/syntaxTreeCore.ml index 72de1eb7..7f711ec9 100644 --- a/src/syntaxTreeCore.ml +++ b/src/syntaxTreeCore.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 07/02/2008 (at 15:30) by Erwan Jahier> *) +(** Time-stamp: <modified the 11/02/2008 (at 15:38) by Erwan Jahier> *) (** (Raw) Abstract syntax tree of source programs. *) @@ -23,36 +23,31 @@ and | Array_type_exp of (type_exp * val_exp) and node_info = - | Node of user_node_info + | Node of user_node_info | ExtNode of extern_node_info and extern_node_info = { - ename : Ident.t ; - inputs : (Ident.t option * type_exp) list ; - outputs : (Ident.t option * type_exp) list + eni_name : Ident.t; + eni_inputs : (Ident.t option * type_exp) list; + eni_outputs : (Ident.t option * type_exp) list } and user_node_info = { - uname : Ident.t ; - static_args : static_param srcflagged list ; - def : node_def + uni_name : Ident.t ; + uni_static_params : static_param srcflagged list; + uni_def : node_def } and static_param = - StaticParamType of Ident.t + | StaticParamType of Ident.t | StaticParamConst of (Ident.t * type_exp) | StaticParamNode of (Ident.t * var_info srcflagged list * var_info srcflagged list) and node_profile = (var_info srcflagged list * var_info srcflagged list) and node_def = - | NodeExtern of node_profile + | NodeExtern of node_profile (* XXX rm *) | NodeBody of node_body | NodeAlias of node_profile option * node_exp srcflagged - (**********************************************) - (* Pour une def complete, on garde : *) - (* - une table des variables avec src_info *) - (* - une liste des noms de vars pour chaque *) - (* sorte de var *) - (**********************************************) + and node_body = { nbdy_inlist : Ident.t list; nbdy_outlist : Ident.t list; @@ -80,6 +75,7 @@ and left_part = | LeftField of (left_part * (Ident.t srcflagged)) | LeftArray of (left_part * (val_exp srcflagged)) | LeftSlice of (left_part * (slice_info srcflagged)) + and slice_info = { si_first : val_exp ; si_last : val_exp ; diff --git a/src/syntaxTreeDump.ml b/src/syntaxTreeDump.ml index 212a47e7..5901d9a5 100644 --- a/src/syntaxTreeDump.ml +++ b/src/syntaxTreeDump.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 07/02/2008 (at 15:32) by Erwan Jahier> *) +(** Time-stamp: <modified the 11/02/2008 (at 09:37) by Erwan Jahier> *) open Lxm @@ -185,9 +185,9 @@ and dump_ext_node (os: Format.formatter) (x: extern_node_info srcflagged) = ( fprintf os "-- %s" (Lxm.details lxm) ; fprintf os " (external function)@\n" ; fprintf os "function %s (@,@[<b 3>%a@]@,) returns (@,@[<b 3>%a@]@,);@\n" - (Ident.to_string info.ename) - dump_param_list info.inputs - dump_param_list info.outputs + (Ident.to_string info.eni_name) + dump_param_list info.eni_inputs + dump_param_list info.eni_outputs ) and dump_param_list (os: Format.formatter) @@ -258,13 +258,13 @@ and dump_node (os: Format.formatter) (x: user_node_info srcflagged) = ( let lxm = x.src and ninfo = x.it in fprintf os "-- %s" (Lxm.details lxm) ; fprintf os " (node definition)@\n" ; - fprintf os "node %s" (Ident.to_string ninfo.uname); - if (ninfo.static_args != []) then ( + fprintf os "node %s" (Ident.to_string ninfo.uni_name); + if (ninfo.uni_static_params != []) then ( fprintf os " <<@\n" ; - fprintf os "@[<b 3>@ %a@]@\n" dump_static_param_list ninfo.static_args ; + fprintf os "@[<b 3>@ %a@]@\n" dump_static_param_list ninfo.uni_static_params ; fprintf os ">>\n" ) else () ; - match ninfo.def with + match ninfo.uni_def with NodeBody nbody -> dump_node_body os nbody | NodeAlias (_,{it = nexp; src = lxm}) -> fprintf os " = @,%a;@\n" dump_node_exp nexp diff --git a/src/test/Makefile b/src/test/Makefile index 76b6e6a2..bf852a57 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -6,16 +6,16 @@ test: echo "Non-regression tests" > test.res \ echo " " >> test.res; echo -e "$(NL)====> $(LC) newpacks.lus" >> test.res - $(LC) newpacks.lus >> test.res 2>&1 + $(LC) newpacks.lus >> test.res 2>&1 \ echo " " >> test.res; echo -e "$(NL)====> $(LC) struct0.lus" >> test.res - $(LC) struct0.lus >> test.res 2>&1 + $(LC) struct0.lus >> test.res 2>&1 \ echo " " >> test.res; echo -e "$(NL)====> $(LC) t0.lus" >> test.res - $(LC) t0.lus >> test.res 2>&1 + $(LC) t0.lus >> test.res 2>&1 || true \ echo " " >> test.res; echo -e "$(NL)====> $(LC) t2.lus" >> test.res - $(LC) t2.lus >> test.res 2>&1 + $(LC) t2.lus >> test.res 2>&1 || true \ echo " " >> test.res; echo -e "$(NL)====> $(LC) test.lus" >> test.res $(LC) test.lus >> test.res 2>&1 @@ -27,7 +27,7 @@ test: $(LC) x.lus >> test.res 2>&1 || true \ echo " " >> test.res; echo -e "$(NL)====> $(LC) consensus.lus" >> test.res - $(LC) consensus.lus 2>&1 >> test.res 2>&1 + $(LC) consensus.lus 2>&1 >> test.res 2>&1 || true \ echo " " >> test.res; echo -e "$(NL)====> $(LC) left.lus" >> test.res $(LC) left.lus >> test.res 2>&1 @@ -45,7 +45,7 @@ test: $(LC) trivial.lus >> test.res 2>&1 \ echo " " >> test.res; echo -e "$(NL)====> $(LC) t1.lus" >> test.res - $(LC) t1.lus >> test.res 2>&1 + $(LC) t1.lus >> test.res 2>&1 || true \ echo " " >> test.res; echo -e "$(NL)====> $(LC) onlyroll.lus" >> test.res $(LC) onlyroll.lus >> test.res 2>&1 diff --git a/src/test/test.res.exp b/src/test/test.res.exp index 7a021882..0e91be82 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -43,27 +43,44 @@ End of Syntax table dump. *** Dump the exported items of the packages. * package preal Exported types: - type t = real + type preal::t = real Exported constants: + Exported nodes: + oper preal::fby1 = preal::fby1(real, real) returns (real) on clock XXX + * package pbool Exported types: - type t = bool + type pbool::t = bool Exported constants: + Exported nodes: + oper pbool::fby1 = pbool::fby1(bool, bool) returns (bool) on clock XXX + * package pint Exported types: - type t = int + type pint::t = int Exported constants: + Exported nodes: + oper pint::fby1 = pint::fby1(int, int) returns (int) on clock XXX + * package mainPack Exported types: - type selType = inter::selType (imported) + type mainPack::selType = inter::selType (imported) Exported constants: - const n = inter::n (imported) + const mainPack::n = inter::n (imported) + Exported nodes: + oper mainPack::preced = mainPack::preced(inter::selType) returns (inter::selType) on clock XXX + + oper mainPack::preced = inter::preced (imported) * package inter Exported types: - type t = preal::t (imported) - type selType = inter::selType + type inter::t = preal::t (imported) + type inter::selType = inter::selType Exported constants: - const n = -4 + const inter::n = -4 + Exported nodes: + oper inter::fby1 = preal::fby1 (imported) + oper inter::preced = inter::preced( {i : int; b : bool; r : real}) returns ( {i : int; b : bool; r : real}, {i : int; b : bool; r : real}) on clock XXX + ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 struct0.lus @@ -87,8 +104,11 @@ End of Syntax table dump. *** Dump the exported items of the packages. * package dummy Exported types: - type Toto = {x : int (1); y : int (2)} + type dummy::Toto = {x : int (1); y : int (2)} Exported constants: + Exported nodes: + oper dummy::bibi = dummy::bibi(int) returns ( {x : int (1); y : int (2)}) on clock XXX + ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 t0.lus @@ -115,6 +135,9 @@ End of Syntax table dump. * package dummy Exported types: Exported constants: +*** Error in file "t0.lus", line 11, col 10 to 10, token 'n': unknown constant + + Exported nodes: ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 t2.lus @@ -142,6 +165,9 @@ End of Syntax table dump. * package dummy Exported types: Exported constants: +*** Error in file "t2.lus", line 28, col 6 to 7, token 't1': unknown type + + Exported nodes: ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 test.lus @@ -165,9 +191,10 @@ End of Syntax table dump. *** Dump the exported items of the packages. * package P1 Exported types: - type titi = P1::titi + type P1::titi = P1::titi Exported constants: - const y = 3 + const P1::y = 3 + Exported nodes: ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 trivial.lus @@ -191,15 +218,12 @@ End of Syntax table dump. * package dummy Exported types: Exported constants: + Exported nodes: + oper dummy::trivial = dummy::trivial(int) returns (int) on clock XXX + ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 x.lus -Error. 'm' (file:x.lus, line:3, col:7 to 7): ----> recursion loop detected: - > const ref 'x' (file:x.lus, line:3, col:11 to 11) - > const ref 't' (file:x.lus, line:5, col:11 to 11) - > const ref 'n' (file:x.lus, line:7, col:11 to 11) - > const ref 'm' (file:x.lus, line:1, col:11 to 11) *** SyntaxTab.create pass 1 *** SyntaxTab.create pass 2 init pack dummy @@ -223,6 +247,12 @@ End of Syntax table dump. *** Dump the exported items of the packages. * package dummy Exported types: +*** Error in file "x.lus", line 3, col 7 to 7, token 'm': recursion loop detected: + > const ref in file "x.lus", line 3, col 11 to 11, token 'x' + > const ref in file "x.lus", line 5, col 11 to 11, token 't' + > const ref in file "x.lus", line 7, col 11 to 11, token 'n' + > const ref in file "x.lus", line 1, col 11 to 11, token 'm' + Exported constants: ---------------------------------------------------------------------- @@ -250,6 +280,11 @@ End of Syntax table dump. * package dummy Exported types: Exported constants: +*** Error in file "consensus.lus", line 20, col 41 to 41, token 'n': unknown constant + + Exported nodes: + oper dummy::main = dummy::main(bool^4) returns (bool) on clock XXX + ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 left.lus @@ -273,8 +308,11 @@ End of Syntax table dump. *** Dump the exported items of the packages. * package dummy Exported types: - type truc = {a : bool^100; b : int} + type dummy::truc = {a : bool^100; b : int} Exported constants: + Exported nodes: + oper dummy::toto = dummy::toto(bool) returns ( {a : bool^100; b : int}^3) on clock XXX + ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 packs.lus @@ -329,39 +367,56 @@ End of Syntax table dump. *** Dump the exported items of the packages. * package preal Exported types: - type t = real + type preal::t = real Exported constants: + Exported nodes: + oper preal::fby1 = preal::fby1(real, real) returns (real) on clock XXX + * package pbool Exported types: - type t = bool + type pbool::t = bool Exported constants: + Exported nodes: + oper pbool::fby1 = pbool::fby1(bool, bool) returns (bool) on clock XXX + * package pint Exported types: - type t = int + type pint::t = int Exported constants: + Exported nodes: + oper pint::fby1 = pint::fby1(int, int) returns (int) on clock XXX + * package mainPack Exported types: - type selType = inter::selType (imported) - type toto = inter::toto (imported) - type T = int^8 - type couleurs = enum {mainPack::bleu, mainPack::rose, mainPack::jaune} + type mainPack::selType = inter::selType (imported) + type mainPack::toto = inter::toto (imported) + type mainPack::T = int^8 + type mainPack::couleurs = enum {mainPack::bleu, mainPack::rose, mainPack::jaune} Exported constants: - const bleu = mainPack::bleu - const n = inter::n (imported) - const jaune = mainPack::jaune - const N = 8 - const rose = mainPack::rose - const X = 8 - const Y = inter::Y (imported) + const mainPack::bleu = mainPack::bleu + const mainPack::n = inter::n (imported) + const mainPack::jaune = mainPack::jaune + const mainPack::N = 8 + const mainPack::rose = mainPack::rose + const mainPack::X = 8 + const mainPack::Y = inter::Y (imported) + Exported nodes: + oper mainPack::preced = mainPack::preced(inter::selType) returns (inter::selType) on clock XXX + + oper mainPack::preced = inter::preced (imported) * package inter Exported types: - type t = preal::t (imported) - type selType = inter::selType - type toto = enum {inter::X, inter::Y} + type inter::t = preal::t (imported) + type inter::selType = inter::selType + type inter::toto = enum {inter::X, inter::Y} Exported constants: - const n = -4 - const X = inter::X - const Y = inter::Y + const inter::n = -4 + const inter::X = inter::X + const inter::Y = inter::Y + Exported nodes: + oper inter::fby1 = preal::fby1 (imported) + oper inter::preced = inter::preced( {i : int; b : bool; r : real}) returns ( {i : int; b : bool; r : real}, {i : int; b : bool; r : real}) on clock XXX + ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 p.lus @@ -406,32 +461,47 @@ End of Syntax table dump. *** Dump the exported items of the packages. * package preal Exported types: - type t = real + type preal::t = real Exported constants: + Exported nodes: + oper preal::fby1 = preal::fby1(real, real) returns (real) on clock XXX + * package pbool Exported types: - type t = bool + type pbool::t = bool Exported constants: + Exported nodes: + oper pbool::fby1 = pbool::fby1(bool, bool) returns (bool) on clock XXX + * package pint Exported types: - type t = int + type pint::t = int Exported constants: + Exported nodes: + oper pint::fby1 = pint::fby1(int, int) returns (int) on clock XXX + * package mainPack Exported types: - type selType = inter::selType (imported) + type mainPack::selType = inter::selType (imported) Exported constants: - const n = inter::n (imported) + const mainPack::n = inter::n (imported) + Exported nodes: + oper mainPack::preced = mainPack::preced(inter::selType) returns (inter::selType) on clock XXX + + oper mainPack::preced = inter::preced (imported) * package inter Exported types: - type t = preal::t (imported) - type selType = inter::selType + type inter::t = preal::t (imported) + type inter::selType = inter::selType Exported constants: - const n = -4 + const inter::n = -4 + Exported nodes: + oper inter::fby1 = preal::fby1 (imported) + oper inter::preced = inter::preced( {i : int; b : bool; r : real}) returns ( {i : int; b : bool; r : real}, {i : int; b : bool; r : real}) on clock XXX + ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 t.lus -Error. '+' (file:t.lus, line:33, col:1 to 1): ----> can't eval constant: type combination error, int*int or real*real expected *** SyntaxTab.create pass 1 *** SyntaxTab.create pass 2 init pack dummy @@ -454,6 +524,8 @@ End of Syntax table dump. *** Dump the exported items of the packages. * package dummy Exported types: +*** Error in file "t.lus", line 33, col 1 to 1, token '+': can't eval constant: type combination error, int*int or real*real expected + Exported constants: ---------------------------------------------------------------------- @@ -478,6 +550,9 @@ End of Syntax table dump. * package dummy Exported types: Exported constants: + Exported nodes: + oper dummy::trivial = dummy::trivial(int) returns (int) on clock XXX + ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 t1.lus @@ -503,6 +578,9 @@ End of Syntax table dump. * package dummy Exported types: Exported constants: +*** Error in file "t1.lus", line 23, col 6 to 7, token 't1': unknown type + + Exported nodes: ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 onlyroll.lus @@ -578,35 +656,84 @@ End of Syntax table dump. * package dummy Exported types: Exported constants: - const NRminP = -5.100000 - const NRminR = -25.300000 - const NRmaxP = 5.100000 - const DELTA_PITCH = 3.000000 - const NRmaxR = 25.300000 - const FAIL_SAFE_PITCH_VALUE = 4.000000 - const DELTA_YAW = 2.730000 - const NRminY = -5.000000 - const HORminP = -57.000000 - const XFAIL_SAFE_ROLL_VALUE = 1.100000 - const NRmaxY = 5.000000 - const HORminR = -285.000000 - const HORmaxP = 57.000000 - const CROSS_CH_TOL_PITCH = 10.100000 - const HORmaxR = 285.000000 - const FAIL_SAFE_YAW_VALUE = 4.000000 - const HORminY = -57.000000 - const DELTA_ROLL = 14.900000 - const FAIL_SAFE_ROLL_VALUE = 1.000000 - const OneSecond = 10 - const HORmaxY = 57.000000 - const TIME_ROLL = 3 - const CROSS_CH_TOL_ROLL = 51.000000 - const BID_LAST = 2.200000 - const TIME5 = 4 - const SAFE_COUNTER_TIME = 3 - const BID_VAL = 3.300000 - const CROSS_CH_TOL_YAW = 10.000000 - const TIME_CROSS_ROLL = 3 + const dummy::NRminP = -5.100000 + const dummy::NRminR = -25.300000 + const dummy::NRmaxP = 5.100000 + const dummy::DELTA_PITCH = 3.000000 + const dummy::NRmaxR = 25.300000 + const dummy::FAIL_SAFE_PITCH_VALUE = 4.000000 + const dummy::DELTA_YAW = 2.730000 + const dummy::NRminY = -5.000000 + const dummy::HORminP = -57.000000 + const dummy::XFAIL_SAFE_ROLL_VALUE = 1.100000 + const dummy::NRmaxY = 5.000000 + const dummy::HORminR = -285.000000 + const dummy::HORmaxP = 57.000000 + const dummy::CROSS_CH_TOL_PITCH = 10.100000 + const dummy::HORmaxR = 285.000000 + const dummy::FAIL_SAFE_YAW_VALUE = 4.000000 + const dummy::HORminY = -57.000000 + const dummy::DELTA_ROLL = 14.900000 + const dummy::FAIL_SAFE_ROLL_VALUE = 1.000000 + const dummy::OneSecond = 10 + const dummy::HORmaxY = 57.000000 + const dummy::TIME_ROLL = 3 + const dummy::CROSS_CH_TOL_ROLL = 51.000000 + const dummy::BID_LAST = 2.200000 + const dummy::TIME5 = 4 + const dummy::SAFE_COUNTER_TIME = 3 + const dummy::BID_VAL = 3.300000 + const dummy::CROSS_CH_TOL_YAW = 10.000000 + const dummy::TIME_CROSS_ROLL = 3 + Exported nodes: + oper dummy::Calculate = dummy::Calculate(real, real, real, real, bool, bool, bool, bool) returns (real) on clock XXX + + oper dummy::onlyroll = dummy::onlyroll(real, real, real, real, real, real, real, real, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool) returns (real, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, int, int, int, int) on clock XXX + + oper dummy::Median = dummy::Median(real, real, real, real, bool, bool, bool, bool) returns (real) on clock XXX + + oper dummy::oneoffour = dummy::oneoffour(bool, bool, bool, bool) returns (bool) on clock XXX + + oper dummy::MedianValue3 = dummy::MedianValue3(real, real, real) returns (real) on clock XXX + + oper dummy::Monitor = dummy::Monitor(real, real, bool) returns (real, bool) on clock XXX + + oper dummy::Allocator = dummy::Allocator(bool, bool, bool, bool, bool) returns (bool, bool, bool, bool) on clock XXX + + oper dummy::Channel = dummy::Channel(bool, bool, bool, real, real, bool, real, real, real, bool, bool, bool, bool) returns (real, bool, bool, bool, bool, int) on clock XXX + + oper dummy::min2 = dummy::min2(real, real) returns (real) on clock XXX + + oper dummy::max2 = dummy::max2(real, real) returns (real) on clock XXX + + oper dummy::min4 = dummy::min4(real, real, real, real) returns (real) on clock XXX + + oper dummy::OlympicAverage = dummy::OlympicAverage(real, real, real, real) returns (real) on clock XXX + + oper dummy::max4 = dummy::max4(real, real, real, real) returns (real) on clock XXX + + oper dummy::InHardoverRange = dummy::InHardoverRange(real) returns (bool) on clock XXX + + oper dummy::noneof = dummy::noneof(bool, bool, bool, bool) returns (bool) on clock XXX + + oper dummy::twooffour = dummy::twooffour(bool, bool, bool, bool) returns (bool) on clock XXX + + oper dummy::threeoffour = dummy::threeoffour(bool, bool, bool, bool) returns (bool) on clock XXX + + oper dummy::InNominalRange = dummy::InNominalRange(real) returns (bool) on clock XXX + + oper dummy::FailDetect = dummy::FailDetect(bool, real, bool, bool, bool, real, real, real, bool, bool, bool, bool) returns (bool, bool, int, bool) on clock XXX + + oper dummy::abs = dummy::abs(real) returns (real) on clock XXX + + oper dummy::Average2 = dummy::Average2(real, real) returns (real) on clock XXX + + oper dummy::Average = dummy::Average(real, real, real, real, bool, bool, bool, bool) returns (real) on clock XXX + + oper dummy::values_nok = dummy::values_nok(bool, bool, bool, real, real, real, real) returns (bool) on clock XXX + + oper dummy::maintain = dummy::maintain(int, bool) returns (bool) on clock XXX + ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 heater_control.lus @@ -644,12 +771,35 @@ End of Syntax table dump. * package dummy Exported types: Exported constants: - const FAILURE = -999.000000 - const TMIN = 6.000000 - const TMAX = 9.000000 - const DELTA = 0.500000 + const dummy::FAILURE = -999.000000 + const dummy::TMIN = 6.000000 + const dummy::TMAX = 9.000000 + const dummy::DELTA = 0.500000 + Exported nodes: + oper dummy::not_a_sauna2 = dummy::not_a_sauna2(real, real, real, real, bool) returns (bool) on clock XXX + + oper dummy::Median = dummy::Median(real, real, real) returns (real) on clock XXX + + oper dummy::heater_control = dummy::heater_control(real, real, real, real) returns (bool) on clock XXX + + oper dummy::min2 = dummy::min2(real, real) returns (real) on clock XXX + + oper dummy::max2 = dummy::max2(real, real) returns (real) on clock XXX + + oper dummy::not_a_sauna = dummy::not_a_sauna(real, real, real, real, bool) returns (bool) on clock XXX + + oper dummy::alloftree = dummy::alloftree(bool, bool, bool) returns (bool) on clock XXX + + oper dummy::abs = dummy::abs(real) returns (real) on clock XXX + + oper dummy::noneoftree = dummy::noneoftree(bool, bool, bool) returns (bool) on clock XXX + + oper dummy::Average = dummy::Average(real, real) returns (real) on clock XXX + + oper dummy::oneoftree = dummy::oneoftree(bool, bool, bool) returns (bool) on clock XXX + ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 pfs.lus -Error. '[' (file:pfs.lus, line:43, col:22 to 22): ----> syntax error +*** Error in file "pfs.lus", line 43, col 22 to 22, token '[': syntax error + diff --git a/src/version.ml b/src/version.ml index 4b88ff80..716a6ce2 100644 --- a/src/version.ml +++ b/src/version.ml @@ -1,6 +1,6 @@ (* Automatically generated from src/Makefile *) let tool = "lus2lic" let branch = "u0" -let commit = "21" -let sha_1 = "1a14b11128a12fe7aa82d464aa4f14ab8dba1e45" +let commit = "24" +let sha_1 = "9adeaeab6d4be0b10e2fe1d252f77bf2e191c59a" let str = (branch ^ "." ^ commit) -- GitLab