Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocamlyacc 2.04 bug report #2380

Closed
vicuna opened this issue Feb 29, 2000 · 3 comments
Closed

ocamlyacc 2.04 bug report #2380

vicuna opened this issue Feb 29, 2000 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Feb 29, 2000

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 }
;



@vicuna
Copy link
Author

vicuna commented Mar 3, 2000

Comment author: administrator

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

@vicuna
Copy link
Author

vicuna commented Mar 3, 2000

Comment author: administrator

On Fri, 3 Mar 2000, Damien Doligez wrote:

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

@vicuna
Copy link
Author

vicuna commented Apr 17, 2000

Comment author: administrator

Fixed in 3.00

@vicuna vicuna closed this as completed Apr 17, 2000
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant