Dec 11

Spirit V2.1 has been released only a couple of weeks ago. The first feedback we have gotten so far was overwhelming! Many people seem to quickly understand the concepts of the new library, being able to apply its power to their needs. We try to follow people’s comments and watch for reported problems. There is one theme recurring over and over again: attributes. This new (for Spirit) concept turns out to be the most difficult idea to understand, especially for somebody starting to work with the library.

See full article here.

Tagged with:
Dec 10

Spirit 2 has undergone lots of revisions from its inception to what you are seeing now. An early beta  release, dubbed Spirit 2 beta, was included as part of Boost 1.39. The adventurous among you started using it as soon as it was released. Spirit 2.1 is essentially the same as Spirit2 beta apart from some cosmetic differences and QOI changes. For the sake of those who started using Spirit from 2.0 beta, here’s what’s changed:

See full article here.

Dec 06

We are trying to get the best possible content to you by regularly publishing articles about different aspects of the new Spirit V2.1 library (released with Boost 1.41). Now we need your feedback! Sure, you already can leave comments, but we thought it might be cool to add the possibility to rate the quality of the articles. So just click the stars at the end of a post to tell us what you think. Moreover, we added thumbs up/down rating for comments. That’s an easy way for you to agree or disagree with other user’s opinions. Use it!

And, by the way, it would be helpful if you rated the older articles as well.

Dec 05

Creating Your Own Generator Component for Spirit.Karma

By Hartmut Kaiser Karma Example Comments Off on Creating Your Own Generator Component for Spirit.Karma

In the good tradition of highlighting Spirits both major sub-libraries based on similar use cases I will talk about Karma today. In a previous installment (see Creating Your Own Parser Component for Spirit.Qi) I presented the steps needed to create a parser terminal. Our topic here is the creation of a new generator directive allowing to group output elements in columns.

See the full article here.

Tagged with:
Dec 02

I am considering writing a series of articles on compiler development using Spirit-2. It will be based on the series of BoostCon talks from 07 to 09. From the humblest calculator to a full blown programming language. Details are still sketchy at this point. All I can ascertain is that the final language shall use LLVM as a back-end. There are lots of questions I need to ask in order to get the bases covered. I’d like to solicit feedback and comments. Will it be an imperative language like C or a functional language like Scheme? I love the line oriented syntax of Python, but is a free format syntax with the all too familiar braces or begin/end blocks be better? Will it be statically typed like C++ or dynamically typed like Python or LISP? Will it be OOP? How complex or simple should it be? Remember, this is meant for instruction. Is a toy language good enough? How about basing it on a simple ISO-standard language like Pascal? Or fun languages like Javascript? How about features? Type inference? Lambda? Operator overloading? Etc., etc., etc.

Let me know what you think…

Nov 27

Generate Escaped String Output Using Spirit.Karma

By Hartmut Kaiser Karma Example Comments Off on Generate Escaped String Output Using Spirit.Karma

This is another article in the series of “How To’s” providing you with shrink wrapped grammars directly usable in any project. I’m going to describe a Karma grammar you can use to generate output for quoted strings, where all contained special characters are properly escaped.

See full article here.

Tagged with:
Nov 26

Spirit V2.1 Compiler Compatibility

By Hartmut Kaiser General Comments Off on Spirit V2.1 Compiler Compatibility

We started to collect the information about what compilers and platforms can be used to compile applications based on Spirit V2.1. Please add any compiler and platform you have been using successfully to compile your Spirit applications.

For a list of known compilers go here.

Tagged with:
Nov 24

On this new page we collect projects and products using Boost.Spirit. This list is not exhaustive as we certainly don’t know about every use. Spirit is a Boost library making it readily available to a large number of developers. If you want your product, in house use, or open source project to be included in this list, please send a note to the Spirit Mailing List or simply add a comment below and we’ll gladly add the info.

See the full list here.

Tagged with:
Nov 20

Creating Your Own Parser Component for Spirit.Qi

By Hartmut Kaiser Qi Example Comments Off on Creating Your Own Parser Component for Spirit.Qi

Several people have been asking the question of how it would be possible to access the current iterator position from a semantic action. Different solutions have been proposed, all of them somehow abusing the predefined Qi directive raw[] which normally exposes as its attribute the pair of iterators pointing to the range in the input stream matched by the embedded parser. I thought this to be a nice incentive to write about how you can create your own parser components.

See full article here.

Tagged with:
Nov 20

A PDF build of the documentation for Boost-1.41 (from John Maddock) is now available here:

Thank you, John!

I extracted and uploaded the Spirit 2.1 documentation here:

Have fun!

P.S. Don’t forget to visit this site every once in a while. We are posting tips, tutorials and addendum. Check out the Articles section.

Tagged with:
Nov 19

Somehow, this did not make it into the 2.1 documentation. This important piece of information shouldn’t languish too far into the abyss. So here it is…

Tagged with:
Nov 19

Why would you want to upgrade to Spirit2 from “Classic” Spirit?

Here’s a teaser:

Spirit 1.x [ straight pattern matching (no actions)  ]
real    0m0.359s
user   0m0.332s
sys     0m0.012s

Spirit 1.x [ parse tree generation ]
real    0m9.305s
user   0m9.209s
sys     0m0.076s

Spirit 2.1 [ AST with variant nodes generation ]
real    0m0.459s
user   0m0.432s
sys     0m0.028s

Check out this short article.

Tagged with:
Nov 19

Champagne to us all 🙂

The much-awaited Spirit 2.1 is now released after more than 2 years in beta (Spirit 2.0). Boost release 1.41.0 includes Spirit 2.1. This is the official release of the new Spirit 2.1, a completely new library for parsing, lexing, and output generation.

Boost release 1.41.0 is now available!

This release contains one new library and numerous bug fixes for existing libraries. For details, including download links, see

The release can also be downloaded directly from SourceForge. See

To install this release on your system, see


–The Boost release team

Tagged with:
Nov 18

Output Generation from a List of Key-Value Pairs Using Spirit.Karma

By Hartmut Kaiser Karma Example Comments Off on Output Generation from a List of Key-Value Pairs Using Spirit.Karma

Even if it feels a bit like cheating I decided to get back to the example highlighting lists of key/value pairs I initially wrote about here. On the other hand looking at this very same problem from the standpoint of generating output allows me to highlight a couple a interesting facilities Spirit provides you with.

See full article here.

Tagged with:
Nov 17

Zero to 60 MPH in 2 seconds!

By Joel de Guzman Qi Example Comments Off on Zero to 60 MPH in 2 seconds!

Wanna make a blazingly fast rule? Use BOOST_AUTO! Check it out here. The code defines a named rule using C++0x auto when available and falls back to some template wizardry on older compilers.

See full article here.

Tagged with:
preload preload preload