[Haskell-cafe] parsing c

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Mon Feb 25 03:14:02 EST 2008


On Mon, 2008-02-25 at 03:06 +0100, Bertram Felgenhauer wrote:
> Evan Martin wrote:
> > So two questions: Is there an alternative C-parsing library?  Has
> > anyone looked into librarifying c2hs's parser?
> 
> I have split c2hs into three packages once, the remains of CTK
> that it uses, the C parser and pretty printer, and c2hs itself.
> (I also tried to give the modules more sensible hierarchical names -
> CTK would reside in CTK.* and the C stuff in Language.C.*)
> 
> However, I found the result fairly hard to use, partly due to CTK
> and partly because some aspects of the C ADT that c2hs uses appears
> to be designed for c2hs, not as a general purpose C AST. There's
> also a lot of room for adding new utility functions for inspecting
> the AST.

I'm very happy to see patches to modify c2hs to use a more general C
AST.

> I'm reluctant to publish the split packages because they really don't
> add much value over c2hs and I don't want to create a c2hs fork, or
> duplicate effort that goes into improving that code.

I think it'd be ok to move the C parser into a library and see how it's
api develops as people make use of it. We can port c2hs to use that
library at a later date.

Duncan



More information about the Haskell-Cafe mailing list