cpphs is a more liberal re-implementation of cpp, the C pre-processor, in Haskell. The C pre-processor is widely used in Haskell source code, but a true cpp is often unavailable on some systems (such as native Windows), and the common cpp provided by the gcc 3.x series has become more strictly tied to the C language, in subtle ways that are incompatible with Haskell's syntax. This includes problems with, for instance, string gaps, and prime characters in identifiers. This project provides a robust alternative to cpp that is more compatible with Haskell and can be distributed with compilers.
| Tags | Software Development Pre-processors |
|---|---|
| Licenses | LGPL |
| Operating Systems | OS Independent |
| Implementation | Haskell |
Recent releases


Release Notes: This release fixes some more obscure corner cases involving parameterised macro expansion within conditionals. Internal refactoring affecting parts of the library API has been performed.


Release Notes: This release now includes a compatibility script for command line arguments to match the original cpp. There are several minor bugfixes, e.g. quotes around replacements for special macros like __FILE__, etc. Interaction with preprocessors like hsc2hs is also improved: if they allow non-cpp directives like #def, these are now passed through to the output with a warning to stderr, rather than halting with an error. Likewise, a #! line in a shell script is now ignored.


Release Notes: This release fixes a bug introduced by changes in the ghc-6.4 compiler. Output buffers are now explicitly flushed before cpphs terminates.


Release Notes: This release adds the "--text" option to cpphs, allowing it to be used on any free-form text file, so it is no longer tied to the more strict lexical formatting of C or Haskell source code. This means, for instance, that macros are expanded even if they seem to occur inside a comment block, or inside a string.


Release Notes: This release adds support for the special textual replacements __FILE__, __LINE__, __DATE__, and __TIME__.