package ppxlib

  1. Overview
  2. Docs
Standard infrastructure for ppx rewriters

Install

Dune Dependency

Authors

Maintainers

Sources

04e050cbe2cf3e5cdb4441c480e4f472a5033941.tar.gz
sha256=f0e61123b33b2acca23a388a367226674a7bccdedbaa41b0fd62fa42344dccd9
sha512=1a192695ac3a7d587a49f3025239557a998febe72d3b469d3c69b5c32643cc91c55fb72703f8197e1395c02bfabacf17ce5f7ee2bdc367e15f9086e489082a9b

Description

Ppxlib is the standard infrastructure for ppx rewriters and other programs that manipulate the in-memory representation of OCaml programs, a.k.a the "Parsetree".

It also comes bundled with two ppx rewriters that are commonly used to write tools that manipulate and/or generate Parsetree values; ppxlib.metaquot which allows to construct Parsetree values using the OCaml syntax directly and ppxlib.traverse which provides various ways of automatically traversing values of a given type, in particular allowing to inject a complex structured value into generated code.

Published: 16 Feb 2024

README

Non-continuous trunk-support for Ppxlib

On this branch, we provide a Ppxlib version, which can be compiled with OCaml's trunk branch. Whenever you want to compile a project that (transitively) depends on PPXs with trunk, please pin Ppxlib to this branch.

The branch is maintained manually. So each time the compiler adds a new syntax feature, first we need to bring this branch back in sync with trunk and then you'll need to re-pin your Ppxlib. Please, open an issue or a PR, if this branch doesn't compile with trunk. Also open an issue, if there's a feature/bug-fix on Ppxlib's main branch that you'd like to have here, so that we rebase.

trunk-support vs trunk-feature support

Ppxlib supporting trunk can be interpreted in two different ways.

User perspective on the difference

One notion of trunk-support is that a project depending on Ppxlib can be compiled with trunk under the assumption that the project doesn't use the new syntax features in trunk. That's what this branch provides.

The other notion of trunk-support should actually be called trunk-feature support: you can use the new trunk syntax features in a project which depends on Ppxlib and that you compile with trunk. It's not unlikely that you'll get a Ppxlib runtime error (i.e. project compile time error), if you try to use this branch in that situation.

Ppxlib behavior perspective on the difference

The Ppxlib behavior in the situation of trunk support is: The parsetree version exposed by Ppxlib is still the one from the latest stable compiler and all PPXs are defined against that one. However, Ppxlib has hold of trunk's parsetree version and knows how to migrate between that parsetree version and the parsetree version of the latest stable compiler. You can find those parsetrees and parsertree migration modules in Ppxlib's Astlib library. So, when compiling a file with trunk, the Ppxlib driver will parse the file into the trunk parsetree, migrate down to the latest stable parsetree, do the PPX expansions and migrate back to trunk's parsetree. The downward migration will error, if the parsetree contains a feature that isn't well-defined in the latest stable parsetree version.

The behavior in the case of trunk-feature support would be different. In that case, Ppxlib would have to expose the trunk parsetree, so that the PPXs would be defined against that one. So, Ppxlib would have to bump its internal parsetree to the trunk parsetree. Bumping the Ppxlib parsetree always means potentially breaking PPXs. When bumping the Ppxlib parsetree to the parsetree of an about-to-be-released stable compiler version, we create a work-space with all opam PPXs and send patch PRs to the ones we break. However, for trunk we wouldn't do such an effort.

Dependencies (6)

  1. stdlib-shims
  2. sexplib0 >= "v0.12"
  3. ppx_derivers >= "1.0"
  4. ocaml-compiler-libs >= "v0.11.0"
  5. ocaml >= "4.04.1" & < "5.3.0"
  6. dune >= "2.7"

