Welcome to Spirit
Spirit is a set of C++ libraries for parsing and output generation
implemented as Domain Specific Embedded Languages (DSEL) using
Expression templates and Template Meta-Programming. The Spirit
libraries enable a target grammar to be written exclusively in C++.
Inline grammar specifications can mix freely with other C++ code and,
thanks to the generative power of C++ templates, are immediately executable.
Spirit is part of Boost Libraries, a
peer-reviewed, open collaborative development effort.
Jul ’11 12
Spirit V2.5 is now available as part of the recently released Boost V1.47. I suggest you look at the What’s New documentation page for a list of things changed. This is a very important release for Spirit, mostly in the area of feature consolidation and less so by adding new functionality. It brings a lot of unification and quite some speedup in the area of attribute handling, both for parsers (Qi) and generators (Karma). Most of the newly added features are in the area of unification of the overall user experience as well. The things added to the Lexer should finally resolve some long standing requests. Most importantly, we are very excited about having added full compatibility with the newly released Phoenix V3 library.
Generally, all changes are supposed to be fully backwards compatible. If you run into problems with your existing code, please tell us by leaving a comment or by sending a message to the Spirit mailing list (as described on our Support page).
Jan ’10 25
Starting with Spirit V2 we added a module for generating code aimed at the lexical analysis of the input: Spirit.Lex (a lexer module, also called scanner). Lexical analysis is the process of preprocessing the stream of input characters and separating it into strings called tokens, most of the time delimited by whitespace. Most compiler texts start here, and devote several chapters to discussing various ways to build scanners. Spirit.Lex is a library built to take care of the complexities of creating a lexer for your grammar.
We know the documentation of Spirit.Lex is not complete yet. So I will write more about it here from now on to fill in the missing pieces and to show a couple of tricks demonstrating its best usage.
Continue reading »