On 3/6/2017 5:45 AM, Niall Douglas via Boost wrote:
Those of you who watch reddit/r/cpp will know I've been working for the past month on a pure Python implementation of a C99 conforming preprocessor. I am pleased to be able to ask for Boost feedback on a fairly high quality implementation:
It would be nice, for the purpose of testing with Boost PP and Boost VMD, if somehow your preprocessor could somehow be plugged in to one of the compilers Boost supports, with VC++ being the most obvious choice because its preprocessor is not C++ standard conforming. There may be some other way of directly creating a toolset with your preprocessor in order to test it in Boost, but I am not knowledgeable enough with Boost Build to know how to do this. If you, or somebody else, could do this it would surely be welcome by me and probably by yourself.
It passes the C11 standard's list of "tricky" preprocessor expansions and the mcpp test suite. It has no issue correctly handling the preprocessor metaprogramming I've thrown at it from my Boost libraries. I'm not going to claim it can handle Boost.Preprocessor or especially Boost.VMD and I've tried neither, but pull requests with source code fixes adding support for those (with accompanying unit tests) would be welcome.
My main use case for writing this is to assemble my header only Boost libraries into a single "drop in and go" file. To that end it has a (still buggy) --passthru mode which passes through #define and #undef plus any #if logic which uses an undefined macro. I'm still working on pass through mode so expect showstopper bugs in that configuration, but as a straight highly standards conforming preprocessor it's ready for others to use and I welcome any feedback. There are a multitude of use cases, everything from running as a conforming preprocessor before invoking MSVC to compile right through to parsing, reflection and introspection of source code.
(and yes it is also a Python library as well as a command line tool, you can find API reference docs at https://ned14.github.io/pcpp/)
I look forward to any feedback and my thanks in advance for it.
Niall