You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 44 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
le source suivant est accepte par ocamlyacc, malgre le `|' manquant en
debut de ligne 19.
Du coup, les # line-nb renvoient n'importe ou dans le fichier .mly
%{
%}
%token INT
%token VAR
%token PLUS MINUS TIMES DIV
%token LPAREN RPAREN
%token EOL
%left PLUS MINUS /* lowest precedence /
%left TIMES DIV / medium precedence /
%nonassoc UMINUS / highest precedence /
%start main / the entry point */
%type <Calc.expr> main
%%
main: expr EOL { $1 } ;
expr:
INT { Int($1) }
VAR { Var($1) }
| LPAREN expr RPAREN { $2 }
| expr PLUS expr { Bin(( + ),"+",1,$1,$3) }
| expr MINUS expr { Bin(( - ),"-",1,$1,$3) }
| expr TIMES expr { Bin(( * ),"*",2,$1,$3) }
| expr DIV expr { Bin(( / ),"/",2,$1,$3) }
| MINUS expr %prec UMINUS { Un((fun x->-x),"-",$2 }
;
The text was updated successfully, but these errors were encountered:
le source suivant est accepte par ocamlyacc, malgre le `|' manquant en
debut de ligne 19.
Du coup, les # line-nb renvoient n'importe ou dans le fichier .mly
[...]
expr:
INT { Int($1) }
VAR { Var($1) }
| LPAREN expr RPAREN { $2 }
J'ai pas vu le probleme avec les # line-nb, mais j'ai fixe ocamlyacc pour qu'il
donne une erreur de syntaxe (sur "VAR" a la ligne 19) dans ce cas.
le source suivant est accepte par ocamlyacc, malgre le `|' manquant en
debut de ligne 19.
Du coup, les # line-nb renvoient n'importe ou dans le fichier .mly
[...]
expr:
INT { Int($1) }
VAR { Var($1) }
| LPAREN expr RPAREN { $2 }
J'ai pas vu le probleme avec les # line-nb, mais j'ai fixe ocamlyacc pour qu'il
donne une erreur de syntaxe (sur "VAR" a la ligne 19) dans ce cas.
-- Damien
Il n'y a pas de probleme a proprement parler avec les # line-nb ;
simplement, quand on a une erreur dans le code autogenere de parser.ml ---
ce qui ne devrait jamais se produire, mais qui arrivait ici ---, le
message d'erreur d'ocamlc renvoie n'importe ou dans parser.mly au lieu de
renvoyer a la ligne fautive de parser.ml, du fait des # line-nb
Original bug ID: 44
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
le source suivant est accepte par ocamlyacc, malgre le `|' manquant en
debut de ligne 19.
Du coup, les # line-nb renvoient n'importe ou dans le fichier .mly
%{
%}
%token INT
%token VAR
%token PLUS MINUS TIMES DIV
%token LPAREN RPAREN
%token EOL
%left PLUS MINUS /* lowest precedence /
%left TIMES DIV / medium precedence /
%nonassoc UMINUS / highest precedence /
%start main / the entry point */
%type <Calc.expr> main
%%
main: expr EOL { $1 } ;
expr:
INT { Int($1) }
VAR { Var($1) }
| LPAREN expr RPAREN { $2 }
| expr PLUS expr { Bin(( + ),"+",1,$1,$3) }
| expr MINUS expr { Bin(( - ),"-",1,$1,$3) }
| expr TIMES expr { Bin(( * ),"*",2,$1,$3) }
| expr DIV expr { Bin(( / ),"/",2,$1,$3) }
| MINUS expr %prec UMINUS { Un((fun x->-x),"-",$2 }
;
The text was updated successfully, but these errors were encountered: