[antlr-interest] Rewriting to Flat Tree Nodes for Associative Multiary Operators
Jim Idle
jimi at temporal-wave.com
Thu Oct 2 14:33:41 PDT 2008
On Thu, 2008-10-02 at 14:29 -0700, Jim Idle wrote:
> On Thu, 2008-10-02 at 14:23 -0700, Randall R Schulz wrote:
>
> > Hi,
> >
> > Next question.
> >
> > (I've been spoiled by working mostly with strictly prefix languages in
> > the past...)
> >
> >
> > How might I alter a rule such as this one:
> >
> > op790Formula
> > : (op780Formula -> op780Formula)
> > (
> > Or rDisjunct = op790Formula
> > -> ^(Or $op790Formula $rDisjunct)
> > ) ?
> > ;
>
>
> Have you tried:
>
>
> o : v1=nextrule
> (
> (Or v2+=nextrule )+ ->^(OR $v1 $v2+)
> | // No OR's, default tree
> )
> ;
>
>
> Or something similar?
I should add that this won't be as useful a tree for processing unless
this is a translator and you want to spit this stuff out in that kind of
arrangement.
Jim
>
> Jim
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081002/461fb402/attachment.html
More information about the antlr-interest
mailing list