diff --git a/src/evalNode.ml b/src/evalNode.ml index 08976eb055cb56213647eafe480e30c5c567c450..6c4a1fc6add3a9b6901902a98999e3751660b6ae 100644 --- a/src/evalNode.ml +++ b/src/evalNode.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 20/02/2008 (at 16:06) by Erwan Jahier> *) +(** Time-stamp: <modified the 06/03/2008 (at 15:15) by Erwan Jahier> *) open SyntaxTree @@ -7,9 +7,7 @@ open CompiledData let rec (f : CompiledData.id_solver -> SyntaxTreeCore.node_exp -> CompiledData.node_eff) = - fun id_solver ne -> - match ne with - | CallPreDef predef_node -> PredefEff predef_node - | CallUsrDef (idref, static_args) -> assert false + fun id_solver (idref, static_args) -> + assert false diff --git a/src/expandPack.ml b/src/expandPack.ml index 00f12c546fd03d72b9a2127d8d7647c7d0a9c541..79048e0de86992e6169a592c492b202a722a8f70 100644 --- a/src/expandPack.ml +++ b/src/expandPack.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 15/02/2008 (at 10:36) by Erwan Jahier> *) +(** Time-stamp: <modified the 06/03/2008 (at 15:15) by Erwan Jahier> *) open Lxm open SyntaxTree @@ -84,10 +84,9 @@ let (doit: | StaticParamNode (s,inl,outl,has_memory) -> ( let ne = match (a.it) with StaticArgIdent idr -> ( - Lxm.flagit (CallUsrDef (idr,[])) a.src + Lxm.flagit ((idr,[])) a.src ) - | - StaticArgNode x -> Lxm.flagit x a.src + | StaticArgNode x -> Lxm.flagit x a.src | _ -> instance_error () in let ni = Node { diff --git a/src/lazyCompiler.ml b/src/lazyCompiler.ml index 8c25f2d13f21031f5eec33d3a17c3618df740529..c3cd9d5dc0cfe5c4ee9ccbaa2fa80413e7988e9d 100644 --- a/src/lazyCompiler.ml +++ b/src/lazyCompiler.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 06/03/2008 (at 10:05) by Erwan Jahier> *) +(** Time-stamp: <modified the 06/03/2008 (at 15:17) by Erwan Jahier> *) open Lxm @@ -530,20 +530,8 @@ and (node_check_do: t -> CompiledData.node_key -> Lxm.t -> SymbolTab.t -> match node_def.it with | Node n -> (match n.uni_def with - | NodeAlias (profile_opt, {src=_;it= CallPreDef(ITERATOR_n(_,_,_))}) -> - finish_me "node alias with predef operator"; - assert false - - | NodeAlias (_, {src=_;it= CallPreDef(node)}) -> - assert false - (* - The only predef node that have static arg are array iterators. - - Raise a msg or is it catched before ? - *) - | NodeAlias ( - profile_opt, { src = lxm; it = CallUsrDef(idref, static_args) } - ) -> + | NodeAlias (profile_opt, { src = lxm; it = (idref, static_args) }) + -> let static_params = get_static_params_from_idref lxm idref in let static_eff = assert(List.length static_params = List.length static_args); diff --git a/src/parser.mly b/src/parser.mly index c4a38d56950a9b56f6473922a9adee5be39b239e..dd1db24c98cf156fb20cab7bb552d5df740538f7 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -1140,8 +1140,6 @@ sxPredefOp: | TK_FBY { {src=$1; it=FBY_n} } | TK_PRE { {src=$1; it=PRE_n} } | TK_CURRENT{ {src=$1; it=CURRENT_n} } - | TK_INT { {src=$1; it=REAL2INT_n} } - | TK_REAL { {src=$1; it=INT2REAL_n} } | TK_ARROW { {src=$1; it=ARROW_n} } | TK_WHEN { {src=$1; it=WHEN_n} } | TK_AND { {src=$1; it=AND_n } } @@ -1180,14 +1178,17 @@ sxCallByPosExpression: sxEffectiveNode: /* Juste un nom */ sxIdentRef - { {src=$1.src; it=(CallUsrDef ($1.it, [])) } } + { {src=$1.src; it=(($1.it, [])) } } /* Un nom + des params statiques */ | sxIdentRef TK_OPEN_STATIC_PAR sxStaticArgList TK_CLOSE_STATIC_PAR - { {src=$1.src; it=(CallUsrDef ($1.it, List.rev $3)) } } - /* Un operateur prédéfini */ + { {src=$1.src; it=(($1.it, List.rev $3)) } } + /* Un operateur prédéfini | TK_OPERATOR sxPredefOp - { {src=$1; it=CallPreDef $2.it } } + { {src=$; it=($2.it, []) } } ; +XXX pour l'instant, j'enleve la possibilité d'avoir +(operator +(1,2)). On verra ca plus tard +*/ sxStaticArgList: sxStaticArg @@ -1239,9 +1240,12 @@ sxStaticArgList: sxSurelyNode: | sxIdentRef TK_OPEN_STATIC_PAR sxStaticArgList TK_CLOSE_STATIC_PAR - { {src=$1.src; it=(CallUsrDef ($1.it, List.rev $3)) } } - | TK_OPERATOR sxPredefOp - { {src=$2.src; it= (CallPreDef $2.it)} } + { {src=$1.src; it=($1.it, List.rev $3) } } +/* | TK_OPERATOR sxPredefOp + { {src=$2.src; it= ( $2.it)} } +XXX pour l'instant, j'enleve la possibilité d'avoir +(operator +(1,2)). On verra ca plus tard +*/ ; sxSurelyType: diff --git a/src/syntaxTreeCore.ml b/src/syntaxTreeCore.ml index 982e9f5f190915fa3fd85b2b9ba1f58beaa323f2..4d06e7f65e984542930c9f13e1f5f0f44d13a2df 100644 --- a/src/syntaxTreeCore.ml +++ b/src/syntaxTreeCore.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 06/03/2008 (at 14:56) by Erwan Jahier> *) +(** Time-stamp: <modified the 06/03/2008 (at 16:10) by Erwan Jahier> *) (** (Raw) Abstract syntax tree of source programs. *) @@ -180,8 +180,7 @@ and by_name_op = (* for backward compatibility with lv4 *) and node_exp = - | CallPreDef of predef_node - | CallUsrDef of (Ident.idref * static_arg srcflagged list) + (Ident.idref * (static_arg srcflagged list)) (* Params statiques effectifs : - val_exp (pour les constantes) diff --git a/src/syntaxTreeDump.ml b/src/syntaxTreeDump.ml index 82570b2a009ce67994c24fce748cc52df073718e..fa79ba542be39bd30c4217d0f13d64365bae7378 100644 --- a/src/syntaxTreeDump.ml +++ b/src/syntaxTreeDump.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 06/03/2008 (at 14:42) by Erwan Jahier> *) +(** Time-stamp: <modified the 06/03/2008 (at 15:14) by Erwan Jahier> *) open Lxm @@ -543,20 +543,14 @@ and dump_nary_exp and dump_node_exp (os : Format.formatter) - (n: node_exp) - = ( - match n with - CallPreDef op -> ( - fprintf os "operator %s" (op2string op) - ) | - (CallUsrDef (id, sal)) -> ( - fprintf os "%s" (Ident.string_of_idref id) ; - ( match sal with - [] -> () - | lst -> (fprintf os "<< @,%a@, >>" dump_static_arg_list lst) - ) - ) - ) + ((id, sal): node_exp) + = + fprintf os "%s" (Ident.string_of_idref id) ; + ( match sal with + [] -> () + | lst -> (fprintf os "<< @,%a@, >>" dump_static_arg_list lst) + ) + and dump_static_arg_list (os : Format.formatter) (lst: static_arg srcflagged list) diff --git a/src/test/should_work/Pascal/t.lus b/src/test/should_work/Pascal/t.lus index f69e73d9ee0116f20cad7f98cae541b5f420f28e..40060ade49daffe339c302ca9b19878691799434 100644 --- a/src/test/should_work/Pascal/t.lus +++ b/src/test/should_work/Pascal/t.lus @@ -8,8 +8,8 @@ node toto ( x : bool) returns ( ); let a = A; - --b = B + A[0]; - b = operator +(B,A[0]); + b = B + A[0]; + --b = operator +(B,A[0]); tel node map2 diff --git a/src/test/should_work/Pascal/t1.lus b/src/test/should_work/Pascal/t1.lus index 2d308b21ffe490a2e5d6f2d303055afb9156737b..9a1fa0e74eb842e644ac0a9ae374d570e27e2593 100644 --- a/src/test/should_work/Pascal/t1.lus +++ b/src/test/should_work/Pascal/t1.lus @@ -33,7 +33,7 @@ tel node bt_void<<const n: int>>(t : bool^n) returns (x : bool); let - x = fold<<operator or>>(false, t); + x = fold<<Lustre::or>>(false, t); tel (* devrait marcher ? *) diff --git a/src/test/should_work/Pascal/t2.lus b/src/test/should_work/Pascal/t2.lus index 246ea20fa35ba7b37dc8ef95c8603510e9bc0410..3920f79e11ba2337198cd18b2de5548e92ee876a 100644 --- a/src/test/should_work/Pascal/t2.lus +++ b/src/test/should_work/Pascal/t2.lus @@ -39,16 +39,16 @@ tel -- Alors : node consensus_6(X : bool^6) returns (c : bool); let - c = fold_left << bool,bool,6, operator and >>(true, X); + c = fold_left << bool,bool,6, Lustre::and >>(true, X); tel -- Voire même : -node consensus_6_bis = fold_left << bool,bool,6, operator and >> ; +node consensus_6_bis = fold_left << bool,bool,6, Lustre::and >> ; -- Ou encore : node consensus_bis << const n : int >> = - fold_left << bool,bool,n, operator and >> ; + fold_left << bool,bool,n, Lustre::and >> ; diff --git a/src/test/test.res.exp b/src/test/test.res.exp index 0fd4cd27ebab4879d1bd892809306a37a948a01d..faa9c98e9f94e119a4a2bd8d577eeb7f4ba267f7 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -761,12 +761,9 @@ End of Syntax table dump. Exported constants: Exported nodes: ### skipping fold_left - node dummy::consensus_6_bis = dummy::fold_left<<type bool, type bool, const 6, operator and>>(bool, bool^6) returns (bool) on clock XXX - node dummy::consensus_6 = dummy::consensus_6(bool^6) returns (bool) on clock XXX - - ### skipping consensus_bis - ### skipping consensus +*** oops: an internal error occurred in file syntaxTab.ml, line 104, column 22 +*** when compiling lustre program should_work/Pascal/t2.lus *** SyntaxTab.create pass 1 *** SyntaxTab.create pass 2 init pack dummy