BNFC / bnfc

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

C++: `define` does not work with token categories #285

Closed andreasabel closed 4 years ago

andreasabel commented 4 years ago
INil.  Ints ::=                  ;
iSg.   Ints ::= Integer          ;
ISnoc. Ints ::= Ints "," Integer ;

define iSg i = ISnoc INil i      ;

The C++ backend adds to the yacc file the definition

Ints * iSg_ (Integer * i_) {
  return new ISnoc(new INil(), i_);
}

but correct would be just Integer i_ for the argument.