English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    
Browse thread
[Caml-list] What about polymorphic methods?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] Possible use for camlp4
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