Repository navigation
Is this project still alive? #95
Description
Activity
Cross-reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1078383
It is not, see #94 (comment) for more details.
I'll add a deprecation notice to the readme.
At the moment I still need
ppx_tools/rewriterwhile building the documentation ofvisitors. Is there a replacement forppx_tools/rewriter?cc @NathanReb
The project is unmaintained but any tools that has active users should be ported to
ppxlib-tools, I'll take a look atrewriter!Thanks! All I need is a way of printing the code after it has been preprocessed.
This should already be doable with ppxlib, can you give me a bit of context of how you'd like to do this?
For instance you can assemble a ppxlib driver as follows,
ppx_driver.ml:let () = Ppxlib.Driver.standalone ()
and
dune:(executable (name ppx_driver) (libraries ppxlib <list of ppx-es you want to use>))
Then:
dune exec -- ./ppx_driver.exe test.mlwill preprocess test.ml and print the resulting AST as OCaml source code.
Thanks, I didn't know about this. I will try it.
Hi Nathan, I have tried your suggestion, and it seems to work. Unfortunately the preprocessed code that I obtain is quite ugly because it contains a lot of
@ppxlib.migration.stop_takingattributes, like this:method visit_EAdd env = (( fun c0 -> (( fun c1 -> let r0 = self#visit_expr env c0 in let r1 = self#visit_expr env c1 in ())[@ppxlib.migration.stop_taking])) [@ppxlib.migration.stop_taking ])
See the current version of the visitors manual for more examples: Figure 1, Figure 13, for example.
Is there a way of saying that I do not want these attributes to exist?
Which version of ppxlib and which version of the compiler are you using? The latest ppxlib, i.e. 0.37.0 should remove those when printing the preprocessed AST as source code. Could you also paste the driver's command line invocation?
If you're getting this with ppxlib.0.37.0 or higher then that's a bug in ppxlib!
I was using 0.36.0. I just tried 0.37.0 and it works: the ugly attributes are gone. Thanks for your quick reply!
Reacted by Nathan ReboursThis said, I see that the output is a bit awkward, as it uses an explicit
fun:method visit_EAdd env = fun c0 c1 -> let r0 = self#visit_expr env c0 in let r1 = self#visit_expr env c1 in ()
Why doesn't the printer print
method visit_EAdd env c0 c1 = ...? Do you have an idea? (I used to obtain this nicer result when I usedppx_tools/rewriter.)Never mind. From now on
visitorswill decorate every method with a type annotation, like this:method visit_EAdd : _ -> expr -> expr -> unit = fun env c0 c1 -> .... So the nicer result that I asked for above cannot be obtained anyway.This could be a few different things and I'd need to try and reproduce it to figure out what's happening here. From your example above, it looks like an arity issue, i.e. the method body would not be represented as:
Pexp_function [env; c0; c1] ...but as:
Pexp_function [env] (Pexp_function [c0; c1] ...)
making it so
Pprintastdoes not "resugars" it properly.
This project does not compile with OCaml 5 and does not seem to be used anymore, at least by other software packaged in Debian. However, I did not see any deprecation notice. Is this project still alive?