Will, It might be better to step back and ask what it is that you are doing that makes you think you NEED to know this :-) Generally you will produce things in your productions that are either impendent of what they are used for, or are influenced by parameters to the rule, or just return their type (such as an expression). However, you generally produce an AST first, then start to walk the tree to do things like code generate or transform etc.
So, what is your task is possibly the better thing to deal with? Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of William Tribbey > Sent: Friday, August 13, 2010 8:48 AM > To: [email protected] > Subject: [antlr-interest] some advice on tracking location in parser rules > > Hi Everyone, > > As a newbie working through my first real antlr project I find myself > wondering what is the better way to keep track where I have been as I make > my way through the parser rules. > I am using a Java.g file and when I wind up for instance, down in the > statement rule, I would like to be able to figure out how I got there. I have > seen examples in the reference book that use boolean flags and scopes to > do this. Is there a better way? Return values on the rules? > > Thank you, > > Will T. > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your- > email-address List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
