Gavin-- Actually, ANTLR uses the minimum lookahead needed at each decision point so setting k=2 in your example is preferable to using predicates and setting k=1.
With ANTLR 3, the default is k='*' and it is best not to set k. Syntactic predicates are still needed to disambiguate decisions with potentially infinite lookahead (usually due to recursion or looping). --Loring ----- Original Message ---- > From: Gavin Lambert <[email protected]> > To: Gokulakannan Somasundaram <[email protected]>; [email protected] > Sent: Sun, February 14, 2010 2:44:04 AM > Subject: Re: [antlr-interest] setting k Value Versus Predicates > > At 22:59 14/02/2010, Gokulakannan Somasundaram wrote: > >Actually i intended to ask a question, whether there are any > >cases under which i should prefer predicates than increasing > >the value of k. Is it a very obvious one??? > > Your analysis assumes that every rule must contain at least one > ambiguity at k=1. That is not the case. > > If at k=2 you require no predicates, and at k=1 you only need a > few, then k=1 is probably the better choice. If at k=1 you > require lots, then k=2 is probably the better choice. It all > depends on the language you are analysing and your specific rule > layout (how well they are optimised). Some languages are just > inherently ambiguous and thus require larger values for k. > > At the end of the day, though, it's all up to what the benchmarks > say. > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address 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.
