[antlr-interest] #include mechanism for grammar files?
Bart Kiers
bkiers at gmail.com
Sun Mar 13 07:37:02 PDT 2011
Hi Jerry,.
On Sun, Mar 13, 2011 at 3:33 PM, g4 at novadsp.com <g4 at novadsp.com> wrote:
> Sorry! Must remember to post plain-text only.
>
> It would be useful to be able to #include a file in a grammar. use case:
> grammar is generated by another tool but the lexer definitions are not.
>
> i.e.
>
> grammar auto
> ...
>
> #include auto_lexer.g
>
> Is there a way to do this with the grammar spread over 2 files?
>
Yes, in ANTLR this is called "composite grammars".
Have a look at: http://www.antlr.org/wiki/display/ANTLR3/Composite+Grammars
Regards,
Bart.
More information about the antlr-interest
mailing list