0.37.0

We are pleased to announce the release of ppxlib 0.37.0. This version introduces initial support for the OCaml 5.4 compiler and provides several enhancements to AST handling and code generation.

Key Highlights

  • OCaml 5.4 Support: This release includes initial support for OCaml 5.4.
  • Module Derivers: Users can now derive code from module bindings and module declarations, expanding the scope of automated code generation.
  • New Context-Free Rules: A new rule type has been added to replace AST nodes that have specific registered attributes attached to them.
  • Astlib Enhancements: Added Longident.to/of_compiler to astlib to simplify the maintenance of PPXs that interact with compiler-libs components like the type checker.

Bug Fixes and Improvements

  • Printer Fixes: Resolved an issue where infix operators (e.g., mod) were incorrectly printed as raw identifiers in Pprintast.
  • Migration Accuracy: Fixed 5.2 to 5.3 migration for constants to ensure correct location data, improving the quality of error messages.
  • AST Cleanup: The AST is now automatically cleaned of ppxlib migration attributes when using Pretty_print mode with the use_compiler_pp flag.
  • Custom Printing: Added a ?printer configuration parameter to pp_ast functions to support custom printers.

Deprecations and API Changes

  • Inline Tags: Added @@@ppxlib.inline.end and formally deprecated @@@deriving.end.
  • Error Exposure: Ppxlib.Location.Error.t is now explicitly exposed as an alias for Astlib.Location.Error.t.
See full changelog

CHANGES:

5.4 Support

Other Changes

  • Add Longident.to/of_compiler to astlib to simplify maintenance
    of ppx-es that interacts with other parts of the compiler-libs such
    as the type checker. (#603, @NathanReb)

  • Fix a bug where some infix operators such as mod would be printed as
    raw identifiers by our Pprintast. (#601, @NathanReb)

  • Fix 5.2 -> 5.3 migration of constants. Those used to always have a none
    location which can lead to unhelpful error messages.
    (#569, @NathanReb)

  • Add a new context-free rule type that replaces AST nodes that have the registered
    attributes attached to them. (#574, @Skepfyr)

  • Allow users to derive code from module bindings and module declarations
    (#576, @patricoferris)

  • Expose Ppxlib.Location.Error.t = Astlib.Location.Error.t (#593, @ceastlund)

  • Add @@@ppxlib.inline.end, deprecate @@@deriving.end. (#594, @ceastlund)

  • Clean the AST of any ppxlib migration attributes whenever printing using
    Pretty_print mode and the use_compiler_pp flag. (#598, @patricoferris)

  • Add custom printer support to pp_ast functions via the ?printer config
    parameter. (#526, @pedrobslisboa)