[antlr-interest] Antlr vs Spirit

John D. Mitchell johnm-antlr at non.net
Sun Feb 20 04:45:23 PST 2005


>>>>> "Hrvoje" == Hrvoje Nezic <hnezic at SoftHome.net> writes:
> I hope that this subject is not off topic (please excuse me if it is).

Definitely on topic (so far :-).

> A few days ago I had a heated discussion with my colleagues at work about
> parser generators. I use Antlr while some other people use Spirit. It
> seems that Spirit is rather popular in the C++ community.

Yeah, well, given that they like C++, I'll try not to hold that against
them. :-? :-)

> "Spirit is an object oriented recursive descent parser generator
> framework implemented using template meta-programming techniques."  "
> Parser objects are composed through operator overloading and the result
> is a backtracking LL(inf) parser that is capable of parsing rather
> ambiguous grammars. "

The biggest issue that I have is that they are using C++ templates to
attempt to merge grammars with C++-based programming.  Yes, that's an easy
argument relative to using e.g., regexps to do "parsing" in C++.  However,
that mindset misses a key point that the separation of grammar from base
programming language is important -- the argument here is the same as why
it's so important to separate models from views from controllers (example:
StringTemplate, anti-example: JSPs (JavaServer Pages)).


> Antlr documentation or web site mentions other parser generators like
> JavaCC, but it doesn't mention Spirit. Does Spirit bring something new
> regarding computation of lookahead sets (like Antlr's approximate
> lookahead)?

Not that I've seen.  In fact, I didn't see any credit given to the
trailblazer's like Antlr (just mentions as to those being e.g., heavyweight
solutions).

Hope this helps,
		John


More information about the antlr-interest mailing list