[wg-camlp4] Support for extension points in Camlp4

Hongbo Zhang hongboz at seas.upenn.edu
Thu Apr 4 02:05:33 BST 2013


Hi Alain,
  I would definitely like to help, but I think it is  a bit too early to
adapt P4.


On Wed, Apr 3, 2013 at 1:55 PM, Alain Frisch <alain.frisch at lexifi.com>wrote:

> Another topic where help would be much appreciated is the support of
> extension points in Camlp4.  Even if one of the goal of all this discussion
> is to replace some uses of Camlp4, there is no reason Camlp4 could not
> support itself the three new syntactic features (attributes, extension
> nodes, quoted strings) in its parsers and its custom representation of the
> OCaml AST.  In addition to simplifying a migration phase (combining some
> Camp4 extensions and some -ppx rewriters), supporting extensions points in
> Camlp4 makes sense even for people who want (or will have) to continue
> using Camlp4:
>
>  - AST mappers can then be written not only with -ppx but also as Camlp4
> AST filters (which supports concrete syntax patterns and expressions).
>
>  - It can be imagined that some extensions are split into an AST
> transformation part (to be processed by -ppx) and a change to the concrete
> syntax (with a Camlp4 extension which would only adds attributes and
> extension nodes to the AST).  This would make it possible to use the core
> feature of the extension without camlp4 and still provide ad hoc concrete
> syntax for those who insist on it.
>
>  - Some external tools (a la Bisect) might start using attributes found in
> the parsetree or typedtree, and projects built with Camlp4 will need a way
> to embed such attributes in the source files.
>
>
> The current state is that Camlp4 has been adapted to the new Parsetree
> (i.e. it generate valid fragments), but its internal representation of the
> OCaml AST and its parsers do not support the new features.  Adding this
> support should not be very difficult for someone familiar enough with the
> implementation of Camlp4.  Any volunteer?
>
>
> Alain
> ______________________________**_________________
> wg-camlp4 mailing list
> wg-camlp4 at lists.ocaml.org
> http://lists.ocaml.org/**listinfo/wg-camlp4<http://lists.ocaml.org/listinfo/wg-camlp4>
>



-- 
-- Regards, Hongbo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/wg-camlp4/attachments/20130403/8a91b684/attachment-0001.html>


More information about the wg-camlp4 mailing list