[ANN] Nanocaml - Compiler-writing framework for nanopasses

Hi all,

I am very excited to announce the release of Nanocaml! Nanocaml is a port/clone of the Nanopass framework for Scheme and Racket (can’t put a link here, but it will be the first result if you search for “Nanopass framework”) and provides a PPX-powered toolkit for writing compilers. It emphasizes the use of many tiny passes, similar to the UNIX philosophy but for compilers. Although the version is 0.1.0, it is already very close to the Scheme and Racket versions in terms of features and has a number of advantages (such as static typechecking, the OCaml syntax, and less “magic”). We are almost at our 1.0 target, but we wanted to release this version earlier to get feedback and hopefully more test code.

The README has a basic explanation of how to use the library, and in addition to our examples we have ported the compiler from the Racket docs.

Our 2 main limitations at this moment are the following:

  • module%language declarations don’t carry over between files, which makes it tedious to work with in utop. Our expected solution is to generate a SQLite database file storing language declarations from a project, but we are open to other ideas.

  • Aliases don’t always work in patterns. This is a known issue and will likely be solved in the next commit as it doesn’t seem like it will be a difficult fix.

If you have any questions about using the library please feel free to ask! We would love to get new users and more feedback on this!

9 Likes