Debugging OCaml rewriters in VSCode

Mentor: Nathan Rebours

Location: Tarides office, Paris

The main metaprogramming facility in the OCaml platform is PPX rewriters. These can interpret bits of syntax in user programs to generate code that can be tedious to write by hand, such as comparison or serializing functions. These metaprograms are powerful because they operate on the OCaml AST. On the other hand, this means that it is necessary for their authors (and sometimes for their users) to know about details of the OCaml AST: what source code corresponds to what AST nodes, etc. Some tools exist to help with that (dumpast, utop, astexplorer), but they are often standalone tools that are not linked to the program being developed.

The goal of this project is to extend the OCaml platform VSCode extension with tools specially for PPX authors and users, such as ways to:

  • display the AST corresponding to a part of OCaml syntax;
  • compare input and output programs for the rewriter under development;
  • inspect generated code in user applications.