PPX
PPX, commonly written ppx, denotes the PreProcessor eXtensions framework in OCaml that enables syntax and code transformations through rewriters that operate on the compiler's abstract syntax tree. Rather than writing in language-level syntax, developers implement small programs, or "rewriters," that receive OCaml AST nodes as input and emit transformed AST that the compiler subsequently compiles.
PPX rewriters are invoked during the build process, typically via the -ppx option provided by the OCaml
The PPX ecosystem emerged to provide safe, modular, and reusable extensions, replacing earlier approaches such as
Popular PPX packages include ppx_deriving, which automatically generates boilerplate such as equality, comparison, or pretty-printing functions;