Skip to content

Classname "Doc" causes errors in Haskell parser #228

Description

@hjorthjort

Steps to reproduce:

  1. BNFC file (Prog.cf)
Document. Doc ::= "d"  
  1. Run bnfc -m Prog.cf
  2. Run make

Output: make.log

Other class names that causes the same error:

  • Err
  • ParseFun

Inspection shows that this is because PrintProg.hs defines type Doc = [ShowS] -> [ShowS]. Other modules similarly define types, such as Err and ParseFun. Since the AbsProg.hs file is not imported with a qualified import, there is a namespace conflict.

Perhaps it would be sensible to either supply a list of reserved class names and report the use of them when generating the frontend files, or use qualified imports to avoid namespace conflicts.

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions