Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Hendrik Tews <tews@t...>
Subject: Camlp4 with traditional syntax (was: Camlp4 documentation)
Alex Cowie <cowie@cs.unisa.edu.au> 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 pa_macro.ml.

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/pa_o.ml. So you would only mix
the two files, taking the grammer from pa_o and the actions from
q_MLast.

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

Bye,

Hendrik Tews