[antlr-interest] Understanding lookahead

Terence Parr parrt at cs.usfca.edu
Mon Jun 18 00:35:25 PDT 2007


On Jun 18, 2007, at 5:29 PM, Gavin Lambert wrote:

> At 12:16 18/06/2007, Terence Parr wrote:
> >On Jun 18, 2007, at 9:01 AM, Oliver Zeigermann wrote:
> >> which I was hoping would introduce backtracking which should
> >> have made your example work. Indeed, that option inserted some
> >> code, but IMHO totally meaningless and without effect.
> >>
> >> Maybe this does not work for the lexer?
> >
> >I've never tried it in the lexer...I'd suggest avoiding it even if
> >it works. ;)
>
> Lexer backtracking doesn't appear to work at the moment, but it is  
> currently my #2 most wanted feature :)

Lexer backtracking works no problem.  Just the backtrack=true option  
apparently has a problem.  Use (..)=>

> (I also think that the lexer should backtrack by default even  
> without any options and without having to make the parser backtrack  
> too.  The behaviour of the lexer just makes more sense to me that  
> way.  But I've said that before.)

I think one wants LL(*) by default.  Lexers should be mean and lean  
by default as they are most of the parsing time.

Ter




More information about the antlr-interest mailing list