[antlr-interest] Rewriting to Flat Tree Nodes for Associative Multiary Operators

Jim Idle jimi at temporal-wave.com
Thu Oct 2 14:53:44 PDT 2008


On Thu, 2008-10-02 at 14:48 -0700, Randall R Schulz wrote:

> On Thursday 02 October 2008 14:33, Jim Idle wrote:
> > ...
> >
> > 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
> 
> Well, in fact I am just writing a transliterator, and since AND and OR 
> are each associative-commutative, and since the target language does 
> support them as multiary connectives, it's all perfectly fine.
> 
> It's perhaps worth mentioning, though certainly tangential, that at 
> least in certain circles of logic and theorem proving, the generalized 
> form of AND and OR are assumed 


Yep - I know all about that stuff, believe me ;-). However when walking
an AST other representations can still be useful.

> (and that includes nullary and unary 
> forms, as well as those with more than two subformulas) and so the 
> strictly binary form is _not_ the most useful one for the kind of 
> processing that I have to do.


However, more importantly, so that markmail has an answer for the
future, did that construct give you what you needed? ;-)

Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081002/4cc179f8/attachment.html 


More information about the antlr-interest mailing list