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

Misspellings in OCAMLYACC/2.99 not caught #2402

Closed
vicuna opened this issue Mar 18, 2000 · 2 comments
Closed

Misspellings in OCAMLYACC/2.99 not caught #2402

vicuna opened this issue Mar 18, 2000 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Mar 18, 2000

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

Bug description

Full_Name: David McClain
Version: 2.99
OS: Win/NT 4.0 (pl 3)
Submission from: dialup001ip074.tus.azstarnet.com (169.197.12.74)

Misspelled nonterminals are not caught by CAMLYACC nor by subsequent
compilation.
It appears that the new YACC converts non-terminal names into "modern"-style
backquoted polymorphic variant labels. A misspelled label makes its way through
all stages of compilation without complaint, but of course, the end result does
not work as expected. This can be a very difficult bug to track down!

E.g.,

param_tail:
AMPEROPT option_pattern_list
{ $2 }
| AMPEROPT option_patternm_list COMMA AMPERKEY key_pattern
{ $5 @ $2 }
| AMPERKEY key_pattern
{ $2 }
;

The second clause has a hard to notice misspelling: the correct nonterminal name
is
"option_pattern_list", but the misspelling is "option_patternM_list"
(misspelling
capitalized so you can see it more easily). When compiled the parser fails with

syntax errors galore where it was intended to handle the clause without
complaint.

I beleive this behavior is new to version 2.99, but I have not tried
misspellings on
any of the older versions recently...

@vicuna
Copy link
Author

vicuna commented Mar 24, 2000

Comment author: administrator

Misspelled nonterminals are not caught by CAMLYACC nor by subsequent
compilation.

ocamlyacc produces warning messages in this situation:

    boot/ocamlyacc: w - the symbol XXXX is undefined

For reasons that escape me, this is a warning, not an error. This
behavior was inherited from the original Berkeley yacc on which
ocamlyacc is based; maybe we should emit an error instead of a warning.

It appears that the new YACC converts non-terminal names into
"modern"-style backquoted polymorphic variant labels.

No, no, we haven't changed ocamlyacc to use polymorphic variants.
The quote-like characters you see in the generated .ml file are single
quotes ' denoting type variables, not backquotes ` denoting variant
constructors.

I beleive this behavior is new to version 2.99, but I have not tried
misspellings on any of the older versions recently...

I think this behavior has been there for a long time, probably since
Caml Light.

Best regards,

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Nov 5, 2002

Comment author: administrator

ocamlyacc emits a warning in this case; maybe an error would be better. -Xavier

Done in 3.06+16 -- Damien

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant