Loading ...
Sorry, an error occurred while loading the content.

Re: "ocaml_beginners"::[] camlp4 as a C language preprocessor/macro expander?

Expand Messages
  • Richard Jones
    ... None, because camlp4 doesn t just input and output text. It expects OCaml language as an input, and writes a binary abstract syntax tree corresponding to
    Message 1 of 2 , Jan 7, 2008
    • 0 Attachment
      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 wondering
      > what kind of useful [preprocessing; manipulations; transformations;
      > expansions] of C code are possible with it?

      None, because camlp4 doesn't just input and output text. It expects
      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
      (http://hal.cs.berkeley.edu/cil/).

      Rich.

      --
      Richard Jones
      Red Hat
    Your message has been successfully submitted and would be delivered to recipients shortly.