[antlr-interest] calling parser from lexer when using separat
e files
mzukowski at yci.com
mzukowski at yci.com
Mon Oct 21 07:48:32 PDT 2002
It would be better to call a new parser from the parser instead of the
lexer. Lexers only return tokens, not trees.
Alternatively you could call a new lexer from your lexer. That would be the
normal way to handle C style #includes which are just a preprocessing step
anyway.
Monty
> -----Original Message-----
> From: shemanthk [mailto:shemanthk at yahoo.com]
> Sent: Sunday, October 20, 2002 8:41 PM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] calling parser from lexer when
> using separate
> files
>
>
> hi all,
> I am trying to use separate .g files for my lexer and parser by
> exporting the vocabulary from the lexer and importing the same in my
> parser. This works perfectly fine.
> But in case of my parser, during use of #includes in my program, i
> need to call the parser from the lexer, is there a way to do this. I
> am unable to do this right now because the lex.g file is being
> compiled first and it does not have any information about the parser
> object that i am trying to use.
>
> could some one help me on this.
>
> sample code
> -----------
> within my lex.g i am trying to do the following
>
> Myparser *parser = new Myparser();
> parser->parserule();
>
>
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list