[antlr-interest] Antlr vs Spirit

Stuart Dootson stuart.dootson at gmail.com
Mon Feb 21 00:16:34 PST 2005


I've used both Spirit and Antlr in anger...

My feeling is that I'd prefer to use Spirit for smaller (rather than
larger) parsing applications (for example, parsing a log file rather
than a source file). This is mainly because a) compile times can get
quite large, and b) I always have this nagging feeling in the back of
my mind that my compiler will raise an internal compiler error if I
add too many more grammar rules :-) (this is mainly because I've used
Visual C++ 6 too much - I use VC++ 7.1 now, which is a lot better in
this respect). Another point is that you need to be using a relatively
modern compiler (GCC 3.3+, VC7.1+, something like that).

The main problem I have with Spirit is that there is no separate lexer
- this complicates grammar design as you have to think about
tokenisation in the same space as the grammar.

The main features I like about Spirit are closure support, ease of
integration with C++ projects and extensibility.

BTW - Spirit *does* support trees - tree construction at least - see
http://www.boost.org/libs/spirit/doc/trees.html.

So, in conclusion - I may use Spirit for small parsing tasks, but I'll
stick with Antlr for larger tasks. If I had to implement an Ada parser
(for example - it's something I've done before), I'd break out Antlr.
Also - if I were advising a parsing newbie (not theoretical - I'm
doing that at the moment), I'd get them to start with Antlr. Spirit
requires more background knowledge of things not related to parsing
than Antlr.

Stuart Dootson


More information about the antlr-interest mailing list