BNFC / bnfc

BNF Converter
http://bnfc.digitalgrammars.com/
587 stars 165 forks source link

Clashes between token categories and token and ordinary categories #323

Closed andreasabel closed 4 years ago

andreasabel commented 4 years ago

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

Foo. L ::= L;

token L 'a';
token L 'b';
andreasabel commented 4 years ago

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.