Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2003-11-05 18:49:30


Geoff Leyland <gley001_at_[hidden]> wrote:

> *Here's a Spirit question. In spirit, can I easily define a "small"
> parser than someone can then embed without much fuss in a larger
> parser? Specifically, if I write a unit expression parser, can I then
> use it as a small part of a parser for a language that involves units
> without a lot of mucking around? This wasn't really possible in ANTLR.

Yes. Spirit parsers are modular and you can build a parser on top
of other smaller parsers. That's one of the design highlights of Spirit.
You can even use inheritance (from an abstract grammar) and
parametric polymorphism (templatized grammars) to reuse and
parameterize generic grammars from a grammar library. Perhaps
someday, there will be a spirit-standard lib. With such a library, we
wouldn't have to write yet another expression parser, but rather just
build one from existing parts.

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk