At 23:13 1/10/2009, Naveen Chawla wrote:
>       complement: indirectObject? object;
>
>       indirectObject :  nounPhrase;
>
>       object : nounPhrase;
>
>       nounPhrase : 'the' adjectivePhrase? 'noun';
>
>      adjectivePhrase : '<Ving>' complement?;
>
>gives
>
>"error(211): predicate.g:7:14: [fatal] rule complement has 
>non-LL(*) decision due to recursive rule invocations reachable 
>from alts 1,2.  Resolve by left-factoring or using syntactic 
>predicates or using backtrack=true option."

The problem with this is that at the left edge of complement, it 
needs to evaluate whether indirectObject is present or not.  To do 
that, it attempts to match a nounPhrase, which will attempt to 
match an adjectivePhrase, which brings it right back to the left 
edge of complement -- and since that's optional too, it has to 
continue scanning forward into a death spiral.

As written here, you should be able to fix it by switching the 
optionality in the complement rule:
   complement: object object?;

I suspect that in your real grammar the indirectObject and object 
rules aren't actually equivalent though, so this may not help 
much. :)


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