[Haskell-cafe] More Language.C work for Google's Summer of Code

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Wed Mar 31 04:48:13 EDT 2010

> Malcolm would have to attest to how complete it is w.r.t. say, gcc's
> preprocessor,

cpphs is intended to be as faithful to the CPP standard as possible,  
whilst still retaining the extra flexibility we want in a non-C  
environment, e.g. retaining the operator symbols //, /*, and */.  If  
the behaviour of cpphs does not match gcc -E, then it is either a bug  
(please report it) or an intentional feature.

Real CPP is rather horribly defined as a lexical analyser for C, so  
has a builtin notion of identifier, operator, etc, which is not so  
useful for all the other settings in which we just want to use  
conditional inclusion or macros.  Also, CPP fully intermingles  
conditionals, file inclusion, and macro expansion, whereas cpphs makes  
a strenuous effort to separate those things into logical phases: first  
the conditionals and inclusions, then macro expansion.  This  
separation makes it possible to run only one or other of the phases,  
which can occasionally be useful.

 > One concern is that Language.C is BSD-licensed (and it would be  
nice to keep it that way), and cpphs is LGPL. However, if cpphs  
remained a separate program, producing C + extra stuff as output, and  
the Language.C parser understood the extra stuff, this could  
accomplish what I'm interested in.

As for licensing, yes, cpphs as a standalone binary, is GPL.  The  
library version is LGPL.  One misconception is that a BSD-licensed  
library cannot use an LGPL'd library - of course it can.  You just  
need to ensure that everyone can update the LGPL'd part if they wish.   
And as I always state for all of my tools, if the licence is a problem  
for any user, contact me to negotiate terms.  I'm perfectly willing to  
allow commercial distribution with exemption from some of the GPL  
obligations.  (And I note in passing that other alternatives like gcc  
are also GPL'd.)


More information about the Haskell-Cafe mailing list