[antlr-interest] Names of generated files and classes

Kay Roepke kroepke at classdump.org
Mon Aug 6 07:25:53 PDT 2007


On Aug 6, 2007, at 3:46 PM, Johannes Luber wrote:

> Kay Roepke wrote:
>>
>> Here we go again...you do realize that this will go down the "heated
>> discussion" path,
>> right?
>
> I have been warned, but this is the easiest way to get others'  
> opinions
> - and to challenge old assumptions.

:)

>> And we couldn't agree what people actually wanted, IIRC. This has  
>> been
>> the case with
>> grammar file suffixes, too. Annoying. We eventually ended up at the
>> starting point...
>
> Wait a minute. It should be clear what people want - at least on the
> mailing list. After all they tell it. And if they tell it after the
> discussion has ended, then either they change their way or the tool
> becomes more flexible. And speculating, what non-participating people
> could maybe need, should result in "keeping our options open" or have
> none influence at all. After all it can be safely assumed that  
> important
> requirements would be voiced. (Of course, this excludes the  
> question if
> that, what people want, is also that, what people need.)

IIRC, it we couldn't agree. Some people wanted this, others wanted that.

>> In some cases the names actually propagate further than that, but  
>> that's
>> target
>> specific, I guess (at least for ObjC this is the case - this has  
>> to do
>> with the
>> token name defines and name of rule return values' classes).
>> But I agree that "getting it right" should have priority.
>
> Wouldn't a regeneration propagate the right names? Or does client code
> access those internals?

E.g. the class names of rule return structures have a prefix of the  
parser class
name to prevent name clashes, since ObjC doesn't have namespaces.  
Likewise with
the defines for token types.
There's not really a way around that, but it might not be a hard  
thing to fix either.
It just crossed my mind.

>> So my suggestion still stands:
>> grammar Name; generates NameLexer, NameParser
>> lexer grammar Name; generates Name
>> parser grammar Name; generates Name
>> treeparser grammar Name; generates Name
>
> So far it is like mine.

Yes, but by making this the default we should, IMHO, give the user  
the option to
change the name of the generated classes (or at least the file names  
for languages that
aren't so anal about what code a file contains...)

cheers,
-k
-- 
Kay Röpke
http://classdump.org/






More information about the antlr-interest mailing list