[antlr-interest] RE: Does tree parser have to export its own token types?

mzukowski at yci.com mzukowski at yci.com
Wed Nov 20 07:49:34 PST 2002


The parser generator is naive and always writes a XXXTokenTypes for a .g
file whether it is necessary or not.

Monty

-----Original Message-----
From: Daniel Gackle [mailto:gackle at shaw.ca]
Sent: Tuesday, November 19, 2002 10:36 PM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] RE: Does tree parser have to export its own
token types?


Ack.  I just had the novel idea of checking the documentation
and found a partial answer in the "Token Vocabularies" section.
I now understand that if I put my tree parser, parser and lexer
all in the same file and give them all an "exportVocab = XXX"
option, only one XXXTokenTypes will be generated.

But what if I want them in separate files?  It seems that
importVocab lets you make sure that one grammar has access
to another's tokens, but there's no easy way to stop it
from exporting them to its own token space.  Is that correct?

To reiterate, in my case the new grammar isn't defining any
tokens of its own, so for it to export its own personalized
token space is superfluous.

- Daniel


-----Original Message-----
From: Daniel Gackle [mailto:gackle at shaw.ca]
Sent: Tuesday, November 19, 2002 11:13 PM
To: antlr-interest at yahoogroups.com
Subject: Does tree parser have to export its own token types?


Couldn't find an answer in the archives or FAQ, though it seems like an
obvious question.  I have a XXXParser which exports vocabulary XXX yielding
XXXTokenTypes.  I then define a tree parser XXXTreeParser and tell it to
import vocabulary XXX.  This works fine, but XXXTreeParser insists on
generating and using its own XXXTreeParserTokenTypes.  This is the exact
same set of tokens and it seems like needless duplication.  My questions:

(1) Is there a way to get the tree parser to simply reuse XXXTokenTypes?
(2) If not, is there some reason why the second token types class is
necessary?

Thanks,
Daniel




 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list