Greetings! On Fri, 2010-06-25 at 03:00 +0200, Olivier Lefevre wrote: > Greetings ANTLR experts, > > I have the attached toy grammar for integer arrays of arbitrary > depth but the stat rule has non-LL(*) decision due to recursive > rule invocation. It is recommended to left-factor or to use a > syntactic predicate; in principle I know what both are (I just > reread the applicable sections in the book) but it's been a while > since I last used ANTLR and in this case, with the added twist of > recursion, I still don't get it. Can someone offer a hint?
according to your rules, a stat may be either an array or an expr and an expr may be either an INT or an array. e.g.: stat : array | expr ; expr : INT | array ; remove the array from the stat rule because the expr rule gets us that syntax already. hope this helps... -jbb 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
