[antlr-interest] ANTLR Kudos...

Jim Idle jimi at temporal-wave.com
Thu Aug 14 15:26:22 PDT 2008


On Fri, 2008-08-15 at 09:48 +1200, Gavin Lambert wrote:

> At 15:04 14/08/2008, Ian Kaplan wrote:
> >   I do have a couple of worries.  One is performance.  In my 
> > case, unless performance is really terrible should not be too be 
> > a problem since the language I'm working on is a graph database 
> > query language and the queries are never going to be that big 
> > compared to, say, Java or C++ code.  Another worry I have is 
> > about the backtracking.  I admit that I have not RTFM (e.g., the 
> > last chapters of The Book that deal with this topic).  My hope 
> > is that the match tries to match the longest sequence first, so 
> > that a match is not missed.
> 
> In most cases v3 performance is significantly superior to v2 
> performance, since v3 does less copying of token text.
> 
> And AFAIK backtracking is done in the order that the alternatives 
> are listed, so it's not necessarily longest-match-wins.


Basically, if you are at all concerned about performance, you should
never turn on global backtracking. It is more for prototyping or for the
case where readability is more useful than speed. The only time I have
used it was fora VBScript parser. The language is intended to be
interpreted (badly) and so backtracking becomes a better option than a
predicate for almost every construct anyway. However, it is no
substitute for left factoring.

JIm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080814/258d5df8/attachment.html 


More information about the antlr-interest mailing list