From 4e616e8957cca4de65c2a971a3d105de82dab23a Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Thu, 21 Feb 2008 18:46:10 +0100 Subject: [PATCH] Fix the examples so that slice "1..2" are written "1 ..2" to turn around a lexing bug that I don't know how to fix yet. --- src/TODO | 17 +- src/lexer.mll | 2 +- src/parser.mly | 2 +- src/test/should_work/demo/filliter.lus | 2 +- src/test/should_work/demo/tranche.lus | 6 +- src/test/should_work/fab_test/morel.lus | 6 +- src/test/should_work/fab_test/morel2.lus | 4 +- src/test/should_work/fab_test/morel3.lus | 4 +- src/test/should_work/fab_test/morel4.lus | 4 +- src/test/test.res.exp | 210 +++++++++++++++++++++-- 10 files changed, 228 insertions(+), 29 deletions(-) diff --git a/src/TODO b/src/TODO index ec9d9f74..77c58710 100644 --- a/src/TODO +++ b/src/TODO @@ -35,11 +35,18 @@ implicite. Autorise-t'on ce genre de truc ? *********************************************************************************** *** a faire -* should_work/fab_test/morel.lus - -> tranche de tableau +* "1..2" ne marche pas car le lexer renvoie + "1." ".2" + au lieu de + "1" ".." "2" + et avec lex, il n'y a aucun moyen de lever cette ambiguité ! + +une solution crade serait de faire un coup des sed pour rajouter un +espace devant tous les "..". + +une solution propre serait de ne plus utiliser lex... + -* Essayer de tronconner le lazyCompiler, 700 lignes, c'est trop (et -c'est pas fini !) * parser.mly : rajouter les pragma ! @@ -58,6 +65,8 @@ c'est pas fini !) * finir de rédiger le manuel +* Essayer de tronconner le lazyCompiler, 700 lignes, c'est trop (et +c'est pas fini !) * GenLic diff --git a/src/lexer.mll b/src/lexer.mll index d7f6ad2d..1fce7444 100644 --- a/src/lexer.mll +++ b/src/lexer.mll @@ -193,7 +193,7 @@ rule lexer = parse lexer lexbuf } -(* mots-clé débutant par un séparateurs (prioritaires) *) +(* mots-clé débutant par un séparateur (prioritaires) *) | "->" { TK_ARROW ( Lxm.make lexbuf ) } | "=>" { TK_IMPL ( Lxm.make lexbuf ) } | "<=" { TK_LTE ( Lxm.make lexbuf ) } diff --git a/src/parser.mly b/src/parser.mly index 0e63591a..c4a38d56 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -1257,7 +1257,7 @@ sxSurelyType: sxSimpleExp: sxConstant { $1 } | sxIdentRef { leafexp $1.src (IDENT_n $1.it) } - | TK_OPEN_PAR sxSimpleExp TK_CLOSE_PAR { $2 } + | TK_OPEN_PAR sxSimpleExp TK_CLOSE_PAR { $2 } | TK_NOT sxSimpleExp { unexp $1 NOT_n $2 } | TK_MINUS sxSimpleExp %prec TK_UMINUS { unexp $1 UMINUS_n $2 } | sxSimpleExp TK_AND sxSimpleExp { binexp $2 AND_n $1 $3 } diff --git a/src/test/should_work/demo/filliter.lus b/src/test/should_work/demo/filliter.lus index a6936e72..15f511ba 100644 --- a/src/test/should_work/demo/filliter.lus +++ b/src/test/should_work/demo/filliter.lus @@ -22,7 +22,7 @@ var x : int^4 when c; bid1, bid2 : int when c; let - s1 = x[0..2]; + s1 = x[0 ..2]; (bid1, x) = fill<<copie, 4 >>(i1); (bid2, s2) = fill<<incr_acc, NBC >>(i2); tel diff --git a/src/test/should_work/demo/tranche.lus b/src/test/should_work/demo/tranche.lus index 146291f4..668e82c0 100644 --- a/src/test/should_work/demo/tranche.lus +++ b/src/test/should_work/demo/tranche.lus @@ -18,14 +18,14 @@ var let y = 1.; x[if(1>2) then -2 else 0] = true; - x[1..2] = a[1..2]; + x[1 ..2] = a[1 ..2]; res = true or false; --if x[1] then x[0] else x[2]; z[0][0] = true; z[0][1] = true; z[0][2] = true; z[1][0] = true; - z[1][1..2] = x[1..2]; - z[2..3]= x1; + z[1][1 ..2] = x[1 ..2]; + z[2 ..3]= x1; x1[0] = x; x1[1] = x; --x[0] = x1[0][0]; diff --git a/src/test/should_work/fab_test/morel.lus b/src/test/should_work/fab_test/morel.lus index a9408af7..cadbf18f 100644 --- a/src/test/should_work/fab_test/morel.lus +++ b/src/test/should_work/fab_test/morel.lus @@ -16,11 +16,11 @@ let b1, b2, b3 = (tabb[0], tabb[1], tabb[2]) ; i1, i2, i3 = (tabi[0][0]+tabi[0][1], tabi[1][0]+tabi[1][1], tabi[2][0]+tabi[2][1]); - tabb[0] = b; - tabb[1..2] = [true, false] ; +-- tabb[0] = b; + tabb[1 ..2] = [true, false] ; tabi[2] = mcmorel(i) ; - tabi[0..1] = [ [10,100], [1000,10000] ] ; + tabi[0 ..1] = [ [10,100], [1000,10000] ] ; tel node mcmorel(i:int) returns (t:int^2); diff --git a/src/test/should_work/fab_test/morel2.lus b/src/test/should_work/fab_test/morel2.lus index b065523d..490c1f4a 100644 --- a/src/test/should_work/fab_test/morel2.lus +++ b/src/test/should_work/fab_test/morel2.lus @@ -17,13 +17,13 @@ let i1, i2, i3 = (tabi[0][0]+tabi[0][1], tabi[1][0]+tabi[1][1], tabi[2][0]+tabi[2][1]); tabb[0] = b; - tabb[1..2] = [true, false] ; + tabb[1 ..2] = [true, false] ; --tabi[2] = mcmorel(i) ; --tabi[0..1] = [ [10,100], [1000,10000] ] ; toto[2] = mcmorel(i) ; - toto[0..1] = [ [10,100], [1000,10000] ] ; + toto[0 ..1] = [ [10,100], [1000,10000] ] ; tabi = toto; diff --git a/src/test/should_work/fab_test/morel3.lus b/src/test/should_work/fab_test/morel3.lus index 10e9d4a4..29629ef8 100644 --- a/src/test/should_work/fab_test/morel3.lus +++ b/src/test/should_work/fab_test/morel3.lus @@ -17,10 +17,10 @@ let i1, i2, i3 = (tabi[0][0]+tabi[0][1], tabi[1][0]+tabi[1][1], tabi[2][0]+tabi[2][1]); tabb[0] = b; - tabb[1..2] = [true, false] ; + tabb[1 ..2] = [true, false] ; tabi[2] = mcmorel(i) ; - tabi[0..1] = [ [10,100], [1000,10000] ] ; + tabi[0 ..1] = [ [10,100], [1000,10000] ] ; tel node mcmorel(i:int) returns (t:int^2); diff --git a/src/test/should_work/fab_test/morel4.lus b/src/test/should_work/fab_test/morel4.lus index 943fafd0..a6f80e8d 100644 --- a/src/test/should_work/fab_test/morel4.lus +++ b/src/test/should_work/fab_test/morel4.lus @@ -20,10 +20,10 @@ let i1, i2, i3 = (tabi[0][0]+tabi[0][1], tabi[1][0]+tabi[1][1], tabi[2][0]+tabi[2][1]); tabb[0] = b; - tabb[1..2] = [true, false] ; + tabb[1 ..2] = [true, false] ; tabi[2] = mcmorel(i) ; - tabi[0..1] = [ [10,100], [1000,10000] ] ; + tabi[0 ..1] = [ [10,100], [1000,10000] ] ; tel node mcmorel(i:int) returns (t:int^2); diff --git a/src/test/test.res.exp b/src/test/test.res.exp index 717b0ad5..5abe196d 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -1930,12 +1930,6 @@ End of Syntax table dump. node dummy::once_since = dummy::once_since(bool, bool) returns (bool) on clock XXX -*** Error in file "should_work/fab_test/morel.lus", line 20, col 9 to 10, token '.2': syntax error - -*** Error in file "should_work/fab_test/morel2.lus", line 20, col 9 to 10, token '.2': syntax error - -*** Error in file "should_work/fab_test/morel3.lus", line 20, col 9 to 10, token '.2': syntax error - *** SyntaxTab.create pass 1 *** SyntaxTab.create pass 2 init pack dummy @@ -2410,8 +2404,45 @@ End of Syntax table dump. Exported nodes: node dummy::toto = dummy::toto(bool, bool) returns (bool) on clock XXX -*** Error in file "should_work/fab_test/morel4.lus", line 23, col 9 to 10, token '.2': syntax error +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export type toto + export type arrayb + export type tube + export type arrayi + export node morel4 + export node tab + export node mcmorel +*** SyntaxTab.create pass 3 + init symbol tables for pack dummy +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + morel4 (pack) + + - Raw model table: + - Raw Package table: dummy + - Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "morel4::main" +*** Dump the exported items of the packages. + * package dummy + Exported types: + type dummy::toto = {titi : {in : int; out : int}; tutu : bool} + type dummy::arrayb = bool^3 + type dummy::arrayi = int^2^3 + type dummy::tube = {in : int; out : int} + Exported constants: + Exported nodes: + node dummy::morel4 = dummy::morel4(bool, int) returns (bool, bool, bool, int, int, int) on clock XXX + node dummy::tab = dummy::tab(bool, int) returns (bool, bool, bool, int, int, int) on clock XXX + + node dummy::mcmorel = dummy::mcmorel(int) returns (int^2) on clock XXX + +Warning. in file "should_work/fab_test/morel4.lus", line 33, col 17 to 17, token ',': +---> separator mismatch, ';' expected *** SyntaxTab.create pass 1 *** SyntaxTab.create pass 2 init pack dummy @@ -2449,6 +2480,106 @@ End of Syntax table dump. node dummy::mcmorel = dummy::mcmorel(int) returns (int^2, int^2^2) on clock XXX +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export type arrayb + export type arrayi + export node tab + export node morel + export node mcmorel +*** SyntaxTab.create pass 3 + init symbol tables for pack dummy +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + morel (pack) + + - Raw model table: + - Raw Package table: dummy + - Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "morel::main" +*** Dump the exported items of the packages. + * package dummy + Exported types: + type dummy::arrayb = bool^3 + type dummy::arrayi = int^2^3 + Exported constants: + Exported nodes: + node dummy::tab = dummy::tab(bool, int) returns (bool, bool, bool, int, int, int) on clock XXX + + node dummy::morel = dummy::morel(bool, int) returns (bool, bool, bool, int, int, int) on clock XXX + + node dummy::mcmorel = dummy::mcmorel(int) returns (int^2) on clock XXX + +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export type a32 + export type arrayb + export type a2 + export type arrayi + export node morel2 + export node mcmorel +*** SyntaxTab.create pass 3 + init symbol tables for pack dummy +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + morel2 (pack) + + - Raw model table: + - Raw Package table: dummy + - Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "morel2::main" +*** Dump the exported items of the packages. + * package dummy + Exported types: + type dummy::a32 = int^2^3 + type dummy::arrayb = bool^3 + type dummy::a2 = int^2 + type dummy::arrayi = int^2^3 + Exported constants: + Exported nodes: + node dummy::morel2 = dummy::morel2(bool, int) returns (bool, bool, bool, int, int, int) on clock XXX + + node dummy::mcmorel = dummy::mcmorel(int) returns (int^2) on clock XXX + +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export type arrayb + export type arrayi + export node morel3 + export node tab + export node mcmorel +*** SyntaxTab.create pass 3 + init symbol tables for pack dummy +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + morel3 (pack) + + - Raw model table: + - Raw Package table: dummy + - Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "morel3::main" +*** Dump the exported items of the packages. + * package dummy + Exported types: + type dummy::arrayb = bool^3 + type dummy::arrayi = int^2^3 + Exported constants: + Exported nodes: + node dummy::morel3 = dummy::morel3(bool, int) returns (bool, bool, bool, int, int, int) on clock XXX + + node dummy::tab = dummy::tab(bool, int) returns (bool, bool, bool, int, int, int) on clock XXX + + node dummy::mcmorel = dummy::mcmorel(int) returns (int^2) on clock XXX + *** SyntaxTab.create pass 1 *** SyntaxTab.create pass 2 init pack dummy @@ -5129,8 +5260,6 @@ End of Syntax table dump. node dummy::sample_time_change = dummy::sample_time_change(bool, bool, real) returns (real) on clock XXX -*** Error in file "should_work/demo/tranche.lus", line 21, col 7 to 8, token '.2': syntax error - *** SyntaxTab.create pass 1 *** SyntaxTab.create pass 2 init pack dummy @@ -5314,7 +5443,38 @@ End of Syntax table dump. Exported nodes: node dummy::def = dummy::def(bool, int^4^4, {x : int; y : real; z : int^4^4^4}^2, int^23) returns (bool) on clock XXX -*** Error in file "should_work/demo/filliter.lus", line 25, col 12 to 13, token '.2': syntax error +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export type t + export const NBC + export node copie + export node filliter + export node incr_acc +*** SyntaxTab.create pass 3 + init symbol tables for pack dummy +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + filliter (pack) + + - Raw model table: + - Raw Package table: dummy + - Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "filliter::main" +*** Dump the exported items of the packages. + * package dummy + Exported types: + type dummy::t = int^5 + Exported constants: + const dummy::NBC = 3 + Exported nodes: + node dummy::copie = dummy::copie(int) returns (int, int) on clock XXX + + node dummy::filliter = dummy::filliter(bool, int, int) returns (int^3, int^3) on clock XXX + + node dummy::incr_acc = dummy::incr_acc(int) returns (int, int) on clock XXX *** SyntaxTab.create pass 1 *** SyntaxTab.create pass 2 @@ -5395,6 +5555,36 @@ End of Syntax table dump. *** 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 dummy + export type t2 + export type t + export const m + export const n + export const o + export const s + export node tranche +*** SyntaxTab.create pass 3 + init symbol tables for pack dummy +*** SyntaxTab.create done +*** « Syntax table dump: + - Package or model list: + tranche (pack) + + - Raw model table: + - Raw Package table: dummy + - Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "tranche::main" +*** Dump the exported items of the packages. + * package dummy + Exported types: + type dummy::t2 = bool^7^8^9^10 + type dummy::t = bool^3^4 +*** Error in file "should_work/demo/tranche.lus", line 7, col 6 to 6, token 'n': can't eval constant: external constant not allowed (in file "should_work/demo/tranche.lus", line 7, col 6 to 6, token 'n') + + Exported constants: *** Error in file "should_work/to_sort_out/record.lus", line 2, col 2 to 7, token 'struct': syntax error *** Error in file "should_work/to_sort_out/asservi.lus", line 7, col 1 to 8, token 'function': syntax error -- GitLab