cpphs 1.0 review (linux)
cpphs is a liberalised re-implementation of cpp, the C pre-processor, in Haskell. Why re-implement cpp? Rightly or wrongly, the C
|
|
cpphs 1.0 is preprocessors software developed by Malcolm Wallace.
cpphs is a liberalised re-implementation of cpp, the C pre-processor, in Haskell.
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 provide an alternative to cpp, both more compatible with Haskell, and itself written in Haskell so that it can be distributed with compilers.
This version of the C pre-processor is pretty-much feature-complete, and compatible with the -traditional style. It has two main modes:
* conditional compilation only (--nomacro),
* and full macro-expansion (default).
In --nomacro mode, cpphs performs only conditional compilation actions, namely #include's, #if's, and #ifdef's are processed according to text-replacement definitions (both command-line and internal), but no parameterised macro expansion is performed. In full compatibility mode (the default), textual replacements and macro expansions are also processed in the remaining body of non-cpp text.
Working features:
#ifdef simple conditional compilation
#if the full boolean language of defined(), &&, ||, ==, etc.
#elif chained conditionals
#define in-line definitions (text replacements and macros)
#undef in-line revocation of definitions
#include file inclusion
#line line number directives
line continuations within all # directives
/**/ token catenation within a macro definition
## ANSI-style token catenation
# ANSI-style token stringisation
__FILE__ special text replacement for DIY error messages
__LINE__ special text replacement for DIY error messages
__DATE__ special text replacement
__TIME__ special text replacement
Macro expansion is recursive. Redefinition of a macro name does not generate a warning. Macros can be defined on the command-line with -D just like textual replacements. Macro names are permitted to be Haskell identifiers e.g. with the prime ' and backtick ` characters, which is slightly looser than in C, but they still may not include operator symbols.
Numbering of lines in the output is preserved so that any later processor can give meaningful error messages. When a file is #include'd, cpphs inserts #line directives for the same reason. Numbering should be correct even in the presence of line continuations. If you don't want #line directives in the final output, use the --noline option.
Any syntax errors in cpp directives gives a message to stderr and halts the program. Failure to find a #include'd file produces a warning to stderr, but processing continues.
Differences from cpp:
In general, cpphs is based on the -traditional behaviour, not ANSI C, and has the following main differences from the standard cpp.
General
Macro definition language
What's New in This Release:
cpphs 1.0 supports different languages (including english). It works with Linux.
Downloading cpphs 1.0 will take several seconds if you use fast ADSL connection.
Download
- 100mbit/s dedicated server
- 100% availability
Write a cpphs Review
Please register to submit reviews. Registration will grant you access to a number of features and capabilities otherwise unavailable.
cpphs related software
-
cpphs 1.0
cpphs is a liberalised re-implementation of cpp, the C pre-processor, in Haskell. Why re-implement cpp? Rightly or wrongly, the C
-
GNU m4 1.4.8
GNU m4 is an implementation of the traditional Unix macro processor
-
cpp2html 1.0.5
cpp2html uses C code with preprocessor macros as its input, and creates a hypertext view of the preprocessing
-
lhs2tex 1.9
lhs2TeX is a preprocessor to generate LaTeX code from literate Haskell sources. Here are some key features of "lhs2tex": · Differ
-
GPP 2.24
GPP is a general-purpose preprocessor with customizable syntax, suitable for a wide range of preprocessing tasks


