[antlr-interest] #defines in C target

Justin Murray jmurray at aerotech.com
Tue Dec 14 07:48:10 PST 2010


Hello,

 

I am building a parser for a C target, and am running into issues with
the generated #defines from the lexer tokens. Essentially, the lexer
names that were chosen in some cases conflict with other #defines in the
code (either from our own code, or from standard libraries like
Windows.h). While I realize that I could just rename the lexer rules to
remove the conflict, this makes the grammar file less readable, and at
this point is a considerable amount of work (our language has hundreds
of keywords). Is it possible to tell the lexer generator to
prefix/postfix all of these defines to make them more unique, while
preserving the nice, readable grammar definition file?

 

Thank you,

 

Justin Murray 
Software Engineer 
jmurray at aerotech.com

Aerotech, Inc. 
101 Zeta Drive 
Pittsburgh, PA 15238 
412-963-7470

 



More information about the antlr-interest mailing list