[antlr-interest] Changing look ahead depths?

Terence Parr parrt at jguru.com
Thu Feb 6 15:55:04 PST 2003


On Thursday, February 6, 2003, at 02:29 PM, Albert Huh wrote:

> Is it possible to reduce the look ahead depth for specific rules for 
> k>1?
>
> At times I find I only need to look ahead one token, but the parser 
> always tries to look ahead more than that thus generating ambiguities 
> in certain cases.
>
> Any thoughts?  Criticisms?

Howdy there.  The first observation is that if there is a problem at 
say k=4, reducing to k=1 will do nothing to fix a nondeterminism.  More 
is better as they say.  However, if you know it's going to work out 
alright (i.e., ANTLR does the right thing), you could in principle set 
k=1 so that it is slightly more efficient.  This is probably 
negligible, however. :)

Good suggestion.

Ter
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Lecturer in Comp. Sci., University of San Francisco


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list