From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA26324; Thu, 30 May 2002 10:15:12 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA26161 for ; Thu, 30 May 2002 10:15:11 +0200 (MET DST) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g4U8FBH08740 for ; Thu, 30 May 2002 10:15:11 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id KAA29035 for caml-list@inria.fr; Thu, 30 May 2002 10:15:06 +0200 Date: Thu, 30 May 2002 10:15:06 +0200 From: Daniel de Rauglaudre To: Ocaml Subject: Re: [Caml-list] Possible use for camlp4 Message-ID: <20020530101506.B28827@verdot.inria.fr> References: <3CEF08ED.80407@baretta.com> <20020525125530P.garrigue@kurims.kyoto-u.ac.jp> <3CF28495.20102@baretta.com> <3CF27A8F.2000306@ozemail.com.au> <20020527213326.F9870@verdot.inria.fr> <3CF52B1F.2050004@ozemail.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3CF52B1F.2050004@ozemail.com.au>; from skaller@ozemail.com.au on Thu, May 30, 2002 at 05:25:19AM +1000 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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