[antlr-interest] How do you implement conditional blocks in tree grammars?
Kurt Otte
kurtotte at gmail.com
Wed Sep 17 16:38:54 PDT 2008
So would the expected model be:
^((CONDITIONAL exp=expression
{($exp.bool)}?=> ^(IF ^(BLOCK statement+) )
{(!$exp.bool)}?=> ^(IF ^(BLOCK .) )
)
So if the expression is true, the statements are processed as
statements, and if the expression is false they are slurped up through
a wildcard?
Do you recommend using a predicate (like shown above) to do the
switching or what is the best plan? Is there a code snippet or
example you could point me to?
Thanks so much for your help and quick responses,
Kurt
On Wed, Sep 17, 2008 at 5:18 PM, Terence Parr <parrt at cs.usfca.edu> wrote:
> Oh,I did that in a tree grammar so it should work for complete
> subtrees. At least, I did that in an interpreter of mine.
> T
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
More information about the antlr-interest
mailing list