* antiquotations for c#
@ 2009-04-15 8:49 Joel Reymont
2009-04-15 16:45 ` [Caml-list] " Jake Donham
2009-04-16 0:06 ` Alexy Khrabrov
0 siblings, 2 replies; 3+ messages in thread
From: Joel Reymont @ 2009-04-15 8:49 UTC (permalink / raw)
To: O'Caml Mailing List
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?
Thanks, Joel
---
Mac hacker with a performance bent
http://linkedin.com/in/joelreymont
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] antiquotations for c#
2009-04-15 8:49 antiquotations for c# Joel Reymont
@ 2009-04-15 16:45 ` Jake Donham
2009-04-16 0:06 ` Alexy Khrabrov
1 sibling, 0 replies; 3+ messages in thread
From: Jake Donham @ 2009-04-15 16:45 UTC (permalink / raw)
To: O'Caml Mailing List
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] antiquotations for c#
2009-04-15 8:49 antiquotations for c# Joel Reymont
2009-04-15 16:45 ` [Caml-list] " Jake Donham
@ 2009-04-16 0:06 ` Alexy Khrabrov
1 sibling, 0 replies; 3+ messages in thread
From: Alexy Khrabrov @ 2009-04-16 0:06 UTC (permalink / raw)
To: Joel Reymont; +Cc: O'Caml Mailing List
[-- Attachment #1: Type: text/plain, Size: 586 bytes --]
On Wed, Apr 15, 2009 at 4: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?
>
Not quite OCaml, but Haskell got a good one which can be an inspiration:
http://www.haskell.org/haskellwiki/Quasiquotation
-- it was used by Geoff Mainland in implementing Flask (paper in ICFP 2008).
Cheers,
Alexy
[-- Attachment #2: Type: text/html, Size: 1004 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-04-16 0:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-15 8:49 antiquotations for c# Joel Reymont
2009-04-15 16:45 ` [Caml-list] " Jake Donham
2009-04-16 0:06 ` Alexy Khrabrov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox