diff --git a/src/TODO b/src/TODO index 25575d04c8af4544bde050bbf9dec5d4077f4728..4e29101341613ed1ba1753452add4d3bbb7a57c5 100644 --- a/src/TODO +++ b/src/TODO @@ -180,7 +180,9 @@ tel * evalEq.translate_left_part : faire plus de verification sur les index de slice -* parser.mly : rajouter les pragma ! +* parser.mly : rajouter les pragma ! + ex : %ASSUME:assumeSelectElementOfRank_inArray_% + -> 3 shift/reduce conflicts ! * patcher le mode emacs - rajouter modele, package, etc. diff --git a/src/parser.mly b/src/parser.mly index 7f6bee08c11ed03e27748353969fd56fd4dd1904..69ef0dc8828e160ffd196338cdfa3b73edc9b9a1 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -191,11 +191,12 @@ let (treat_node_decl : bool -> Lxm.t -> static_param srcflagged list -> clocked_ids list (* entrées *) -> clocked_ids list (* sorties *) -> clocked_ids list (* locales *) -> + pragma list -> (val_exp srcflagged) list (* assserts *) -> (eq_info srcflagged) list (* liste des equations *) -> unit ) = - fun has_memory nlxm statics indefs outdefs locdefs asserts eqs -> + fun has_memory nlxm statics indefs outdefs locdefs _pragma asserts eqs -> let vtable = Hashtbl.create 50 in let rec (treat_vars : clocked_ids list -> var_nature -> var_info srcflagged list) = (* Procedure de traitement des in, out ou loc, paramétrée par la [var_nature] *) @@ -817,11 +818,11 @@ sxNodeDecl: sxLocalNode: TK_NODE sxIdent sxStaticParams sxParams TK_RETURNS sxParams sxOptSemicol - sxLocals sxBody sxOptEndNode - { treat_node_decl true $2 $3 $4 $6 $8 (fst $9) (snd $9) } + sxPragma sxLocals sxBody sxOptEndNode + { treat_node_decl true $2 $3 $4 $6 $9 $8 (fst $10) (snd $10) } | TK_FUNCTION sxIdent sxStaticParams sxParams TK_RETURNS sxParams sxOptSemicol - sxLocals sxBody sxOptEndNode - { treat_node_decl false $2 $3 $4 $6 $8 (fst $9) (snd $9) } + sxPragma sxLocals sxBody sxOptEndNode + { treat_node_decl false $2 $3 $4 $6 $9 $8 (fst $10) (snd $10) } | TK_NODE sxIdent sxStaticParams sxNodeProfileOpt TK_EQ sxEffectiveNode sxOptSemicol { treat_node_alias true $2 $3 $4 $6 } @@ -969,6 +970,8 @@ sxBody: sxEquationList: sxEquation { $1 } + | sxPragma sxEquation + { $2 } | sxEquationList sxEquation { ( (fst $2) @ (fst $1) , (snd $2) @ (snd $1) ) @@ -1330,3 +1333,8 @@ sxOptSemicol : {} ; +sxPragma: /* e.g., %ASSUME:toto% */ + { [] } +| TK_PCENT sxIdent TK_COLON sxIdent TK_PCENT sxPragma + { (Pragma(Lxm.str $2, Lxm.str $4))::$6 } + diff --git a/src/syntaxTreeCore.ml b/src/syntaxTreeCore.ml index 75a6940d6bb8b4cb976b048e9ddfd1235d361cc4..438370227080e0e011bf0c60ab3fa30773c5ad17 100644 --- a/src/syntaxTreeCore.ml +++ b/src/syntaxTreeCore.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 27/05/2008 (at 09:42) by Erwan Jahier> *) +(** Time-stamp: <modified the 28/05/2008 (at 16:33) by Erwan Jahier> *) (** (Raw) Abstract syntax tree of source programs. *) @@ -190,3 +190,4 @@ type item_info = | TypeInfo of type_info | NodeInfo of node_info +type pragma = Pragma of string * string diff --git a/src/test/should_work/packEnvTest/contractForElementSelectionInArray/main.lus b/src/test/should_work/packEnvTest/contractForElementSelectionInArray/main.lus index 7f12a4d48d6750cd8bdafc066826441cec041b49..4be4a0f03867eff35c6421b42f5befd0e99896a1 100644 --- a/src/test/should_work/packEnvTest/contractForElementSelectionInArray/main.lus +++ b/src/test/should_work/packEnvTest/contractForElementSelectionInArray/main.lus @@ -1,9 +1,10 @@ + + --package intArray is packageTableau(int, 10, equals, gt); --package intArray is packageTableau(int, 10, Lustre::eq, Lustre::igt); -package intArray is packageTableau(int, 10, =, >); --package intArray is packageTableau(int, 10, =, Lustre::igt); ---package Lustre is packageTableau(int, 10, =, >); +package intArray is packageTableau(int, 10, =, >); package main uses intArray;--, intArray2, intArray3; diff --git a/src/test/should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus b/src/test/should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus index 8d1c865aaa6bcc62b351dea7cecb5aa1b5f00e5f..0a7ff5dd21b81c2fd19b866df181ffe020c408c6 100644 --- a/src/test/should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus +++ b/src/test/should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus @@ -275,14 +275,14 @@ let accu_out_min = red<<minFromRank, size>>(Sort_accu{MinVal = 0; MinRank = accu_in.CurrentRank; RankFrom = accu_in.CurrentRank; - Rank = 0}; + Rank = 0}, accu_in.Tab); -- ensuite, je trouve la valeur du rang courant (rang où j'en suis -- de l'itération de UnarySort accu_out_select = red<<select, size>>(Select_accu{RankToFind = accu_in.CurrentRank; CurrentRank = 0; - Val = 0}; + Val = 0}, accu_in.Tab); -- puis j'échange le minimum trouvé et l'élement de rang courant @@ -293,7 +293,7 @@ let CurrentVal = accu_out_select.Val; Rank = 0}, accu_in.Tab); - accu_out = Sort_accu{CurrentRank = accu_in.CurrentRank + 1, + accu_out = Sort_accu{CurrentRank = accu_in.CurrentRank + 1; Tab = localTab}; tel diff --git a/src/test/test.res.exp b/src/test/test.res.exp index 22bab6dbccf3f635aac4c806641f1409317caf1e..53a5c09c56dc00d0252ccf506e7c2859e946a026 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -6448,7 +6448,7 @@ tel ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/demo/Gyroscope2.lus Opening file should_work/demo/Gyroscope2.lus -*** Error in file "should_work/demo/Gyroscope2.lus", line 106, col 1 to 1, token '%': syntax error +*** Error in file "should_work/demo/Gyroscope2.lus", line 107, col 27 to 27, token ';': syntax error ---------------------------------------------------------------------- @@ -9930,7 +9930,7 @@ tel ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/lionel/Gyroscope.lus Opening file should_work/lionel/Gyroscope.lus -*** Error in file "should_work/lionel/Gyroscope.lus", line 48, col 1 to 1, token '%': syntax error +*** Error in file "should_work/lionel/Gyroscope.lus", line 49, col 25 to 25, token ';': syntax error ---------------------------------------------------------------------- @@ -12243,7 +12243,7 @@ Opening file should_work/packEnvTest/contractForElementSelectionInArray/main.lus init pack main export node main init pack intArray -*** Error in file "should_work/packEnvTest/contractForElementSelectionInArray/main.lus", line 3, col 9 to 16, token 'intArray': bad pack instance: model packageTableau undeclared +*** Error in file "should_work/packEnvTest/contractForElementSelectionInArray/main.lus", line 7, col 9 to 16, token 'intArray': bad pack instance: model packageTableau undeclared ---------------------------------------------------------------------- @@ -12285,8 +12285,19 @@ tel ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus Opening file should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus -*** Error in file "should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus", line 96, col 1 to 1, token '%': syntax error - +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 +*** SyntaxTab.create pass 3 +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + packageTableau (model) + + - Raw model table: packageTableau + - Raw Package table: + - Package manager table: +End of Syntax table dump. » +Error. No package has been provided ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/packEnvTest/contractForElementSelectionInArray/tri.lus