caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>
To: Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Possible use for camlp4
Date: Thu, 30 May 2002 10:15:06 +0200	[thread overview]
Message-ID: <20020530101506.B28827@verdot.inria.fr> (raw)
In-Reply-To: <3CF52B1F.2050004@ozemail.com.au>; from skaller@ozemail.com.au on Thu, May 30, 2002 at 05:25:19AM +1000

Hi,

On Thu, May 30, 2002 at 05:25:19AM +1000, John Max Skaller wrote:

> Input:
> CBINDING fred:int -> int = fred($1) ENDBINDING
> output #1:
> extern int fred_binding(int x) { return fred(x); } /* generated C 
> function */
> output #2:
> external fred:int ->int = "fred_binding"; (* ocaml stub *)

I see... It would be an original use of Camlp4, but it could work.
In Camlp4 you can do what you want while parsing and while printing.
For example, as "printer", you could take the syntax tree, type it
and generate code! :-)

For this specific case, since you use notions which cannot be represented
in the syntax tree (which is not extensible), you would have to do our
output (in particular the #1) at the parsing phase, in your syntax
extension.

> That is: my suggestion is to design a language CamlCGlue,
> which generates C code to bind ocaml to C libraries,
> and implement it using camlp4.

I think it is feasible. If you want some help, in particular for
the implementation of your syntax extension in Camlp4, you can ask
me.

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2002-05-30  8:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-25  3:45 [Caml-list] What about polymorphic methods? Alessandro Baretta
2002-05-25  3:55 ` Jacques Garrigue
2002-05-25  5:42   ` John Prevost
2002-05-27 19:10   ` Alessandro Baretta
2002-05-27 18:22     ` John Max Skaller
2002-05-30  0:02       ` Alessandro Baretta
2002-05-27 18:27     ` [Caml-list] Possible use for camlp4 John Max Skaller
2002-05-27 18:35       ` Alexander V. Voinov
2002-05-27 19:33       ` Daniel de Rauglaudre
2002-05-29 19:25         ` John Max Skaller
2002-05-30  2:42           ` Jacques Garrigue
2002-05-30  8:15           ` Daniel de Rauglaudre [this message]
2002-05-27 19:37       ` Daniel de Rauglaudre
2002-06-02  8:34   ` [Caml-list] What about polymorphic methods? Lauri Alanko
2002-06-03 23:57     ` Jacques Garrigue
2002-06-08  9:52   ` [Caml-list] What about polymorphic methods Alessandro Baretta
2002-06-10 10:13     ` Jacques Garrigue

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=20020530101506.B28827@verdot.inria.fr \
    --to=daniel.de_rauglaudre@inria.fr \
    --cc=caml-list@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).