Following on from the success of our previous OCaml Journal articles covering
LLVM, we have begun a series dedicated to the design and implementation of
high-level languages using LLVM. In particular, these new articles are more
pragmatic in nature and go beyond describing working compilers to also
discuss testing, debugging and the performance of LLVM-based compilers.
The first article in this new series has just been published:
This article describes a basic design for a High-Level Virtual Machine (HLVM)
and walks through a core implementation written in OCaml that can JIT compile
functions from a simple language (with unit, bool, int, float and array
types) to optimized native code and execute them.
Future articles in this series will add tail calls, tuples, algebraic
datatypes, run-time types, reflection, accurate garbage collection,
dynamically-loaded libraries and FFI to C, first-class functions and many
When our HLVM reaches a more advanced stage, with sum types and garbage
collection, we shall release it as open source software and encourage others
to build interoperable language implementations upon it, i.e. creating a
common language run-time.