At 01:10 8/07/2009, Safiye Celik wrote:
>I have a rule and its tree construction such below:
>a : b | c! a c! | a d^ a
[...]
>What should I do to remove left recursion, but also provide the 
>tree I need?

Try this:

a : (b | c! a c!) (d^ a)? ;

Or this:

e : b | c! a c! ;
a : e (d^ e)* ;

(The recursion in the c alt is ok at parse time.  But it might 
make things difficult for you in the tree parser.  Could be 
helpful to insert an imaginary root at that point.)


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-interest@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