[antlr-interest] Lexer Performance

Ric Klaren ric.klaren at gmail.com
Mon Jan 17 04:01:22 PST 2005

On Sun, 16 Jan 2005 18:41:06 -0800 (PST), Matthew Tedder
<teddemc at yahoo.com> wrote:
> Question: My understanding (correct me if I am wrong),
> is that antlr does not the the table method for
> lexical analysis, but just a simple serial processing
> method.


> Is there any plan on changing this down the road?  I'd
> be still working with flex/bison, if only bison would
> offer reasonable C++ support.  The thing that brought
> me to antlr was C++ support, and possibly easy to
> create working grammars.  Being seemingly java-centric
> worried me enough about performance...

ANTLR2 does not generate the speediest parsers/scanners. It's easy
though to use a flex scanner with antlr2. ANTLR provides some extra's
over flex/bison in terms of ease and error handling. Also antlr
parsers are very debuggable due to the fact that they're readable.
ANTLR2 performance relies for a lot on how you structure your grammar
(use of syntactic predicates, that introduce backtracking).

In general flex/bison will be faster than antlr2. ANTLR3 is in
prototype stage and will be a lot faster, the hope is to release
ANTLR3 within a year. ANTLR3 might be faster than flex/bison. ANTLR3
will also give much more ease in developing grammars (thanks to the
new LL(*) algorithm and intended tool support).

> I am trying to do contract management--processing
> contract terms over millions of financial transaction
> records..

It is possible to get good performance with ANTLR2 but it might
require some tinkering with the support lib. And it also depends on
what you want/need in the backend.



More information about the antlr-interest mailing list