Remember: it's just C++ classes.
So,
- you can split your assets into TUs anywhich way you like.
- AFAICT on_error and debug attach to their subject rules by reference, so you can put them wherever
yes, you can have classes act as "dumb" containers of rules. In fact, if your iterator/skipper doesn't vary, you could just use namespaces:
//header namespace G1 { extern const qi::rule<It, attr()> R1; } //cpp namespace G1 { const qi::rule<It, attr()> R1 = qi::eps /* ... */; }
I think this approach is largely taken with Spirit X3 (?)
favour composition over inheritance (gives your compiler more freedom)
- disable debug information (
-g0
) - Try optimizing for size
-Os
or no optimization (-O0
) Disable costly features:
BOOST_SPIRIT_DEBUG
- Use
BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
- Avoid semantic actions
Also, pimpl/file-static anonymous namespaces are there in case you wish to hide all of spirit from your public interface.