A simple ppx to examplify the initial setup of ppxlib, part of the talk The needed introduction to writing a ppx given at Reason STHLM Meetup..
It uses opam
- OCaml 5.2.0
- dune 3.12
- ppxlib 0.27
make installmake build # Builds the project, once
make dev # Watch the filesystem and re-builds the project on each changemake test # Runs snapshot tests
make test-watch # Watch the filesystem and re-runs the tests on each change
make test-update # Updates the snapshot testsUsers of your ppx need to add the ppx name to their dune stanza:
(preprocess
(pps ppx-simple-example))And then you can use it in your code:
print_endline [%yay]
(* Transforms to *)
print_endline "Hello future compiler engineer!"