Chapter 11. Boost.Spirit
Boost.Spirit simplifies the development of parsers because formats are described with rules. Rules define what a format looks like – Boost.Spirit does the rest. You can compare Boost.Spirit to regular expressions, in the sense that it lets you handle complex processes – pattern searching in the case of regular expressions and parsing for Boost.Spirit – without having to write code to implement that process.
There are two versions of Boost.Spirit. The first version is known as Spirit.Classic. This version should not be used anymore. The current version is 2.5.2. This is the version introduced in this chapter.
Besides Spirit.Qi and Spirit.Karma, the library contains a component called Spirit.Lex, which can be used to develop lexers.
If you don’t want to include a master header file like boost/spirit/include/qi.hpp
, you can include header files from individually. It is important to include header files from this directory only. boost/spirit/include/
is the interface to the user. Header files in other directories can change in new library versions.