[antlr-interest] just one tokentypes file

whaefelinger ora.et.labora at web.de
Mon Oct 18 11:42:47 PDT 2004



Hello Members,

I'm bit playing around with (export|import)Vocab and this raised a 
question:

Having a lexer, parser and treewalker in one file and compiling it 
with antlr (2.7.4) I will get just one 'token type' file. For example

 === calc.g ===
 class CalcLexer extends Lexer;
 class CalcParser extends Parser;
 class CalcTreeWalker extends TreeWalker;
 ==============

will yield to file CalcParserTokenTypes.txt (and *.java). I was 
wondering now how I can simulate this behaviour using options 
importVocab and exportVocab having lexer, parser and tree walker 
each in a different file?

In order to do so I would need to formulate something like 

 options {
   exportVocab=CalcParser;
   importVocab=CalcParser;
 }

but when doing so antlr reports and error. 

I understand somehow antlr's problem. 'exportVocab' would rewrite 
the file CalcParserTokenTypes.txt and if then an import is done from 
the very same file, nothing new is gained.

However, I believe that this problem can be avoided by importing 
first and then afterwords do the export. This must be the very same 
as antlr is doing if all three grammars are in the same file (except 
that 'import vocabulary' is taken from memory).   

Some comments on this?

Best wishes,
Wolfgang.







 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

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





More information about the antlr-interest mailing list