dcsimg
How to build a .g file that will lead to 2 passes of compile
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   bruno_konik
Posted On:   Wednesday, August 20, 2003 05:11 AM

I would like to know how to build a *single* .g file to build a parser that works in 2 passes. In other words, I would like the g file contains rules that are different whether the pass will be the first one or the second one. I have tried to use semantic predicate but this doesn't seem to work. My goal is to have a rule in the g file that could be "if (parser_first_pass) rule1 if (parser_second_pass) rule2".
Of course, I can use 2 parsers but this leads to 2 .g file which is harder to maintain and I would like to know if I can avoid this.

Thanks for your help.

Re: How to build a .g file that will lead to 2 passes of compile

Posted By:   Monty_Zukowski  
Posted On:   Thursday, August 21, 2003 10:35 AM

You are talking about tree parsers, I hope. I usually use the ANTLR grammar subclassing for that. If you really want it in one file you might want to use some sort of preprocessor before you feed the .g file into antlr.Tool.
About | Sitemap | Contact