[antlr-interest] Lexer.java output in wrong directory

Jim Idle jimi at temporal-wave.com
Sun Sep 13 11:28:10 PDT 2009


On 09/13/2009 10:29 AM, Hilco Wijbenga wrote:
> 2009/9/13 Martijn Reuvers<martijn.reuvers at gmail.com>:
>    
>> Not sure what you want with the import statement in the parser, but I
>> assume you just want to just use the lexer grammar as input for your
>> parser grammar, then you should use:
>>      
> Yep, I'm just trying to break up the grammar into smaller pieces.
>
>    
>> L.g
>>
>> @header {
>>   package x;
>> }
>>
>>
>> X.g:
>>
>> options {
>>     tokenVocab=X;
>> }
>>
>> @header {
>>   package x;
>> }
>>      
> I'm probably not understanding you correctly but I can't get this to
> even compile. I've tried some variations of what you listed above
> ("tokenVocab = L;"; with the import statement and without; with L.g in
> x instead of imports) but none of it works. And in the cases where it
> does output something, the lexer is still in the wrong directory.
>
> Could you spell it out for me? :-) What should L.g say and where
> should it be located? What should X.g say? Did you actually run it?
>    

If your grammar is meant to be in package x, then it should be located 
in sub-directory x under the antlr directory, it will be generated in 
the same directory structure in the target directories. You need all the 
.g files under the x sub directory. Re-read the documentation agian and 
it should be clear.

Jim


More information about the antlr-interest mailing list