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
MetaOCaml lives!
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-03-02 (10:33)
From: oleg@o...
Subject: MetaOCaml lives!

This is to announce BER MetaOCaml, a streamlined version of
MetaOCaml. BER MetaOCaml is a conservative extension of OCaml with
the primitive type of code values, and three basic multi-stage
expression forms: Brackets, Escape, and Run. BER MetaOCaml implements
the type system based on environment classifiers to type-check
expressions that produce and run code values. BER MetaOCaml makes no
other changes to the OCaml language, remaining fully compatible with
the underlying OCaml system. BER MetaOCaml is current with the
byte-code OCaml release 3.11.2.
BER MetaOCaml is based on an earlier version of MetaOCaml developed by
Walid Taha, Cristiano Calcagno, and Edward Pizzi, with the help and
advice of Xavier Leroy.

The goal of the BER MetaOCaml project is to reduce as much as possible
the differences between MetaOCaml and the mainline OCaml, to make it
easier to keep MetaOCaml up-to-date and ensure its long-term
viability. We aim to find the most harmonious way of integrating
staging with OCaml, with the remote hope that some of the changes
would make it to the main OCaml branch. Therefore BER MetaOCaml is
distributed as a set of patches to OCaml plus a separate library
ber-metaocaml. The patched OCaml is responsible for producing and
type-checking code values. Processing code values -- printing,
executing, compiling to byte-code, to native code, to C, etc. are to
be done in the `user-level,' library code. Programmers may write new
ways of processing code values -- for example, to compile them to LLVM
or JavaScript -- without modifying OCaml or BER MetaOCaml.

This message announces the first stable version of byte-code
BER MetaOCaml.  Light testing confirms that BER MetaOCaml is
backwards-compatible with MetaOCaml, handling previously written
MetaOCaml code exactly as it was.

Currently BER MetaOCaml is restricted to byte-code. Support for the
native code compilation is of high priority. However, better ways of
handling cross-stage persistent values have to be investigated first.
Camlp4 is not yet extended to support MetaOCaml's special forms,
bracket and escape. Offshoring is temporarily disabled; it is meant to
be separated into a dedicated `user-level' library.

The BER MetaOCaml distribution can be downloaded from

To install BER MetaOCaml, one needs a configured version of OCaml
3.11.2. The installation involves patching the OCaml distribution,
bootstrapping the system, and compiling the ber-metaocaml library and the
BER MetaOCaml toplevel. The patched OCaml compiler is fully
source-compatible with OCaml and can process OCaml code, with staging
constructs or without. The patched OCaml compiler can compile into
native code (although such sources may not contain any staging
constructs at the moment). Please see the INSTALL and README files in
the BER MetaOCaml distribution for more details.

The number of patched OCaml files may appear high. First of all, BER
MetaOCaml modifies 23 fewer files compared to the original
MetaOCaml. There are plans and hunches to reduce the number of the
patched files further. Many of the modifications are quite
trivial. For example, since BER MetaOCaml extends the AST data type
with staging constructs, any code that processes AST has to be
modified (at least, to ignore the extra AST variants). One would
imagine that quite a lot of code in a compiler deals with AST.

I am indeed interested in problem reports, questions and
suggestions. Please follow-up to,
or mail me privately.

I am very grateful to Walid Taha, Jacques Carette, and Chung-chieh
Shan for many helpful discussions, suggestions and advice.