- Spirit Parser Framework
The Spirit Parser Framework is an
object oriented recursive descentparser generator framework implemented using templatemetaprogramming techniques. Expression templates allow users to approximate the syntax ofExtended Backus Naur Form (EBNF) completely inC++ . Parser objects are composed throughoperator overloading and the result is a backtracking LL(∞) parser that is capable of parsing rather ambiguous grammars.Spirit can be used for both lexing and parsing, together or separately.
This framework is part of the Boost libraries.
Operators
Because of limitations of the C++ language, the syntax of Spirit has been designed around the operator precedences of C++, while bearing resemblance to both EBNF and
regular expressions .Example
Of course, there are better algorithms suited for string searching,but this example gives an idea how to construct rules and attachactions to them.
External links
* [http://spirit.sourceforge.net Spirit parser framework SourceForge page]
* [http://www.boost.org/libs/spirit/index.html Documentation in the Boost project]
* [http://www.ddj.com/article/printableArticle.jhtml?articleID=184401692&dept_url=/cpp/ Review on Dr. Dobb's Journal]
Wikimedia Foundation. 2010.