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

Clashes between token categories and token and ordinary categories #323

Closed
andreasabel opened this issue Nov 13, 2020 · 1 comment
Closed
Assignees
Labels
error-reporting Concerning error messages BNFC gives LBNF Concerning the LBNF syntax and its checking
Milestone

Comments

@andreasabel
Copy link
Member

BNFC should reject this ambiguous grammar, rather than letting the backends crash:

Foo. L ::= L;

token L 'a';
token L 'b';
@andreasabel andreasabel added bug LBNF Concerning the LBNF syntax and its checking labels Nov 13, 2020
@andreasabel andreasabel added this to the 2.9 milestone Nov 13, 2020
@andreasabel andreasabel added error-reporting Concerning error messages BNFC gives and removed bug labels Nov 13, 2020
andreasabel added a commit that referenced this issue Nov 14, 2020
Modified the definition of duplicatesOn to return the expected result.
@andreasabel
Copy link
Member Author

The use of numeric prefixes in token names confuses BNFC:

Foo. Main ::= Main1 "fun";
token Main1 {"main"};

BNFC maps Main1 to Main in the AST definition, consequently, the parser contains type errors.

Solution: raise an error when the user defines a token name with a numeric suffix.

@andreasabel andreasabel self-assigned this Nov 15, 2020
andreasabel added a commit that referenced this issue Nov 15, 2020
These will not be referenced correctly in the AST, because of coercion categories.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error-reporting Concerning error messages BNFC gives LBNF Concerning the LBNF syntax and its checking
Projects
None yet
Development

No branches or pull requests

1 participant