Apr 16

The keyword parser construct has recently been added to spirit’s repository (available in 1.47 or from svn) . Here’s a small introduction to help you get started using the keyword parsers.

Those of you familiar with the Nabialek trick will recognize it’s working under the hood. What you can achieve with the keywords parser can also be achieved with the Nabialek trick but not always as elegantly or as efficiently.

Continue reading »

Mar 18

Somewhere over the past days we crossed a major milestone with Spirit’s website. Granted, it went by unnoticed, but we celebrated our 300,000 visitor since the launch of the new website in November 2009! As you can see from the Google analytics plot below, the average number of daily visitors stayed pretty constant over the last year, showing a slight increase lately.

I find it to be very encouraging that the average time people spend on the Spirit site is over 6 minutes. Compared to other websites (even purely technical ones), this number is huge. It is an indication that the contents we try to provide are useful and interesting to our visitors.


Continue reading »

Mar 06

We (the spirit developers) are obviously advocates of FP (functional programming). We use as much FP as we can in the design of Spirit. Spirit is essentially a parser-combinator library in the likes of Haskell parser libraries such as Parsec. The similarities end however in how we deal with imperative constructs that are taboos in the FP world.

Read more here: Attributes: Functional vs Side-effects

Frank Dellaert
Feb 28

When using expectation points, a parsing failure results in an exception that generically indicates the failure, but probably doesn’t explain the problem in the most meaningful way. It is possible to attach an error handler to react to the failed match in a more specialized way:

Continue reading »

Feb 26

Frank Dellaert was asking a valid question on the Spirit mailing list where he pointed out some things he was not able to understand. His question clearly uncovered an inconsistency in Spirit’s API. This lead us to implement some minor additional feature, which in the end turned out to make more uniform the way semantic actions are handled.

Continue reading »

Tagged with:
Feb 12

Narinder Claire asked a seemingly innocent question on the Spirit mailing list the other day. After starting to write an answer I realized that this question is not innocent at all as it touches the very fabric of Spirit: the rules of attribute handling. Many people have a hard time to properly understand what is going on in the nether regions of Spirit. More importantly, they have a hard time to understand why is Spirit implemented the way it is.

The new article Attribute Propagation and Attribute Compatibility not only answers Narinders questions but tries to explain those important concepts in more detail.

Tagged with:
Jan 19

You might have wondered where do all those names like Spirit, Qi, or Karma come from? Well, Joachim Faulhaber gave the explanation on the Boost mailing list yesterday:

because xpressive names have a better spirit, bring qi to your software and will enhance your karma so they can heal your (con)fusion and make you wave like a phoenix from the ashes.

This is simply brilliant and I thought to share it with you! Smile

Dec 24

The year 2010 will soon come to an end. This is reason enough to look at the statistics collected for our website and to publish a list of the most popular posts and articles. I will use the number of hits as a metric of popularity. But first a couple of overall statistics.

  • To date, we have had 203,233 page views on this website, that’s an average of 569 a day. If you add the documentation, we saw an overall number of page views of 1,289,260, amounting to an daily average of 3,611! Simply amazing!
  • The most visitors came from the U.S.A. (53,237 visits, 313,566 page views), followed by Germany (27,391 visits, 154,759 page views), Russia (15,509 visits, 79,406 page views), France (15,436 visits, 89,528 page views), and United Kingdom (14,615 visits, 90,467 page views).
  • We deleted 15,147 spam comments, where the spam is growing at an ever increasing speed. Hah, the spam bots are getting to know Spirit‘s website! That’s actually good news.

Thanks to everybody for your support!

Overall, we published 33 new posts. Here are the most popular ones:

I’m very happy to see that the articles showing how to use Spirit for specific tasks draw a lot of attention. You might want to get back to those and re-read them (and all the others as well).

