Warning! The packages available in OPAM are beta-version of the version 2 of typerex. These versions rely of the cmt files generated by the 4.00 OCaml compiler, with the -bin-annot option. Thus, most of the instructions given on this website are outdated. We are planning to improve the documentation.


We present a new development environment which improves what was previously available for OCaml, by bringing some of the features which are considered classic in editors for mainstream programming languages.

The TypeRex environment for Emacs is written in OCaml and relies on parts of the OCaml compiler to provide a more accurate semantic view of the OCaml programs which are edited, enabling a set of specific commands and behaviors.

A few additional tools are provided together with the TypeRex environment, which mostly serve to perform the necessary specific processing on the edited programs, namely, provide appropriate binary annotations about the source files.

Summary of TypeRex features

  • Improved syntax coloring
  • Auto-completion of identifiers (experimental)
  • Browsing of identifiers: show type and comment, go to definition, cycle between alternate definitions, and semantic grep;
  • Strictly semantic-preserving, local and whole-program refactoring:
    • renaming identifiers and compilation units
    • open elimination and reference simplification
  • Robust w.r.t. not-recompiled, possibly unsaved buffers
  • Scalable (used regularly on a few hundreds of source files)

All the features of the Tuareg mode are also included, even when we provide an equivalent of them.