The Standard ML Compiler and Toolkit
Native code with MLKit. Explicit regions with ReML. JavaScript with SMLtoJs.
MLKit
Compile Standard ML to native code with region-based memory management. Target x64 on Linux and macOS, or arm64 on Apple Silicon.
ReML
Add explicit regions, effects, and effect constraints to Standard ML for more control over allocation and memory use.
SMLtoJs
Compile Standard ML to JavaScript, integrate with browser APIs, or try the compiler in the Online SML IDE.
Try Standard ML interactively
Run mlkit without arguments to start the REPL. Evaluate expressions, define functions, and load projects in an interactive session.
SML'97
The MLKit compiler covers all of Standard ML, as defined in the 1997 edition of the Definition of Standard ML. The MLKit implements most of the latest Standard ML Basis Library specification.
ML Basis Files
The MLKit compiles large programs, including itself, around 80.000 lines of Standard ML plus the Standard ML Basis Library. ML Basis Files, supported by both MLton and MLKit, makes it easy to compile large programs. MLKit's smart-recompilation scheme avoids recompilation upon changes of source code.
Region-Based
The MLKit integrates reference-tracing garbage collection with region-based memory management. Memory allocation directives (both allocation and deallocation) are inferred by the compiler, which uses a number of program analyses concerning lifetimes and storage layout.
Open Source
MLKit is open source; it is distributed under the GNU General Public License, version 2 (GPLv2). The runtime system and libraries are also distributed under the MIT licence, thus, executables constructed with the MLKit are non-restricted.
Region Profiling
The MLKit includes a graphical region profiler, which helps gain detailed control over memory reuse. The example graph to the right shows a region profile (region sizes as a function of time) of two hundred generations of the `Game of Life'.
Good for Real-Time
Programmers who are interested in real-time programming can exploit the possibility of disabling reference-tracing garbage collection. In this case, there will be no interruptions of unbounded duration at runtime.
Interface to C
MLKit applications can call C functions using standard C calling conventions; the region scheme can even take care of allocating and deallocating regions used by C functions thus invoked.
No-Overhead Modules
The MLKit compiles Standard ML Modules, using a compilation scheme called Static Interpretation, which eliminates Modules entirely at compile time.
Multiple Backends
MLKit generates x64 native code for Linux and macOS, and the new arm64 backend targets Apple Silicon. SMLtoJs generates JavaScript for the browser.
Hosted at Github
MLKit sources are hosted at Github, which makes it straightforward to browse code and collaborate on projects.
| From the development sources: The new arm64 backend supports native MLKit, ReML, and the REPL on Apple Silicon. |
| 2025-12-16: MLKit 4.7.17 is released and available in binary forms for Linux and macOS. A revised version of the manual is available. |
| 2022-12-29: MLKit 4.7.2 is released and available in binary forms for Linux and macOS. The release features a revised version of the manual. |
| 2021-12-31: MLKit 4.6.0 is released and available in binary forms for Linux and macOS. The release features a revised version of the manual, which reflects the changes since version 4.3.0. |
| 2021-01-31: The Online SML IDE is now more efficient and allows for linking with a dedicated Dropbox App folder. |
| 2021-01-31: The preferred library package solution to use with MLKit is now smlpkg. |
| 2021-01-31: MLKit 4.5.6 is available in binary forms for Linux and macOS. |
| 2019-07-03: MLKit 4.4.3 is released. The MLKit now generates x64 assembler on Linux and macOS... |
| ReML — Program with explicit regions and effects. |
| MLKit REPL — Work interactively with native Standard ML. |
| Online SML IDE — Compile SML programs in your browser and save your programs in a dedicated Dropbox App folder. |
| SMLtoJs — Compile SML programs into JavaScript. |
| SMLserver — Use SML on the Web server. |