The preprocessor is a functor:
Since the source code preprocessing job is entirely delegated to Boost.Wave, there is little to say about it. Just read the source code, it's a typical use case.
The syntax analyzer is also a functor:
The syntax analysis is powered by Boost.Spirit Classic.
|Why not Spirit v2?|
When the Scalpel project started, Spirit v2 wasn't stable yet. The (painful) migration just has to be done!
First of all, the syntax analyzer generates a parse tree, using one of the Boost.Spirit's parse functions. This function takes two arguments: the input pure C++ source code and an instance of the
grammar class defines the whole C++ grammar (in the Boost.Spirit's BNF-like format). This is the main submodule of the syntax analyzer (and even one of the biggest pieces of code of Scalpel). It is located in the
scalpel::cpp::detail::syntax_analysis namespace. It's terribly huge. Keep out of reach of children. No kidding.
In order to keep a loose coupling with Boost.Spirit, the Spirit-formatted parse tree is converted into a
syntax_tree object. The set of functions related to this conversion is located in the
syntax_tree object is outputted by the syntax analyzer.
Following the example of the preprocessor and the syntax analyzer, the semantic analyzer is a functor:
The semantic analysis is the most complex part of Scalpel. It is still under development. Consequently, it's not possible for now to write a documentation about it. The best way to understand it is to read the source code and to subscribe to the mailing list.