[antlr-interest] question about using '+=' label

hao sun smouse.cas at gmail.com
Wed Oct 10 20:29:58 PDT 2007


Hello guys. It's the first time I use ANTLR. It helps me making my parser
easily. But now I have a problem.

When I built my AST, I made my rewrite rule like:
expr: type ID ( ',' ID)* -> ^( type ID*)
Then, now, I want to write a tree grammar to collect all the IDs into a
list. If I write the tree grammar like:
expr: ^( type ids+=ID*) { ...use ids...}
a error message that I should add the output option will be emit. So is
there anyone has an idea about how to make "+=" label work in a tree
grammar? or any good idea about how to collect all the ID nodes? Please tell
me, thank you !!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071011/3001d4cb/attachment.html 


More information about the antlr-interest mailing list