[antlr-interest] hand-coded v. generated

Ian Kaplan iank at bearcave.com
Sun Sep 9 15:32:00 PDT 2007


  With ANTLR 2.X hand coded lexers were supposed to be faster.  In the past
I've written hand coded lexers, but in retrospect I feel rather silly.  The
lexer is so easy to define in ANTLR and I put in all this work doing a hand
built one.  For many applications the ANTLR built lexer is fine.  This was
definitely true for my application (a graph query language).  When I did the
next version of the query language, I used an ANTLR created lexer and have
not regretted the decision.

  I think that we've all heard that you should not optimize in advance of
need.  We all know this, but at least some of us still do it.  My advice is
use the ANTLR lexer and see if it performs as you need it to.  You can
always plug in a hand created lexer if necessary.

  Ian
  http://www.bearcave.com


On 9/9/07, Gregg Reynolds <dev at mobileink.com> wrote:
>
> Hi,
>
> I recall once seeing somewhere in the Antlr literature a discussion of
> hand-coded v. generated lexers and parsers.  I think it might have
> been written by Terrence, somewhere in the documentation.  I'm having
> trouble finding it now; anybody know it's whereabouts?  Or any other
> clear discussion of the pros/cons of hand-coded v. generated.
>
> Also, is there a search interface to the mailing list archives
> somewhere?  The only ones I've been able to find are old.
>
> Thanks,
>
> gregg
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070909/e4c0688b/attachment.html 


More information about the antlr-interest mailing list