Boost logo

Boost :

Subject: Re: [boost] [preprocessing] Feedback requested on a C99 preprocessor written in pure universal Python
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2017-03-08 06:08:00


Am 06.03.2017 11:45 vorm. schrieb "Niall Douglas via Boost" <
boost_at_[hidden]>:

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:

https://github.com/ned14/pcpp

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.

I did something very similar to this wave quite a few years back. We dubbed
it partial preprocessing. It's still in use in Phoenix, iirc.
We developed integrations for b2 and later on integrated it into our cmake
build process for HPX.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk