Re: "ocaml_beginners":: camlp4 as a C language preprocessor/macro expander?
- On Mon, Jan 07, 2008 at 05:03:23AM -0000, tenuc70 wrote:
> Camlp4 is much more advanced than either cpp or m4 and I was wonderingNone, because camlp4 doesn't just input and output text. It expects
> what kind of useful [preprocessing; manipulations; transformations;
> expansions] of C code are possible with it?
OCaml language as an input, and writes a binary abstract syntax tree
corresponding to the transformed code as output.
You can change the input syntax expected by camlp4, although it would
be an enormous amount of work to change it to expect C syntax, perhaps
not even possible. You can also change the output of camlp4, but
again you'd need to write a camlp4 printer which could write C, which
would be a great deal of work.
For general processing of C code, take a look at CIL