Bumping Ppxlib's AST to 5.2 [ppxlib-5-2]

Ppxlib is a libary for building OCaml preprocessors. Users can generate OCaml code from OCaml code (derivers) or replace parts of OCaml code with other OCaml code (rewriters).

At the core of ppxlib is the OCaml parsetree; a data structure in the compiler that represents OCaml source code. Ppxlib makes a distinction between the source parsetree (based on the version of the OCaml compiler you are using) and ppxlib's parsetree (a copy of some parsetree from the compiler).

In ppxlib.0.36.0, the internal AST was bumped from the AST of OCaml 4.14.0, to the AST of OCaml 5.2.0. This post discusses some of the internal mechanisms that allows ppxlib to support multiple compilers and how this bump broke a lot of backwards compatibility.

Context

Patrick's OCaml Blog [ocaml-blog]

Posts [posts]

Backlinks

OCaml Roundup: February 2026 [ocaml-roundup-february-2026]

OCaml Roundup: October 2025 [ocaml-roundup-october-2025]

OCaml Weekly 2025 w30 and w31 [ocaml-weekly-2025-w30-w31]

Quarterly OCaml Q2 [ocaml-quarterly-q2]

OCaml Weekly 2025 w29 [ocaml-weekly-2025-w29]

Catching Up! [weekly-2025-04-14]

Shelter, Hazel and More! [weekly-2025-03-31]

Related

Ppxlib [ppxlib]