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

Nonsensical error message with ocamlyacc #3650

Closed
vicuna opened this issue Sep 10, 2002 · 2 comments
Closed

Nonsensical error message with ocamlyacc #3650

vicuna opened this issue Sep 10, 2002 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Sep 10, 2002

Original bug ID: 1380
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

I have a parser, which is very originally defined in
parser.mly file. Here's what happens when I try to compile it:

[alex@athlon text_to_xml]$ ocamlyacc parser.mly
[alex@athlon text_to_xml]$ ocamlfind ocamlc -package report
-c parser.ml
File "parser.mly", line 83, characters 30-42:
This expression is not a function, it cannot be applied
[alex@athlon text_to_xml]$ wc parser.mly
69 243 1721 parser.mly

There error message is entirely nonsensical, for parser.mly
only has 69 lines. So where in my code is the error precisely?

Alex

@vicuna
Copy link
Author

vicuna commented Sep 20, 2002

Comment author: administrator

I have a parser, which is very originally defined in
parser.mly file. Here's what happens when I try to compile it:

[alex@athlon text_to_xml]$ ocamlyacc parser.mly
[alex@athlon text_to_xml]$ ocamlfind ocamlc -package report
-c parser.ml
File "parser.mly", line 83, characters 30-42:
This expression is not a function, it cannot be applied
[alex@athlon text_to_xml]$ wc parser.mly
69 243 1721 parser.mly

There error message is entirely nonsensical, for parser.mly
only has 69 lines. So where in my code is the error precisely?

The reason for the funky line number is the following. ocamlyacc
generates the parser.ml file with the following format:

"parser.mly" lineno1

# "parser.mly" lineno2 ...

Hence an error in the postlude will be reported as coming from parser.mly
(because the last # "parser.mly" lineno directive is still active),
but with a wrong line number.

Normally, type errors in the actions should not cause errors in the
postlude, but apparently you've found a case where it does. If you'd
like to track it down, you can edit the generated parser.ml, delete
all # "parser.mly" lines, and ocamlc parser.ml again.

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Jan 7, 2003

Comment author: administrator

Generation of # line directives in Yacc output file revised 2002-11-?? by DD.

@vicuna vicuna closed this as completed Jan 7, 2003
@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