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.
- For creating parser grammars (Parsing Expression Grammar (PEG)).
- For the specification of the required tokens to be used for parsing (Regular expressions).
- For the description of the required output formats (Reverse PEG).
The parsers and generators are fully attributed, making it easy to build and handle hierarchical data structures in memory. These data structures model the structure of the input data and can directly be used to generate arbitrarily-formatted output.
- Spirit.Classic: Same as Boost Spirit 1.8.x with a special compatibility layer added to ensure backward compatibility.
- Spirit.Qi: Recursive descent parser library.
- Spirit.Lex: Lexical analyzer.
- Spirit.Karma: Output generator.