[antlr-interest] Composite grammar issues

Kumar Rangarajan kumar.r at s7software.com
Mon Apr 20 12:00:30 PDT 2009


> At 03:31 17/04/2009, Kumar Rangarajan wrote:
>> While most things just work out of the box or could be trivially  
>> worked around, one breaking issue is related to the way the lexer  
>> is generated, if the composite grammar defines any lexer rules. I  
>> am using Java code generation, and we see that the contents of the  
>> "header" defined either in the composite file or in the central  
>> lexer file does not get copied to the generated lexer code.
>
> @parser::header {
>  package foo;
> }
> @lexer::header {
>  package foo;
> }

Sorry, missed replying for this reply. Thanks, Gavin for your  
suggestion. But I tried this, but this does seem to work as Antlr does  
seem to allow both @parser::header and @lexer::header sections in the  
composite grammar. By default it seems to treat the grammar as a  
parser grammar and adding '@lexer' triggers an error.

:-)





More information about the antlr-interest mailing list