Skip to content

Cannot use B as a constructor in haskell #128

@gdetrez

Description

@gdetrez

With the following grammar:

B. Bar ::= "bar" ;

The compilation produce an error:

$ bnfc --haskell -m Test.cf
...
$ make
happy -gca ParTest.y
alex -g LexTest.x
ghc --make TestTest.hs -o TestTest
line-map.c: file "<command-line>" left but not entered
line-map.c: file "<command-line>" left but not entered
[1 of 7] Compiling ErrM             ( ErrM.hs, ErrM.o )
[2 of 7] Compiling AbsTest          ( AbsTest.hs, AbsTest.o )
[3 of 7] Compiling PrintTest        ( PrintTest.hs, PrintTest.o )
[4 of 7] Compiling SkelTest         ( SkelTest.hs, SkelTest.o )
[5 of 7] Compiling LexTest          ( LexTest.hs, LexTest.o )
[6 of 7] Compiling ParTest          ( ParTest.hs, ParTest.o )

ParTest.hs:58:19:
    Ambiguous occurrence `B'
    It could refer to either `AbsTest.B',
                             imported from `AbsTest' at ParTest.hs:5:1-14
                             (and originally defined at AbsTest.hs:10:12)
                          or `LexTest.B',
                             imported from `LexTest' at ParTest.hs:6:1-14
                             (and originally defined at LexTest.x:85:18)
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions