[Haskell-cafe] Module for parsing C (pre-processed header files only)?

Don Stewart dons at galois.com
Wed Apr 16 11:01:59 EDT 2008


magnus:
>    Is there such a beast out there?
> 
>    If this were a list on some OO language I'd ask for something that created
>    an AST and then offered an API based around a visitor pattern.
> 
>    The pre-processor (platform specific most likely, but could be cpphs of
>    course) would be run prior to the tool I'm considering writing.  After
>    that I only need access to declarations of C functions and definitions of
>    types (structs, enums, other typedefs).
> 
>    I had a quick look at the code in c2hs yesterday, but found it a little
>    hard to make heads or tails of it without some guidance, so I couldn't
>    tell whether it would be suitable.  Would it?
> 
>    Any help or pointers appreciated.

I think the main option for parsing C now is the c2hs parser -- there's
a summer of code project to wrap it up as a suitable C manipulation,
printing and parsing library, so we should see a good standalone
solution in a few months.

-- Don


More information about the Haskell-Cafe mailing list