Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2002-10-17 (19:36)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] Re: Camlp4 optimizations (was: productivity improvement)

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

Since you cannot write C code in normal OCaml syntax, you cannot use
Camlp4 to generate C code.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: