Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] productivity improvement
[ 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] Re: Camlp4 optimizations (was: productivity improvement)
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