Skip to content

Numbers in category names and list macros #210

@dschoepe

Description

@dschoepe

Using categories with numbers in the name with separator results in errors when compiling the Par... files. For example, the following grammar:

Foo. Bar2 ::= Ident ;
terminator Bar2 "," ;

Results in the following errors:

$ bnfc -m Foo.cf
3 rules accepted

Use Alex 3.0 to compile LexFoo.x.
ParFoo.y Tested with Happy 1.15
writing new file ./AbsFoo.hs
writing new file ./LexFoo.x
writing new file ./ParFoo.y
writing new file ./TestFoo.hs
writing new file ./DocFoo.txt
writing new file ./SkelFoo.hs
writing new file ./PrintFoo.hs
writing new file ./ErrM.hs
writing new file ./Makefile

$ make
happy -gca ParFoo.y
alex -g LexFoo.x
ghc --make TestFoo.hs -o TestFoo
[1 of 7] Compiling LexFoo           ( LexFoo.hs, LexFoo.o )
[2 of 7] Compiling ErrM             ( ErrM.hs, ErrM.o )
[3 of 7] Compiling AbsFoo           ( AbsFoo.hs, AbsFoo.o )
[4 of 7] Compiling ParFoo           ( ParFoo.hs, ParFoo.o )

ParFoo.hs:28:14: error:
    Not in scope: type constructor or class ‘Bar’

ParFoo.hs:31:33: error:
    Not in scope: type constructor or class ‘Bar’

ParFoo.hs:34:15: error:
    Not in scope: type constructor or class ‘Bar’

ParFoo.hs:37:34: error:
    Not in scope: type constructor or class ‘Bar’

ParFoo.hs:100:19: error:
    Not in scope: data constructor ‘AbsFoo.Foo’
    Module ‘AbsFoo’ does not export ‘Foo’.
make: *** [Makefile:4: all] Error 1

This was tested with GHC 8.0.2, alex 3.1.7, and 1.19.7, on ArchLinux, but it also occurred on a MacOS system. Changing Bar2 to some name not containing any digits resolves the error.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions