From: Benjamin Canou <benjamin.canou@gmail.com>
To: caml-list@inria.fr
Subject: [Caml-list] proposal for finding, loading and composing ppx preprocessors
Date: Fri, 11 Jul 2014 15:31:42 +0200 [thread overview]
Message-ID: <53BFE73E.6060106@gmail.com> (raw)
Dear OCaml'ers,
To accompany the arrival of annotations in the forthcoming release, we
propose to discuss and hopefully agree on a standard way of selecting
the adequate preprocessor(s) for a given file. Gerd already introduced a
mechanism in the last version of OCamlFind, that we'd like to extend as
follows.
Our idea is to indicate via a pragma inside the file, how it has to be
processed. You can see that as a machine readable way of writing (* this
file has to be preprocessed with blah using options blah *). For this,
we propose that build systems use a default preprocessor systematically,
that would interpret these pragmas and find and call its fellow
preprocessors accordingly.
The compiler already provides built-in annotations. In a way, it's a
second predefined layer, this time for the build system.
We designed and prototyped such a tool [1], which understand annotations
of the form [@@@ syntax "package"], to preprocess the following code
using the ppx declared in the corresponding OCamlFind package.
The tool also defines a way to register plug-ins instead of executables
so preprocessors can be dynlinked instead of called as processes.
Extensions could be:
- delimiting a fragment of the code to process
- add a way to associate a given annotation identifier to a
preprocessor, so that only the mother preprocessor would do the tree
traversal, specific preprocessors only seeing the nodes they are
actually interested in.
- other kind of pragmas for the build system ?
Again, the goal is to agree now on a standard way and avoid the mess we
had with camlp4. What do you think ?
Benjamin, Grégoire and Pierre @ OCamlPro.
[1] https://github.com/hnrgrgr/ppx_loader
next reply other threads:[~2014-07-11 13:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-11 13:31 Benjamin Canou [this message]
2014-07-11 14:21 ` Daniel Bünzli
2014-07-11 14:36 ` Peter Zotov
2014-07-11 14:49 ` Daniel Bünzli
2014-07-11 14:55 ` Peter Zotov
2014-07-11 14:52 ` Mark Shinwell
2014-07-11 15:27 ` Anil Madhavapeddy
2014-07-11 15:35 ` Mark Shinwell
2014-07-11 14:55 ` Benjamin Canou
2014-07-11 15:23 ` Daniel Bünzli
2014-07-11 16:00 ` Benjamin Canou
2014-07-11 16:13 ` Alain Frisch
2014-07-15 13:59 ` Benjamin Canou
2014-07-15 15:56 ` Alain Frisch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53BFE73E.6060106@gmail.com \
--to=benjamin.canou@gmail.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox