Can't rollback as it isn't a database and track state isn't really the right
thing to be doing here (nor is tracing what rule you came through to influence
parsing really, though scopes are better).
{{ action executes even if in synpred/backtrack }}
Jim
From: Gokulakannan Somasundaram [mailto:[email protected]]
Sent: Tuesday, March 09, 2010 10:59 PM
To: Jim Idle
Cc: [email protected]
Subject: Re: [antlr-interest] Using previously matched parser rule in decision
making
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.
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.