Developped in 2010 during our last year of undergraduate studies with my classmate Martin Bodin, OCamlBike is a simplified yet comprehensive Objective Caml → C compiler. It was part of the course Projet 2 : Compilation.

For the background history, let us say that usually people work on a Pascal → SPIM minimalist compiler in this course, yet our year two group have chosen a simplified version of the Objective Caml langage as a source. The second group opted for a OCaml → Asm x86 compiler, focusing on a very restricted subset of OCaml, and their compiler produced quite an optimised and efficient asm code. Meanwhile, with my cheerful partner, we aimed for a broader subset of OCaml, including recursive objects, recursive types, polymorphism and garbage collection (through reference counting). We compiled the OCaml source code to C instruction along with its abstract machine to run the programm.

As everything went smoothly, and because sounded quite ear-appealing, we proudly named our compiler OCamlBike (le compilateur qui roule !). If you wish to give it a try, be sure to download the full archive of the project : it contains all the necessary source files, some examples of what OCamlBike compile and what does not work, as well as a technical implementation details paper, and gentle userguide for the impatients.