On Fri, May 20, 2011 at 9:54 PM, massimiliano.m...@gmail.com <
massimiliano.m...@gmail.com> wrote:

> Hi,
>
> On Fri, May 20, 2011 at 10:55 AM, Bart Kiers <bki...@gmail.com> wrote:
> > targetsExpr
> >   :  category ('CAND' targetsExpr)* -> ^('CAND' category targetsExpr*)
> >   ;
> >
> > is incorrect. You're always using `CAND` in your rewrite rule but that
> rule
> > could just match `category` only.
> > You'll probably want to do:
> >
> > targetsExpr
> >   :  category ('CAND'^ targetsExpr)*
> >   ;
> >
>
> Thank you for your answer! It works now! But I've another question now.
> When I traverse the tree using this function (is there an example to
> have a visitor
> created by antlr?)
>

Yes, this is typically what tree grammars are for. But you can also walk it
manually.
See:

http://www.antlr.org/article/1100569809276/use.tree.grammars.tml
http://www.antlr.org/article/1170602723163/treewalkers.html

Regards,

Bart.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to