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 VAA11250; Thu, 17 Oct 2002 21:36:46 +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 VAA11494 for ; Thu, 17 Oct 2002 21:36:45 +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 g9HJaj519832 for ; Thu, 17 Oct 2002 21:36:45 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id VAA06881 for Caml-list@inria.fr; Thu, 17 Oct 2002 21:36:45 +0200 Date: Thu, 17 Oct 2002 21:36:45 +0200 From: Daniel de Rauglaudre To: Caml-list@inria.fr Subject: Re: [Caml-list] Re: Camlp4 optimizations (was: productivity improvement) Message-ID: <20021017213644.A6846@verdot.inria.fr> References: <200210171055.05646.jeffrey.palmer@acm.org> <200210171055.05646.jeffrey.palmer@acm.org> <20021017.202106.99065335.debian00@tiscalinet.be> <4.3.2.7.2.20021017112600.0318b410@mail.d6.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <4.3.2.7.2.20021017112600.0318b410@mail.d6.com>; from checker@d6.com on Thu, Oct 17, 2002 at 11:32:31AM -0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, On Thu, Oct 17, 2002 at 11:32:31AM -0700, Chris Hecker wrote: > > camlp4 can generate C with no problem (although I don't know if it can > create another file, but I don't see why not, it can run arbitrary caml > code during parsing). Camlp4, in its standard usage, does not generate C: Camlp4, in its standard usage, just converts source code (in any syntax) into normal OCaml source code (by abstract syntax tree). But of course, Camlp4 is a normal OCaml program, and therefore can create, as side effects, intermediate files, C files, why not, and can transmit to OCaml some code defining the good "external" definitions, and so on. But it would not be what Camlp4 is created for. And Camlp4 does not know the types of the things in the file its treats. If you want types, you must do typing!!! And I am sorry, typing a program is a rather complicated job... When you write "let x = 3 in x + 2", Camlp4 does not even make the relation between the first "x" and the second "x". For it, they are just some pattern and some expression, that's all. --- To know if Camlp4 can help: take your source program, add any syntax extension that you would like to have, and write what you want that Camlp4 generates for you in *normal OCaml syntax*: if you cannot write your thing in normal OCaml syntax, it means that Camlp4 cannot help you. Since you cannot write C code in normal OCaml syntax, you cannot use Camlp4 to generate C code. -- 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