cpphs-0.2
---------
Cpphs is a re-implementation (in Haskell) of the C pre-processor.
Version 0.1 dealt only with conditional compilation (#if and friends)
and file inclusion (#include). Version 0.2 now also implements the
rest of cpp's functionality, namely in-line symbol replacement and
macro expansion (#define and friends).
I believe this to be a reasonably complete and correct implementation,
and have tested it on some non-trivial examples from the standard
libraries (e.g. Foreign.Storable and HOpenGL). Nevertheless, there
will be bugs and I encourage you to find them and report them.
http://www.cs.york.ac.uk/fp/cpphs/
----
Why re-implement cpp? Rightly or wrongly, the C pre-processor is
widely used in Haskell source code. It enables conditional compilation
for different compilers, different versions of the same compiler,
and different OS platforms. It is also occasionally used for its
macro language, which can enable certain forms of platform-specific
detail-filling, such as the tedious boilerplate generation of instance
definitions and FFI declarations. However, there are two problems
with cpp, aside from the obvious aesthetic ones:
* For some Haskell systems, notably Hugs on Windows, a true cpp
is not available by default.
* Even for the other Haskell systems, the common cpp provided
by the gcc 3.x series is changing subtly in ways that are
incompatible with Haskell's syntax. There have always been
problems with, for instance, string gaps, and prime characters
in identifiers. These problems are only going to get worse.
So, it seemed right to attempt to provide an alternative to cpp,
both more compatible with Haskell, and itself written in Haskell so
that it can be distributed with compilers.
Share and Enjoy,
Malcolm