[antlr-interest] setting k Value Versus Predicates

Gavin Lambert antlr at mirality.co.nz
Sun Feb 14 02:44:04 PST 2010


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.



More information about the antlr-interest mailing list