Engineering ROTOR: a Refactoring Tool for OCaml (ongoing)

Starting Date: June 2022
Prerequisites: Familiarity with OCaml or other functional programming languages, and/or the ability and willingness to learn OCaml.
Will results be assigned to University: No

OCaml [1] is a mature functional programming language with an expressive type system.

Recently, we have developed a prototype tool, called ROTOR, for automatically refactoring OCaml codebases [2].

Currently, ROTOR handles renaming of functions. This is surprisingly hard due to OCaml’s powerful module system: renaming a function in one module may actually require renaming functions in many different places.

In this project, the aim is develop ROTOR into a real tool usable in an industrial context. We have contacts with Jane Street Capital [3], an algorithmic trading company whose codebase is mostly written in OCaml, and there is the potential to test out the tool in situ.

This project could involve any or all of the following.

  • Implementing renamings for other elements of the OCaml language, e.g. modules, datatypes, function parameters, field names, etc.
  • Investigating how renaming can be done in the presence of first-class modules and module type extraction (this is very much a research question).
  • Adding more complex refactorings to ROTOR such as function inlining and generalisation; moving functions; module extraction; type abstraction; various datatype transformations; etc.
  • Developing additional code analysis functionality, such as identifying definitions (of functions, modules, etc) from references, module dependency analysis, etc.
  • Integration of ROTOR into IDEs (e.g. VS Code, Emacs, etc.).