Last but not least, on behalf of Joel and myself, let me express our gratitude for all the support we received over the last year. We have a lot of ideas how to improve Spirit and we will continue to need your help in the future. Stay tuned!

Merry Christmas and a Happy New Year to you all!

Dec 03

These are links to the slides and video of Michael Caisse’s BoostCon 2010 talk:

slides: <http://www.objectmodelingdesigns.com/boostcon10/>
video: <http://blip.tv/file/4143337 >


Machinery, sensors, equipment, client/server communications, even file formats… Parsing and producing communication streams is everywhere you look. Often these tasks are simple or small enough to tempt ad-hoc solutions. The Spirit 2.1 library provides a model that is simple enough to tackle those “quick hacks” and easily scales for full-featured AST generation.

This session will explore real-life experiences with the parser and generator (Qi/Karma) portions of the Spirit library. As we look at various small and medium-sized parsers/generators employed in various products we will establish some “rules-of-thumb” and guidelines for tackling the parser/generator domain with Qi/Karma. The session will end with the implementation of a usable XML parser and a simplified XPath-like node extractor.

The session will include some lecture and a lot of tutorial. Attendees will walk away with the knowledge and tools to begin parsing and generating with Spirit Qi/Karma.

—Michael Caisse

Tagged with:
Nov 13

Jeroen Habraken (a.k.a VeXocide) sent an article about parsing escaped strings using Qi, which we happily publish for everybody to read. Thanks Jeroen!

Continue reading here.

Tagged with:
Nov 07

The Spirit mailing list is still the place where active discussion takes place. I will be posting some excerpts from the mailing list here every once in a while. Here’s an interesting post from Leo Goodstadt:
Are Qi parsers thread-safe?

The answer of course is yes

I have been trying to speed up some parsing code going through around 25 GB of data. This had been taking up 6 hours using Python code. Re-writing it using Qi had taken it down to 4 minutes. And finally, with the help of Intel Threading Building Blocks, I am down to 37 seconds or a > 500x speedup!
Continue reading »

Tagged with:
Oct 14

Care about how Spirit got started? Here’s a link to our BoostCon 2010 presentation:


This year, we celebrate Spirit’s 10th anniversary from its early beginnings as an offshoot from a much larger GUI library in the 90s and debuted into Boost in May 2001 in the typical “Is there interest in this library?” fashion like all would be Boost libraries. From a humble 7 header file library, Spirit has grown to be one of the most sophisticated Boost libraries and along the way became the incubator of other Boost libraries such as Boost.Fusion, Boost.Phoenix, and Boost.Wave and played a significant role for Boost.Proto getting mature.
We would like to present Spirit (and the libraries it inspired) in a historical perspective. The presentation will aim to provide a lighter, more intimate perspective into the development of at least 4 libraries with almost a decade’s worth of experience being Boost authors and bonafide crazy template metaprogrammers who abuse operators like Mad Scientists. Of course, we can’t help it if we show off some C++ tricks here and there, but we’ll try to keep it as light as we can.

Tagged with:
Jul 23

Thomas Heller has just completed the Phoenix Proto port. Another successful GSOC project!

I’ve been mentoring for GSOC for a couple of years now. This one is the best (the Fusion 0x project of last year’s GSOC was also highly successful, but it was Hartmut Kaiser who mentored that). Thomas is an amazing student! A++, if there’s such a thing.

Continue reading »

Jun 23

We have a new page enumerating the best practices for using Spirit. Right now, there’s only one entry (update: there may be more by the time you read this), but as time goes by, we will be filling this page with more. If you have a short Spirit tip to share, this is the page. Add a comment and we’ll incorporate them.

See the “Best Practices” page here.

Jun 18

Spirit-shirt frontAwesomeness…

Michael Caisse of Object Modeling Designs designed this cool Spirit inspired T-shirt. I love it so much. If you like Spirit as much as we do, you can get one from Michael here: http://objectmodelingdesigns.com/swag.html

preload preload preload