Dev Dependencies (5)

  1. odoc with-doc
  2. cinaps with-test & >= "v0.12.1"
  3. re with-test & >= "1.9.0"
  4. ocamlfind with-test
  5. sexplib0 with-test & >= "v0.15"

  1. awsm-codegen
  2. base_quickcheck = "v0.13.0" | >= "v0.14.1"
  3. bisect_ppx >= "2.8.3"
  4. bistro >= "0.6.0"
  5. bonsai >= "v0.16.0"
  6. bytestring
  7. clangml >= "4.7.0"
  8. comby < "1.3.0"
  9. commons
  10. config
  11. diff
  12. ego
  13. eliom >= "8.9.0"
  14. elpi >= "1.11.0" & < "1.11.3" | >= "1.13.2"
  15. embedded_ocaml_templates < "0.3.1" | >= "0.7"
  16. extunix >= "0.3.1"
  17. flow_parser >= "0.229.1"
  18. fsml
  19. GT = "0.5.1"
  20. gen_js_api >= "1.0.6" & < "1.0.8" | >= "1.1.1"
  21. genprint = "0.3"
  22. gospel >= "0.2.0"
  23. graphql_ppx >= "1.2.2"
  24. hack_parallel >= "1.0.1"
  25. hardcaml >= "v0.14.1"
  26. http_async
  27. js_of_ocaml >= "3.8.0"
  28. js_of_ocaml-compiler >= "3.8.0"
  29. js_of_ocaml-lwt >= "3.10.0"
  30. js_of_ocaml-ocamlbuild >= "3.10.0" & < "5.0"
  31. js_of_ocaml-ppx >= "3.8.0"
  32. js_of_ocaml-ppx_deriving_json >= "3.7.1"
  33. js_of_ocaml-toplevel >= "3.10.0"
  34. js_of_ocaml-tyxml >= "3.10.0"
  35. jsoo-react
  36. lablqml >= "0.7"
  37. landmarks-ppx
  38. lascar >= "0.7.0"
  39. learn-ocaml >= "0.13.0"
  40. learn-ocaml-client >= "0.13.0"
  41. lens >= "1.2.5"
  42. let-if >= "0.2.0"
  43. logs-ppx
  44. lwt_ppx >= "2.0.2"
  45. melange >= "1.0.0"
  46. merlin >= "4.7-412"
  47. metapp >= "0.4.4"
  48. metaquot >= "0.5.0"
  49. mlt_parser = "v0.13.0" | >= "v0.14.1"
  50. noCanren >= "0.3.0~alpha1"
  51. node_of_ocaml
  52. nuscr >= "2.0.0"
  53. OCanren-ppx = "0.2.0" | >= "0.3.0"
  54. obus >= "1.2.5"
  55. ocaml-monadic >= "0.5"
  56. ocamlformat = "0.19.0~4.13preview"
  57. ocf_ppx
  58. ocsigen-i18n >= "4.0.0"
  59. ocsigen-ppx-rpc
  60. ojs_base_ppx
  61. ometrics = "0.2.0"
  62. ortac-core
  63. ortac-qcheck-stm
  64. override = "0.2.2"
  65. pacomb
  66. pancake
  67. pgocaml_ppx >= "4.3.0"
  68. pla >= "2.0"
  69. ppx-owl-opt
  70. ppx_accessor >= "v0.14.3"
  71. ppx_assert >= "v0.13.0"
  72. ppx_bap
  73. ppx_base >= "v0.13.0"
  74. ppx_bench >= "v0.15.1"
  75. ppx_bin_prot >= "v0.13.0"
  76. ppx_bitstring >= "4.1.0"
  77. ppx_blob >= "0.7.2"
  78. ppx_camlrack
  79. ppx_catch
  80. ppx_cold
  81. ppx_compare >= "v0.13.0"
  82. ppx_compose >= "0.2.1"
  83. ppx_const >= "2.0.1"
  84. ppx_conv_func >= "v0.13.0"
  85. ppx_counters
  86. ppx_css
  87. ppx_cstruct >= "6.0.0"
  88. ppx_cstubs >= "0.6.1"
  89. ppx_csv_conv >= "v0.13.0"
  90. ppx_custom_printf >= "v0.14.1"
  91. ppx_decimal
  92. ppx_default
  93. ppx_defer >= "0.5.0"
  94. ppx_demo
  95. ppx_derive_at_runtime
  96. ppx_deriving >= "5.2"
  97. ppx_deriving_cad
  98. ppx_deriving_encoding >= "0.2"
  99. ppx_deriving_hardcaml >= "v0.13.0"
  100. ppx_deriving_hash
  101. ppx_deriving_jsoo >= "0.2"
  102. ppx_deriving_madcast >= "0.2"
  103. ppx_deriving_popper
  104. ppx_deriving_protobuf >= "3.0.0"
  105. ppx_deriving_qcheck
  106. ppx_deriving_rpc >= "8.1.0"
  107. ppx_deriving_scad
  108. ppx_deriving_yaml
  109. ppx_deriving_yojson >= "3.7.0"
  110. ppx_disable_unused_warnings
  111. ppx_distr_guards >= "0.3"
  112. ppx_dream_eml
  113. ppx_enumerate >= "v0.13.0"
  114. ppx_expect >= "v0.13.0" & != "v0.14.0"
  115. ppx_factory = "0.1.0" | >= "0.2.0"
  116. ppx_fail >= "v0.13.0"
  117. ppx_fields_conv >= "v0.14.2"
  118. ppx_fixed_literal
  119. ppx_gen_rec >= "2.0.0"
  120. ppx_getenv >= "2.1"
  121. ppx_globalize
  122. ppx_hash >= "v0.13.0"
  123. ppx_here >= "v0.13.0"
  124. ppx_ignore_instrumentation
  125. ppx_import >= "1.7.0" & < "1.8.0"
  126. ppx_inline_alcotest
  127. ppx_inline_test >= "v0.15.1"
  128. ppx_interact
  129. ppx_irmin >= "3.0.0"
  130. ppx_jane >= "v0.13.0"
  131. ppx_js_style >= "v0.13.0"
  132. ppx_jsobject_conv = "0.8.0" | >= "0.9.3"
  133. ppx_jsonaf_conv >= "v0.15.1"
  134. ppx_let >= "v0.13.0"
  135. ppx_log
  136. ppx_lun
  137. ppx_make
  138. ppx_map
  139. ppx_matches
  140. ppx_minidebug
  141. ppx_module_timer >= "v0.13.0"
  142. ppx_monad
  143. ppx_monoid >= "0.3.3"
  144. ppx_mysql >= "1.1.3"
  145. ppx_open
  146. ppx_optcomp >= "v0.14.2"
  147. ppx_optint
  148. ppx_optional >= "v0.13.0"
  149. ppx_parser
  150. ppx_pattern_bind >= "v0.13.1"
  151. ppx_pipebang >= "v0.13.0"
  152. ppx_protocol_conv >= "5.1.3"
  153. ppx_pyformat
  154. ppx_python >= "v0.15.0"
  155. ppx_rapper < "1.0.1"
  156. ppx_regexp >= "0.5.0"
  157. ppx_repr >= "0.6.0"
  158. ppx_seq
  159. ppx_sexp_conv >= "v0.15.1"
  160. ppx_sexp_message >= "v0.14.1"
  161. ppx_sexp_value >= "v0.13.0"
  162. ppx_show >= "0.2.0"
  163. ppx_stable >= "v0.14.1"
  164. ppx_stable_witness
  165. ppx_string >= "v0.14.1"
  166. ppx_string_interpolation
  167. ppx_subliner
  168. ppx_system
  169. ppx_trace
  170. ppx_ts
  171. ppx_tydi
  172. ppx_type_directed_value
  173. ppx_typed_fields
  174. ppx_typerep_conv >= "v0.14.2"
  175. ppx_units
  176. ppx_update
  177. ppx_variants_conv >= "v0.14.2"
  178. ppx_viewpattern
  179. ppx_xml_conv >= "v0.13.0"
  180. ppx_yojson >= "1.3.0"
  181. ppx_yojson_conv >= "v0.15.1"
  182. ppxx >= "2.5.0"
  183. qcow >= "0.11.0"
  184. rdf_ppx
  185. reactjs-jsx-ppx
  186. reason >= "3.9.0"
  187. reason-react-ppx
  188. refl >= "0.4.1"
  189. repr-fuzz >= "0.2.1"
  190. res_tailwindcss
  191. rescript-syntax
  192. scaml != "1.2.0"
  193. sedlex >= "2.6"
  194. serde_derive
  195. server-reason-react
  196. spin >= "0.8.0"
  197. spoc_ppx
  198. stdint-literals
  199. streamable
  200. togglelog
  201. toplevel_expect_test >= "v0.14.1"
  202. tyxml-jsx >= "4.5.0"
  203. tyxml-ppx >= "4.5.0"
  204. tyxml-syntax >= "4.5.0"
  205. visitors >= "20210608"
  206. vlt
  207. wtr < "3.0.0"
  208. wtr-ppx
  209. xtmpl_ppx

Conflicts (4)

  1. ocaml-variants = "5.1.0~alpha1+options"
  2. ocaml-base-compiler = "5.1.0~alpha1"
  3. base-effects
  4. ocaml-migrate-parsetree < "2.0.0"