Skip to content

labels with same letters but different cases break the compilation on the c backend #479

@praduca

Description

@praduca

If you have labels with the same letters (like Eexp and EExp), bnfc will check and not accuse an error, but the compilation will fail with an error stating that duplicate members exist.

for instance, the following generate code and compile ok in cpp and haskell, but not in C (didn't test with others):

CalcList . CalcL ::= [Calc] ;
terminator Calc ";"         ;
Cal   .    Calc ::= Exp     ; 

EAdd  .  Exp  ::= Exp  "+"  Exp1 ;
ESub  .  Exp  ::= Exp  "-"  Exp1 ;
EMul  .  Exp1 ::= Exp1 "*"  Exp2 ;
EDiv  .  Exp1 ::= Exp1 "/"  Exp2 ;
Eexp  .  Exp2 ::= Exp2 "^"  Exp3 ;
EExp  .  Exp2 ::= Exp2 "**" Exp3 ;
EFact .  Exp3 ::= Exp4 "!"       ;
EInt  .  Exp4 ::= Integer        ;
coercions Exp 4 ;
comment "#";

Apparently the name is forced to be lowercase on the c code, but have the case preserved on the CPP backend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ASTConcerning the generated abstract syntaxCJava

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions