From 6c4ed7fe978503685f15645d7b95433c73c05386 Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Tue, 27 May 2008 17:25:32 +0200 Subject: [PATCH] Extend the parser to recognize lustre operators (e.g., "+") in static args. --- src/TODO | 5 + src/parser.mly | 16 +- src/parserUtils.ml | 27 +- src/predef.ml | 2 +- src/test/test.res.exp | 640 +++++++++++++++++++++++++++++++++++++++--- 5 files changed, 639 insertions(+), 51 deletions(-) diff --git a/src/TODO b/src/TODO index 5f7e5c5c..3e1f33d4 100644 --- a/src/TODO +++ b/src/TODO @@ -107,6 +107,10 @@ lazycompiler.ml: * essayer de faire qque chose pour les 2 verrues dans predefSemantics +* maintenant que je peux definir des trucs du genre + x = map<<+;3>> + ai-je encore besoin de Lustre::plus et consort ??? + *********************************************************************************** *********************************************************************************** *********************************************************************************** @@ -115,6 +119,7 @@ lazycompiler.ml: *** facile +* ../lus2lic -n consensus_6 should_work/Pascal/t2.lus * Verifier que les test de map_red couvre les cas tordus. diff --git a/src/parser.mly b/src/parser.mly index d086fd3e..56dad0e1 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -1176,6 +1176,8 @@ sxStaticArgList: { {src=$1 ; it=StaticArgNode (call_or_predef $2) } } | TK_FUNCTION sxEffectiveNode { {src=$1 ; it=StaticArgNode (call_or_predef $2) } } + | sxPredefOp + { {src=$1.src; it=StaticArgNode $1.it } } /* un ident OU une expression simple (à résoudre) */ /* c'est au retour qu'on choisit */ | sxSimpleExp @@ -1183,10 +1185,13 @@ sxStaticArgList: match $1 with | CallByPos (op, x) -> ( match op.it with - | IDENT_n idref -> {src=op.src ; it = StaticArgIdent idref } - | _ -> {src=op.src ; it=StaticArgConst $1} + | IDENT_n idref -> + (match is_a_predef idref [] with + | None -> {src=op.src ; it = StaticArgIdent idref } + | Some predef -> {src=op.src; it= StaticArgNode predef}) + | _ -> {src=op.src ; it= StaticArgConst $1} ) - | _ -> + | CallByName _ -> print_string "*** unexpected static argument\n"; assert false } @@ -1201,11 +1206,6 @@ sxStaticArgList: sxSurelyNode: | sxIdentRef TK_OPEN_STATIC_PAR sxStaticArgList TK_CLOSE_STATIC_PAR { {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/parserUtils.ml b/src/parserUtils.ml index 39c2b4fc..7a03fded 100644 --- a/src/parserUtils.ml +++ b/src/parserUtils.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 16/05/2008 (at 15:10) by Erwan Jahier> *) +(** Time-stamp: <modified the 27/05/2008 (at 16:54) by Erwan Jahier> *) @@ -141,14 +141,25 @@ let bynameexp lxm op nelst = CallByName( {src = lxm ; it = op } , nelst ) open Ident + +(* used in the parser to recognize if an idref is a predefined operator *) +let (is_a_predef : Ident.idref -> static_arg Lxm.srcflagged list -> by_pos_op option) = + fun idref sargs -> + match idref.id_pack with + | None (* We consider that the Lustre package is «use»d by default *) + | Some "Lustre" -> ( + try Some (Predef (Predef.string_to_op idref.id_id, sargs)) + with Not_found -> None + ) + | Some _ -> None + (* used in the parser to recognize if a node is a predefined operator *) let (call_or_predef : node_exp Lxm.srcflagged -> by_pos_op) = fun nef -> let {it=(idref, sargs); src=lxm } = nef in - match idref.id_pack with - | None (* We consider that the Lustre package is «use»d by default *) - | Some "Lustre" -> ( - try Predef (Predef.string_to_op idref.id_id, sargs) - with Not_found -> CALL_n nef - ) - | Some _ -> CALL_n nef + match is_a_predef idref sargs with + | None -> CALL_n nef + | Some op -> op + + + diff --git a/src/predef.ml b/src/predef.ml index 8e5a6c62..60425170 100644 --- a/src/predef.ml +++ b/src/predef.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 26/05/2008 (at 15:09) by Erwan Jahier> *) +(** Time-stamp: <modified the 27/05/2008 (at 17:05) by Erwan Jahier> *) diff --git a/src/test/test.res.exp b/src/test/test.res.exp index 73eaf964..42dd7376 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -6027,11 +6027,8 @@ End of Syntax table dump. Exported types: Exported constants: Exported nodes: -*** Could not find package Lustre in the package table -*** Raised in file "should_work/Pascal/t2.lus", line 47, col 51 to 61, token 'Lustre::and' +*** Error in file "should_work/Pascal/t2.lus", line 34, col 5 to 9, token 'treat': unknown node (treat) -*** oops: an internal error occurred in file syntaxTab.ml, line 114, column 6 -*** when compiling lustre program should_work/Pascal/t2.lus ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/Pascal/test.lus @@ -6204,8 +6201,40 @@ tel ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/call/call03.lus Opening file should_work/call/call03.lus -*** Error in file "should_work/call/call03.lus", line 2, col 18 to 19, token 'or': syntax error - +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack call03 + export node tutu + export node call03 + export node momo +*** SyntaxTab.create pass 3 + init symbol tables for pack call03 +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + call03 (pack) + + - Raw model table: + - Raw Package table: call03 + - Package manager table: call03 +End of Syntax table dump. » +-- MAIN NODE: "call03__call03" +*** Dump the exported items of the packages. + * package call03 + Exported types: + Exported constants: + Exported nodes: +function call03__tutu(i1:bool^2; i2:bool^2) returns (o:bool^2); +let + o = Lustre__map<<node Lustre__or, const 2>>(i1, i2); +tel +-- end of node call03__tutu +node call03__call03(x:bool^2; y:bool^2) returns (z:bool^2); +let + z = call03__tutu(x, y); +tel +-- end of node call03__call03 +extern function call03__momo(x:bool; y:bool) returns (z:bool); ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/call/call04.lus @@ -6388,11 +6417,41 @@ End of Syntax table dump. Exported constants: const alias__SIZE = 3; Exported nodes: -*** Could not find package Lustre in the package table -*** Raised in file "should_work/demo/alias.lus", line 45, col 25 to 37, token 'Lustre::iplus' - -*** oops: an internal error occurred in file syntaxTab.ml, line 114, column 6 -*** when compiling lustre program should_work/demo/alias.lus +function alias__aliasIterOp(i1:int; i2:int^3) returns (o:int); +let + o = Lustre__red<<node Lustre__+, const 3>>(i1, i2); +tel +-- end of node alias__aliasIterOp +function alias__aliasBoolRed(i:bool^2) returns (o:bool); +let + o = Lustre__boolred<<const 0, const 1, const 2>>(i); +tel +-- end of node alias__aliasBoolRed +node alias__unNoeud(a:int; b:int^3) returns (c:int); +var + x:bool; +let + c = alias__aliasIterOp(a, b); + x = alias__aliasBoolRed([true, false]); +tel +-- end of node alias__unNoeud +node alias__aliasGivenNode(a:int; b:int^3) returns (c:int); +let + c = alias__unNoeud(a, b); +tel +-- end of node alias__aliasGivenNode +function alias__aliasPredefNot(i:bool) returns (o:bool); +let + o = Lustre__not(i); +tel +-- end of node alias__aliasPredefNot +node alias__alias(a:bool) returns (b:bool; c:int); +let + b = alias__aliasPredefNot(a); + c = alias__aliasGivenNode(0, map<<node Lustre__+, const 3>>(int^3, + int^3)); +tel +-- end of node alias__alias ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/demo/bred.lus @@ -7113,8 +7172,54 @@ tel ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/demo/mapdeRed.lus Opening file should_work/demo/mapdeRed.lus -*** Error in file "should_work/demo/mapdeRed.lus", line 12, col 17 to 17, token '+': syntax error +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack mapdeRed + export const m + export const n + export const p + export node incr + export node mapdeRed +*** SyntaxTab.create pass 3 + init symbol tables for pack mapdeRed +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + mapdeRed (pack) + + - Raw model table: + - Raw Package table: mapdeRed + - Package manager table: mapdeRed +End of Syntax table dump. » +-- MAIN NODE: "mapdeRed__mapdeRed" +*** Dump the exported items of the packages. + * package mapdeRed + Exported types: + Exported constants: +const mapdeRed__m = 3; +const mapdeRed__n = 2; +const mapdeRed__p = 5; + Exported nodes: +node mapdeRed__incr(i:int) returns (accu:int; s:int); +let + accu = (i + 1); + s = i; +tel +-- end of node mapdeRed__incr +node mapdeRed__mapdeRed( + init:int^2; + init2:int) +returns ( + r:int^2; + T:int^2^3; + bid:int); +let + (bid, T) = fill<<node Lustre__fill<<node mapdeRed__incr, const 2>>, const + 3>>(init2); + r = red<<node Lustre__map<<node Lustre__+, const 2>>, const 3>>(init, T); +tel +-- end of node mapdeRed__mapdeRed ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/demo/mapiter.lus @@ -7216,11 +7321,22 @@ type mappredef__tab_int = int^3; type mappredef__tab_bool = bool^3; Exported constants: Exported nodes: -*** Could not find package Lustre in the package table -*** Raised in file "should_work/demo/mappredef.lus", line 10, col 12 to 21, token 'Lustre::if' -*** oops: an internal error occurred in file syntaxTab.ml, line 114, column 6 -*** when compiling lustre program should_work/demo/mappredef.lus +node mappredef__mappredef( + x:bool^3; + a:int^3; + b:int^3) +returns ( + c:int^3; + d:int^3); +var + z:int; +let + z = if (x[0]) then (a[0]) else (b[0]); + c = map<<node Lustre__if, const 3>>(x, a, b); + d = map<<node Lustre__-, const 3>>(b); +tel +-- end of node mappredef__mappredef ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/demo/plus.lus @@ -7318,8 +7434,38 @@ tel ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/demo/redoptest.lus Opening file should_work/demo/redoptest.lus -*** Error in file "should_work/demo/redoptest.lus", line 8, col 17 to 17, token '+': syntax error - +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack redoptest + export node max + export node redoptest +*** SyntaxTab.create pass 3 + init symbol tables for pack redoptest +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + redoptest (pack) + + - Raw model table: + - Raw Package table: redoptest + - Package manager table: redoptest +End of Syntax table dump. » +-- MAIN NODE: "redoptest__redoptest" +*** Dump the exported items of the packages. + * package redoptest + Exported types: + Exported constants: + Exported nodes: +node redoptest__max(init:int; a:int) returns (b:int); +let + b = if ((init > a)) then (init) else (a); +tel +-- end of node redoptest__max +node redoptest__redoptest(a:int^5^3) returns (b:int); +let + b = red<<node Lustre__red<<node Lustre__+, const 5>>, const 3>>(0, a); +tel +-- end of node redoptest__redoptest ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/demo/sample_time_change.lus @@ -7577,11 +7723,6 @@ let elt_out = (elt_in + 1); tel -- end of node iter__mapped -node iter__plus(accu_in:int; elt_in:int) returns (accu_out:int); -let - accu_out = (accu_in + elt_in); -tel --- end of node iter__plus node iter__garcia( accu_in:int; @@ -7608,11 +7749,16 @@ var let (bidon, T_inter) = fill<<node iter__filled, const 5>>(init); Tab_out = map<<node iter__mapped, const 5>>(T_inter); - Red_plus = red<<node iter__plus, const 5>>(-(100), Tab_out); + Red_plus = red<<node Lustre__+, const 5>>(-(100), Tab_out); (zorroAcc, zorroTab) = fillred<<node iter__garcia, const 5>>(0, [0, 0, 0, 0, 0]); tel -- end of node iter__iter +node iter__plus(accu_in:int; elt_in:int) returns (accu_out:int); +let + accu_out = (accu_in + elt_in); +tel +-- end of node iter__plus ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/fab_test/iterate.lus @@ -9941,8 +10087,126 @@ tel ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/lionel/arrays.lus Opening file should_work/lionel/arrays.lus -*** Error in file "should_work/lionel/arrays.lus", line 16, col 23 to 23, token '+': syntax error +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack arrays + export type tab3d + export type word + export type byte + export type long + export const m + export const n + export const p + export node incr + export node big_or + export node big_sum + export node arrays + export node big_incr + export node add_byte + export node full_adder + export node add_long + export node big_xor +*** SyntaxTab.create pass 3 + init symbol tables for pack arrays +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + arrays (pack) + + - Raw model table: + - Raw Package table: arrays + - Package manager table: arrays +End of Syntax table dump. » +-- MAIN NODE: "arrays__arrays" +*** Dump the exported items of the packages. + * package arrays + Exported types: +const arrays__n = 4; +const arrays__m = 3; +const arrays__p = 2; +type arrays__tab3d = int^4^3^2; +type arrays__byte = bool^4; +type arrays__word = bool^4^3; +type arrays__long = bool^4^3^2; + Exported constants: + Exported nodes: +node arrays__incr(accin:int) returns (accout:int; val:int); +let + accout = (accin + 1); + val = accin; +tel +-- end of node arrays__incr +node arrays__big_sum(x:int^4^3^2) returns (s:int); +let + s = red<<node Lustre__red<<node Lustre__red<<node Lustre__+, const 4>>, + const 3>>, const 2>>(0, x); +tel +-- end of node arrays__big_sum +node arrays__big_or(x:bool^4^3^2) returns (s:bool); +let + s = red<<node Lustre__red<<node Lustre__red<<node Lustre__or, const 4>>, + const 3>>, const 2>>(false, x); +tel +-- end of node arrays__big_or +node arrays__big_incr(init:int) returns (x:int^4^3^2); +var + accout:int; +let + (accout, x) = fill<<node Lustre__fill<<node Lustre__fill<<node + arrays__incr, const 4>>, const 3>>, const 2>>(init); +tel +-- end of node arrays__big_incr + +node arrays__full_adder( + ci:bool; + x:bool; + y:bool) +returns ( + co:bool; + s:bool); +let + s = ((ci xor x) xor y); + co = if (ci) then ((x or y)) else ((x and y)); +tel +-- end of node arrays__full_adder +node arrays__add_long(x:bool^4^3^2; y:bool^4^3^2) returns (s:bool^4^3^2); +var + co:bool; +let + (co, s) = fillred<<node Lustre__fillred<<node Lustre__fillred<<node + arrays__full_adder, const 4>>, const 3>>, const 2>>(false, x, y); +tel +-- end of node arrays__add_long +node arrays__big_xor(x:bool^4^3^2) returns (s:bool); +let + s = red<<node Lustre__red<<node Lustre__red<<node Lustre__xor, const 4>>, + const 3>>, const 2>>(false, x); +tel +-- end of node arrays__big_xor +node arrays__arrays( + init_incr:int; + init_long:bool^4^3^2) +returns ( + ok:bool; + red_res:int; + fillred_res:bool^4^3^2); +var + fill_res:int^4^3^2; +let + red_res = arrays__big_sum(fill_res); + fill_res = arrays__big_incr(init_incr); + fillred_res = init_long -> arrays__add_long(init_long, pre(fillred_res)); + ok = false -> arrays__big_xor(fillred_res); +tel +-- end of node arrays__arrays +node arrays__add_byte(x:bool^4; y:bool^4) returns (s:bool^4); +var + co:bool; +let + (co, s) = fillred<<node arrays__full_adder, const 4>>(false, x, y); +tel +-- end of node arrays__add_byte ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/lionel/calculs_max.lus @@ -10165,14 +10429,93 @@ tel ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/lionel/matrice2.lus Opening file should_work/lionel/matrice2.lus -*** Error in file "should_work/lionel/matrice2.lus", line 6, col 22 to 22, token '+': syntax error - +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack matrice2 + export const m + export const n + export node matrice2 +*** SyntaxTab.create pass 3 + init symbol tables for pack matrice2 +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + matrice2 (pack) + + - Raw model table: + - Raw Package table: matrice2 + - Package manager table: matrice2 +End of Syntax table dump. » +-- MAIN NODE: "matrice2__matrice2" +*** Dump the exported items of the packages. + * package matrice2 + Exported types: + Exported constants: +const matrice2__m = 2; +const matrice2__n = 2; + Exported nodes: +node matrice2__matrice2(a:int) returns (res:int); +let + res = red<<node Lustre__red<<node Lustre__+, const 2>>, const 2>>(0, + int^2^2); +tel +-- end of node matrice2__matrice2 ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/lionel/minus.lus Opening file should_work/lionel/minus.lus -*** Error in file "should_work/lionel/minus.lus", line 8, col 22 to 22, token ',': syntax error +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack minus + export const m + export const n + export node minus + export node bitalt +*** SyntaxTab.create pass 3 + init symbol tables for pack minus +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + minus (pack) + + - Raw model table: + - Raw Package table: minus + - Package manager table: minus +End of Syntax table dump. » +-- MAIN NODE: "minus__minus" +*** Dump the exported items of the packages. + * package minus + Exported types: + Exported constants: +const minus__m = 2; +const minus__n = 3; + Exported nodes: +node minus__bitalt(a:bool) returns (out:bool; b:bool); +let + b = a; + out = not(a); +tel +-- end of node minus__bitalt +node minus__minus( + a:bool^3^2; + b:bool^3^2; + c:bool^3^2) +returns ( + r:bool; + T1:bool^3^2; + T2:bool^3^2); +var + bid:bool; +let + T1 = map<<node Lustre__map<<node Lustre__if, const 3>>, const 2>>(a, b, + c); + (bid, T2) = fill<<node Lustre__fill<<node minus__bitalt, const 3>>, const + 2>>(a[0][0]); + r = red<<node Lustre__red<<node Lustre__xor, const 3>>, const 2>>(a[0][0], + T1); +tel +-- end of node minus__minus ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/lionel/moyenne.lus @@ -10354,20 +10697,221 @@ tel ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/lionel/predefOp.lus Opening file should_work/lionel/predefOp.lus -*** Error in file "should_work/lionel/predefOp.lus", line 61, col 25 to 26, token '=>': syntax error +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack predefOp + export type T_Reg_H + export type T_Tab_H + export type Reg_L + export type Tab_L + export const H + export const L + export node incr + export node predefOp2 + export node composematint + export node incremental + export node reducematbool + export node reducematint + export node initmatbool + export node bitalt + export node initmatint + export node predefOp + export node composematbool +*** SyntaxTab.create pass 3 + init symbol tables for pack predefOp +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + predefOp (pack) + + - Raw model table: + - Raw Package table: predefOp + - Package manager table: predefOp +End of Syntax table dump. » +-- MAIN NODE: "predefOp__predefOp" +*** Dump the exported items of the packages. + * package predefOp + Exported types: +const predefOp__L = 2; +type predefOp__Reg_L = bool^2; +const predefOp__H = 3; +type predefOp__T_Reg_H = bool^2^3; +type predefOp__Tab_L = int^2; +type predefOp__T_Tab_H = int^2^3; + Exported constants: + Exported nodes: +node predefOp__incr(init:int; b:bool) returns (res:int); +let + res = if ((b = true)) then ((init + 1)) else (init); +tel +-- end of node predefOp__incr +node predefOp__bitalt(iacc:bool) returns (oacc:bool; res:bool); +let + res = iacc; + oacc = not(res); +tel +-- end of node predefOp__bitalt +node predefOp__initmatbool(iacc:bool) returns (sacc:bool; R:bool^2^3); +let + (sacc, R) = fill<<node Lustre__fill<<node predefOp__bitalt, const 2>>, + const 3>>(iacc); +tel +-- end of node predefOp__initmatbool +node predefOp__composematbool( + i1:bool^2^3; + i2:bool^2^3) +returns ( + s1:bool^2^3); +let + s1 = map<<node Lustre__map<<node Lustre__=>, const 2>>, const 3>>(i1, i2); +tel +-- end of node predefOp__composematbool +node predefOp__reducematbool(iacc:int; I:bool^2^3) returns (res:int); +let + res = red<<node Lustre__red<<node predefOp__incr, const 2>>, const + 3>>(iacc, I); +tel +-- end of node predefOp__reducematbool + +node predefOp__predefOp2( + a:bool) +returns ( + nbTrue:int; + init1:bool^2^3; + init2:bool^2^3; + XORMAT:bool^2^3); +var + bid1:bool; + bid2:bool; +let + (bid1, init1) = predefOp__initmatbool(a); + (bid2, init2) = predefOp__initmatbool(not(a)); + XORMAT = predefOp__composematbool(init1, init2); + nbTrue = predefOp__reducematbool(0, XORMAT); +tel +-- end of node predefOp__predefOp2 + +node predefOp__composematint( + i1:int^2^3; + i2:int^2^3) +returns ( + s1:int^2^3; + s2:bool^2^3); +let + s1 = map<<node Lustre__map<<node Lustre__/, const 2>>, const 3>>(i1, i2); + s2 = map<<node Lustre__map<<node Lustre__>=, const 2>>, const 3>>(i1, i2); +tel +-- end of node predefOp__composematint +node predefOp__incremental(iacc:int) returns (oacc:int; res:int); +let + res = iacc; + oacc = (res + 1); +tel +-- end of node predefOp__incremental +node predefOp__reducematint(iacc:int; I:int^2^3) returns (res:int); +let + res = red<<node Lustre__red<<node Lustre__+, const 2>>, const 3>>(iacc, + I); +tel +-- end of node predefOp__reducematint +node predefOp__initmatint(iacc:int) returns (sacc:int; R:int^2^3); +let + (sacc, R) = fill<<node Lustre__fill<<node predefOp__incremental, const + 2>>, const 3>>(iacc); +tel +-- end of node predefOp__initmatint + +node predefOp__predefOp( + a:int) +returns ( + res:int; + init1:int^2^3; + init2:int^2^3; + matres1:int^2^3; + matres2:bool^2^3); +var + bid1:int; + bid2:int; +let + (bid1, init1) = predefOp__initmatint(a); + (bid2, init2) = predefOp__initmatint((a * a)); + (matres1, matres2) = predefOp__composematint(init1, init2); + res = predefOp__reducematint(0, matres1); +tel +-- end of node predefOp__predefOp ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/lionel/redIf.lus Opening file should_work/lionel/redIf.lus -*** Error in file "should_work/lionel/redIf.lus", line 3, col 14 to 14, token ',': syntax error +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack redIf + export node monIf + export node redIf +*** SyntaxTab.create pass 3 + init symbol tables for pack redIf +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + redIf (pack) + + - Raw model table: + - Raw Package table: redIf + - Package manager table: redIf +End of Syntax table dump. » +-- MAIN NODE: "redIf__redIf" +*** Dump the exported items of the packages. + * package redIf + Exported types: + Exported constants: + Exported nodes: +*** Error in file "should_work/lionel/redIf.lus", line 3, col 7 to 9, token 'red': +*** type error: the type of node + extern function Lustre__if(c:bool; b1:a; b2:a) returns (o:a); + is not compatible with the use of this iterator. + bool should be equal to a +node redIf__monIf(a:bool; b:bool; c:bool) returns (r:bool); +let + r = if (a) then (b) else (c); +tel +-- end of node redIf__monIf + ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/lionel/simpleRed.lus Opening file should_work/lionel/simpleRed.lus -*** Error in file "should_work/lionel/simpleRed.lus", line 6, col 15 to 15, token '+': syntax error - +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack simpleRed + export const m + export const n + export node simpleRed +*** SyntaxTab.create pass 3 + init symbol tables for pack simpleRed +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + simpleRed (pack) + + - Raw model table: + - Raw Package table: simpleRed + - Package manager table: simpleRed +End of Syntax table dump. » +-- MAIN NODE: "simpleRed__simpleRed" +*** Dump the exported items of the packages. + * package simpleRed + Exported types: + Exported constants: +const simpleRed__m = 3; +const simpleRed__n = 2; + Exported nodes: +node simpleRed__simpleRed(a:int) returns (res:int); +let + res = red<<node Lustre__+, const 3>>(0, int^3); +tel +-- end of node simpleRed__simpleRed ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/lionel/testSilus.lus @@ -10559,7 +11103,12 @@ const contractForElementSelectionInArray__size = 10; ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_work/packEnvTest/contractForElementSelectionInArray/main.lus Opening file should_work/packEnvTest/contractForElementSelectionInArray/main.lus -*** Error in file "should_work/packEnvTest/contractForElementSelectionInArray/main.lus", line 3, col 45 to 45, token '=': syntax error +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + 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 ---------------------------------------------------------------------- @@ -11277,7 +11826,30 @@ End of Syntax table dump. ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 --compile-all-items should_fail/semantics/bad_call03.lus Opening file should_fail/semantics/bad_call03.lus -*** Error in file "should_fail/semantics/bad_call03.lus", line 2, col 18 to 18, token '+': syntax error +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack bad_call03 + export node titi + export node bad_call03 + export node toto +*** SyntaxTab.create pass 3 + init symbol tables for pack bad_call03 +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + bad_call03 (pack) + + - Raw model table: + - Raw Package table: bad_call03 + - Package manager table: bad_call03 +End of Syntax table dump. » +-- MAIN NODE: "bad_call03__bad_call03" +*** Dump the exported items of the packages. + * package bad_call03 + Exported types: + Exported constants: + Exported nodes: +*** Error in file "should_fail/semantics/bad_call03.lus", line 0, col 0 to 0, token 'aliasing a node': Cannot alias overloaded or polymorphic operator ---------------------------------------------------------------------- -- GitLab