English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2002-05-27 (19:33)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] Possible use for camlp4

On Tue, May 28, 2002 at 04:27:27AM +1000, John Max Skaller wrote:

> Hmm.. can camlp4 generate C?

Any program can generate C. For example, this one in OCaml:

   print_string "main () { printf(\"hello, world\\n\"); }\n";
   flush stdout;;

What do you mean by "generate C"? Can you specify, give examples?

Or perhaps you mean "parse C" to include it in an OCaml program? In
this case, no: I did not write any parser with C syntax, because C is
a language of statements and OCaml a language of expressions. The C
syntax is not a good one for the semantics of Camlp4.

Or do you mean if there exist a parser for C program, generating a
syntax tree? I just know that there is a definition of a C syntax tree
somewhere and even somebody having programmed Camlp4 quotations for
this syntax tree (allowing to use the concrete syntax to represent
abstract syntax): I am sorry, I don't remember who, but he recognizes
himself if he reads this mailing list...

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