<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2009/01/3c11c69d244b7b371e09b87b1d569911"
  from="blue storm &lt;bluestorm.dylc@g...&gt;"
  author="blue storm"
  date="2009-01-24T20:34:58"
  subject="Re: [Caml-list] camlp4 compilation model"
  prev="2009/01/a7ff6f96420ea126da027e3f06d95313"
  next="2009/01/4ed490718e7f3fa7b1ab4ad1c56629c6"
  prev-in-thread="2009/01/a7ff6f96420ea126da027e3f06d95313"
  next-in-thread="2009/01/c7f580f7f451eaee61c748f535dfba96"
  prev-thread="2009/01/b8fcc35a4846db219ef26e2404e8ef40"
  next-thread="2009/01/4ed490718e7f3fa7b1ab4ad1c56629c6"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="camlp4 compilation model">
<msg 
  url="2009/01/a7ff6f96420ea126da027e3f06d95313"
  from="Mikkel_FahnÃ¸e_JÃ¸rgensen &lt;mikkel@d...&gt;"
  author="Mikkel_FahnÃ¸e_JÃ¸rgensen"
  date="2009-01-24T20:15:44"
  subject="camlp4 compilation model">
<msg 
  url="2009/01/3c11c69d244b7b371e09b87b1d569911"
  from="blue storm &lt;bluestorm.dylc@g...&gt;"
  author="blue storm"
  date="2009-01-24T20:34:58"
  subject="Re: [Caml-list] camlp4 compilation model">
</msg>
<msg 
  url="2009/01/c7f580f7f451eaee61c748f535dfba96"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2009-01-25T09:49:16"
  subject="Re: [Caml-list] camlp4 compilation model">
<msg 
  url="2009/01/bd37dc0f0cd8d9b3dfd023ecaea9232e"
  from="Mikkel_FahnÃ¸e_JÃ¸rgensen &lt;mikkel@d...&gt;"
  author="Mikkel_FahnÃ¸e_JÃ¸rgensen"
  date="2009-01-25T09:55:50"
  subject="Re: [Caml-list] camlp4 compilation model">
</msg>
</msg>
</msg>
</thread>

<contents>
On 1/24/09, Mikkel Fahnøe Jørgensen &lt;mikkel@dvide.com&gt; wrote:
&gt; a) I understand you can write a cryptic ocaml program that effectively
&gt; builds and AST from whatever grammar you decide by applying camlp4.

Right.

&gt; b) I also understand that camlp4 it has a built in ocaml syntax that
&gt; you can extend, and therefore use as camlp4 as a prepreprocessor to
&gt; the ocaml compiler as part of the build process.

Right. It is actually a bit more modular than that : Camlp4 has
built-in Ocaml AST and quotations (~ syntaxic sugar for AST
constructors in expressions or patterns), and provide a way to extend
any camlp4-defined syntax. OCaml compilers can integrate preprocessors
(not only camlp4, see eg.
http://people.csail.mit.edu/mikelin/ocaml+twt/ ) as a part of the
build process.

&gt; It seems that an enduser program can link with a camlp4 enhanced
&gt; library and magically have its syntax extended without adding camlp4
&gt; to the build process (once the library has been built). For example
&gt; the bitstring library introduces the bitmatch syntax.
&gt;
&gt; Is this correct understood, and how does that work?

I do not think it is correct. IIRC, bitstring needs (when using the
syntaxic extension) camlp4 in the user build process. Richard Jones
may correct me on this though.

&gt; One reason I put camlp4 on hold was precisely that added compilation
&gt; complexity, but if it can be hidden in a library, it is an entirely
&gt; different situation.

I do not know of any way of "hiding" the preprocessing phase.
That said, the build process does not have to be painful. You can use
ocamlfind ( http://projects.camlcity.org/projects/dl/findlib-1.2.1/doc/guide-html/x412.html
), or ocamlbuild, to integrate syntax extensions more easily.

</contents>

</message>

