[antlr-interest] Is tokenVocab an Option for Parser Grammars?

Terence Parr parrt at cs.usfca.edu
Sat Aug 9 12:56:17 PDT 2008


On Aug 9, 2008, at 6:01 AM, Johannes Luber wrote:

>>> Of course this all works if I copy the lexer rules to the parser.   
>>> Is this the correct syntax?
>> Yes, it is the correct syntax and I verified that it works on b2 on  
>> my local machine. Are you generating the lexer first and is it in  
>> the same directory as the parser? What error message are you  
>> getting? Your parser grammar name needs to be the same as the file  
>> name by the way.
>
> It should be mentioned that the tokenVocab-option requires the use  
> of the tokens file, which must be in the same directory as the  
> grammar which uses the tokenVocab-option. There is -o option for  
> ANTLR which moves all the output files into another directory,  
> included the generated source code files. If that doesn't work for  
> you and you don't want merge the directories containing the grammar  
> files, you have to include a file copy in your build setup.

I think ANTLR looks in -lib too for .tokens files.
Ter


More information about the antlr-interest mailing list