caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jake Donham <jake@donham.org>
To: "O'Caml Mailing List" <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] antiquotations for c#
Date: Wed, 15 Apr 2009 09:45:44 -0700	[thread overview]
Message-ID: <c7e4e9f0904150945t2be91052u693d3433a6b40b7f@mail.gmail.com> (raw)
In-Reply-To: <77D9D70A-15A4-400B-9035-D78D4AF85D67@gmail.com>

On Wed, Apr 15, 2009 at 1:49 AM, Joel Reymont <joelr1@gmail.com> wrote:
> Suppose I have a camlp4 parser for C#.
>
> I want to include bits of C# in my code and end up with the AST.
>
> I want to have "holes" in the above AST to plug in values.
>
> I understand that antiquotations take car of filling the holes in the AST,
> any tips on implementing this, though?

Take a look at the trunk of ocamljs, and in particular the jslib
library, which does what you describe for Javascript:

 http://code.google.com/p/ocamljs/source/browse/#svn/trunk/src/jslib

The main thing to know is that you can use the Camlp4 MetaGenerator
module to lift a Javascript (C#) AST value to an OCaml AST value.
There is some other magic that I don't fully understand but was able
to get working by aping the quotation machinery for regular OCaml.

As an example of the use of this library see:

 http://code.google.com/p/ocamljs/source/browse/trunk/src/jscomp/jsgen.ml

Jake


  reply	other threads:[~2009-04-15 16:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-15  8:49 Joel Reymont
2009-04-15 16:45 ` Jake Donham [this message]
2009-04-16  0:06 ` [Caml-list] " Alexy Khrabrov

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=c7e4e9f0904150945t2be91052u693d3433a6b40b7f@mail.gmail.com \
    --to=jake@donham.org \
    --cc=caml-list@yquem.inria.fr \
    /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).