[antlr-interest] Names of generated files and classes

Johannes Luber jaluber at gmx.de
Mon Aug 6 03:59:41 PDT 2007


Hello!

I've noticed that for separate lexer and parser grammars the generated
files still attach Lexer and Parser to the class names. As I already
named mu grammars CSharp3Lexer.g and CSharp3Parser.g, I end up with
CSharp3LexerLexer and CSharp3ParserParser. My suggestion is to leave the
grammar names as they are, because the generated files won't have a
naming conflict.

I've talked with Ter about this and he said that the behaviour wasn't
changed before because the book was written for the old behaviour
(actually, I remember an example which showed my suggested behaviour so
nobody should be surprised. Maybe a editor thought that the source code
was wrong there.). But as for 3.1 the bets are off.

The biggest question is how much the existing code would break. I rename
the generated files and classes every time because I can't stand the
names aesthetically. In my case no code would break. Other people will
have to rename the types in their rigs or add Lexer and Parser to the
grammar names. Both are one time operations and done via Search&Replace
(if necessary at all) so it isn't a big deal.

What are your opionions?

Best regards,
Johannes Luber


More information about the antlr-interest mailing list