Implementation of PPX rewriters using camlp5 infrastructure.
This is pa_ppx
(alpha) version 0.03.
This is a re-implementation of a number of the PPX rewriters from ocaml-ppx, but based on camlp5 infrastructure instead of ppxlib.
So: right up front: if you're writing PPX rewriters based on ppxlib, ppx_deriving, etc, then they will not work with this package. Not. At. All. Instead, the goal here is to show how easy it is to write PPX rewriters this way.
Also, this code is barely two months old, so you should expect bugs, and I'm happy to fix them posthaste, b/c I want this code to work well.
All the documentation for pa_ppx
is in Sphinx/RST format, and can
be found in this distribution and also at
readthedocs.
There you will find instructions on installation, using with Makefiles
and Dune, a tutorial walkthru of using pa_ppx
, for writing new PPX
rewriters on this infrastructure, and some documentation on each
rewriter (this last bit is definitely work-in-progress).
Quickly, this code (re-)implements:
- all of ppx_deriving (enum,eq,fold,iter,make,map,ord,show)
- ppx_import
- ppx_deriving_yojson
- ppx_sexp_conv
- ppx_inline_test
- ppx_expect_test
- ppx_assert
- ppx_here
It also implements some new rewriters:
- pa_ppx.dock: doc-comment extractor
- [for internal use by PPX rewriters using this infrastructure] pa_unmatched_vala
- [an example] pa_hashrecons
- pa_ppx.undo_deriving: undoes the effect of pa_ppx.deriving and its plugins
the re-implementations of ppx_deriving and ppx_import pass all their unit-tests and use the same syntax of attributes as the original rewriters. You should be able to use your code with these packages unmodified; anything else is a bug with these packages.
All the documentation for pa_ppx
is in Sphinx/RST format, and can
be found in this distribution and also at
readthedocs.
This release should work on MacOS, but I haven't been able to figure out how to convince OPAM to install the right pre-reqs. If a Mac user wants to help out with this, can explain to them what the gap is, and maybe they could help fill it. It's not a big deal -- just some Perl packages -- but I cant' figure out how to get OPAM to install them.