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
Immediate recursive functions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-02-18 (16:20)
From: Hendrik Tews <tews@t...>
Subject: Camlp4 with traditional syntax (was: Camlp4 documentation)
Alex Cowie <> writes:

   For me, the use of revised syntax has been a disincentive to using
   Camlp4 metaprogramming.  I have always wondered whether a traditional
   syntax version of Camlp4 was technically feasible.  Any comments?

I believe it is possible. You can parse traditional ocaml (as
opposed to the revised syntax) with camlp4, so it should be
possible to write a quotation expander using traditional ocaml. I
remember Daniel de Rauglaudre complaint a few times about the
difficulty of parsing ocaml. So a quotation expander using
traditional ocaml might have dark corners which do not look as
elegant as

A alternative quotation expander using traditional ocaml would be
much simpler to set up than the original one in
camlp4/meta/q_MLast, because you don't have to deal with
bootstrapping issues. The alternative expander would be written
in the revised syntax and compiled when camlp4 has been built.

Moreover, all the necessary pieces are already contained in the
camlp4 sources: the quotation expander is in q_MLast and the
traditional ocaml syntax is in etc/ So you would only mix
the two files, taking the grammer from pa_o and the actions from

I even started once, but did not continue. If anybody starts to
work on an alternative quotation expander using traditional
ocaml, please announce.


Hendrik Tews