[antlr-interest] Using previously matched parser rule in decision making

Gokulakannan Somasundaram gokul007 at gmail.com
Tue Mar 9 22:58:52 PST 2010


>
>
>
> java.util.List stack = getRuleInvocationStack(e, getParserName());
>
> But this only works for Java and other targets that copy it (I think C#
> might do it). I don't do it in C because I prefer to take the view that the
> C stuff should be as close to the metal as it can be and the programmer will
> choose to add the overheads they need.
>
>
That makes a lot of sense, but can you tell me how can a C-programmer keep
track of the rules, he will pass through during the LookAhead. I think this
question might be valid for someone using Java Target also. The action, you
are asking to execute can be executed during normal parsing, but if that is
used in Semantic predicates, then we have to be sure that this will get
executed even during the lookahead. Can we create such a facility?

What i mean is a set of actions, if put inside some special construct, will
get executed while executing Syntactic predicates and semantic predicates,
possibly with a rollback action. Please let me know, if i am
misunderstanding the concept somewhere.

Thanks,
Gokul.


More information about the antlr-interest mailing list