François Maurel - Programming

Ocaml-templates

I've been interested in the implementation of a template system for Ocaml. The main goal is to enable a programmer to automatically generate code from type informations. An article (in french) to explain the conception and use of the system has been submitted.

A pre-prototype which should compile both under Ocaml 3.06 and 3.07 (with the two official patches) is already available. It has been successfully tested under ocaml-3.06 (linux, cygwin) and ocaml-3.07 patchlevel 2 (linux).
It has also been tested both under freebsd and Mac OS X ocaml-3.06 and ocaml-3.07: the installation complains but works well (this is due to a small bug in the script mkcamlp4). In the case of freebsd, it requires gmake instead of make.

Installation

To download click or copy-paste:
wget http://www.pps.jussieu.fr/~maurel/programmation/ocamltemplates-0.00.tgz
To install:
tar zxvf ocamltemplates-0.00.tgz
cd ocamltemplates-0.00
./configure
make
make install
One may also wish to compile ocamldoc documentation.
 make docs
It is then generated in doc/ocamldoc.
See the file INSTALL for more further information.

For the moment, the install phase installs binairies :

bin/ocamlt       : the toplevel
bin/ocamltp4     : the pre-processor-pretty-printer with normal syntax
bin/ocamltsp4    : the pre-processor-pretty-printer with standard templates and normal syntax.
bin/ocamltdp4    : the pre-processor for template definitions with normal syntax (not mandatory)
bin/ocamltdc     : a script which calls ocamltdp4 to compile a template
and some libraries
admin            : the module Templates which manages templates and some other files.
The license is the LGPL one with the standard modification for Ocaml. The distribution is composed from
Makefile, configure, LICENSE, INSTALL : as usual
admin     : principal files.
code_ref  : a syntax extension used in the specific syntax to define templates.
templates : some templates.
test      : test files and examples.

Bug reports and ideas are most welcome...

Use of ocaml-templates

Once ocaml-templates is installed, one may wish : The files ocamltp4, ocamltsp4 and ocamltdp4 are instances of camlp4.
Hence, the calling convention needs pathes of the shape ./file and even ./dir/file or the use of the -I directory option.

A small tutorial

Some examples are described in the already mentioned article. A tutorial is also available in the following formats: ps.gz, html and txt.

Mes coordonnées

Francois Maurel
Equipe PPS, case 7014
Bureau 6C12,
175, rue du Chevaleret,
75013 PARIS,
FRANCE.
Tel : (+33) (1) 44 27 28 38

E-mail : francois.maurel AT pps.jussieu.fr

Pour revenir à PPS : http://www.pps.jussieu.fr/

Valid HTML 4.01! Valid CSS!