[antlr-interest] Re: Local lookahead depth

lgcraymer lgc at mail1.jpl.nasa.gov
Fri Nov 7 11:00:43 PST 2003


Oliver--

ANTLR is actually quite a bit smarter about lookahead--k is maximum lookahead, and ANTLR generates minimum lookahead.  If you 
set k=20 but don't need more than k=2, then 2 is the maximum lookahead in the generated code.  I think that Sriram put local 
lookahead into JavaCC as a workaround--it does add a step to grammar debugging that is not necessary for ANTLR.

Also, as to actions in lookahead code:  this is something that Ter supported in PCCTS under the name "guarded predicates" or some 
such.  I don't know that it saw much use, and I suspect that usage indicates a too early incorporation of semantic information into the 
translator--tree transformation helps avoid that.

LLK is interesting, but it is a synthesis of implementation approaches from a number of sources (ANTLR, JavaCC, flex) and not an 
extension to the state of the art.  I think that's why Leung describes it as an ANTLR 2.7.2 derivative despite what seems to be the 
complete absence of any ANTLR 2.7.2 source code in the distribution.  It is also a work in progress.

--Loring

--- In antlr-interest at yahoogroups.com, Oliver Zeigermann <oliver at z...> wrote:
> Another nice feature of LLK
> 
> http://llk.sourceforge.net
> 
> is that it allows to specify lookahead depth locally per block. This 
> allows for more efficient parsing as only for the rules that need deep 
> lookahead this code is generated.
> 
> Also nice!
> 
> Oliver
> 
> Oliver Zeigermann wrote:
> > Hi,
> > 
> > there is a nice feature in LLK
> > 
> > http://llk.sourceforge.net
> > 
> > that allows certain semantic actions to be executed even when guessing 
> > in syntactic predicates. This allows for a wider range of parseable 
> > languages as you can query results of these actions in semantic predicates.
> > 
> > I have a modification of ANTLR that does this as well running fine and 
> > would like to discuss if this would be a nice feature for future ANTLR 
> > version.
> > 
> > Cheers,
> > 
> > Oliver


 

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




More information about the antlr-interest mailing list