[antlr-interest] skipping evaluation of some AST nodes

Mark Volkmann r.mark.volkmann at gmail.com
Tue Nov 27 13:34:40 PST 2007


This is related to an earlier question I asked, but stated in a different way.
Suppose I have part of an AST that looks like this.

^(a b c) { some-action }

So b and c are child nodes of a.
If I match on the expression above then the rules for a, b, and c will
all be processed and their actions will be executed.
What I'd like to do is have "some-action" above be in control of what happens.
It would examine the results of the rule b action and then possibly
decide to not process the rule for c which would avoid executing its
action.
I know I could write the action for rule c to just store information
about what might be executed later, but I'm wondering if there is a
way to avoid that kind of bookkeeping and just specify in the action
for rule c what I want done if "some-action" decides it should be
done.

Is there a way to do this?

-- 
R. Mark Volkmann
Object Computing, Inc.


More information about the antlr-interest mailing list