[antlr-interest] Problem using += operator in actions

Terence Parr parrt at cs.usfca.edu
Tue Apr 17 09:50:58 PDT 2007


On Apr 17, 2007, at 6:41 AM, Miguel Ping wrote:

> I guess antlr is a little obscure on the syntax.

Only if you don't have the definition. ;)  There are some bugs /  
stuff to fix like the precedence of += as Martin discovered (I'll  
respond separately).


> I had some trouble
> with trees and with actions order. For instance, I tried to do this:
>
> rule: partA pb=partB? partC -> ^(partA ^($pb? ) partC )

^(foo) makes no sense.  A tree with a root and no children is exactly  
the root.  ^(foo?) is same as foo?  makes no sense to have an  
optional root anyway.

> I also got some trouble with synpreds => and parenthesis, with members
> order (the lexer at member:: and parser at member stuff), and with tree
> rewrite rules. I guess all of us eventually figure a way to solve
> things, and it ends up in our common sense, instead of maybe being in
> the wiki ;)
>
> Maybe we can gather this common mistakes, and make a "check this
> before going nuts" page or so...

A lot of it is just stuff to clean up or simply learnign the rules.

Ter



More information about the antlr-interest mailing list