caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: blue storm <bluestorm.dylc@gmail.com>
To: "Mikkel Fahnøe Jørgensen" <mikkel@dvide.com>
Cc: "O'Caml Mailing List" <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] camlp4 compilation model
Date: Sat, 24 Jan 2009 21:34:57 +0100	[thread overview]
Message-ID: <527cf6bc0901241234j6feb859en643fd33049a8f63b@mail.gmail.com> (raw)
In-Reply-To: <caee5ad80901241215kf0b684aj6d70d3337f74ec5c@mail.gmail.com>

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

Right.

> b) I also understand that camlp4 it has a built in ocaml syntax that
> you can extend, and therefore use as camlp4 as a prepreprocessor to
> 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.

> It seems that an enduser program can link with a camlp4 enhanced
> library and magically have its syntax extended without adding camlp4
> to the build process (once the library has been built). For example
> the bitstring library introduces the bitmatch syntax.
>
> 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.

> One reason I put camlp4 on hold was precisely that added compilation
> complexity, but if it can be hidden in a library, it is an entirely
> 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.


  reply	other threads:[~2009-01-24 20:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-24 20:15 Mikkel Fahnøe Jørgensen
2009-01-24 20:34 ` blue storm [this message]
2009-01-25  9:49 ` [Caml-list] " Richard Jones
2009-01-25  9:55   ` Mikkel Fahnøe Jørgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=527cf6bc0901241234j6feb859en643fd33049a8f63b@mail.gmail.com \
    --to=bluestorm.dylc@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=mikkel@dvide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).