1 = http://mlton.org[MLton]
4 image:https://travis-ci.org/MLton/mlton.svg?branch=master[Build Status, link = https://travis-ci.org/MLton/mlton]
8 MLton is a whole-program optimizing compiler for the Standard{nbsp}ML
14 * Portability. Runs on the following platforms:
16 - ARM: Linux (Debian).
17 - Alpha: Linux (Debian).
18 - AMD64: Darwin (Mac OS X), FreeBSD, Linux (Debian, Fedora, Ubuntu, ...),
19 OpenBSD, Solaris (10 and above).
21 - HPPA: HPUX (11.11 and above), Linux (Debian).
22 - IA64: HPUX (11.11 and above), Linux (Debian).
23 - PowerPC: AIX (5.2 and above), Darwin (Mac OS X), Linux (Debian, Fedora).
24 - PowerPC64: AIX (5.2 and above).
25 - S390: Linux (Debian).
26 - Sparc: Linux (Debian), Solaris (8 and above).
27 - X86: Cygwin/Windows, Darwin (Mac OS X), FreeBSD, Linux (Debian, Fedora,
28 Ubuntu, ...), MinGW/Windows, NetBSD, OpenBSD, Solaris (10 and above).
32 - Supports the full SML 97 language as given in The Definition of
33 Standard{nbsp}ML (Revised).
34 - A complete implementation of the Basis Library.
35 - Generates standalone executables.
36 - Compiles large programs.
37 - Support for large amounts of memory (up to 4G on 32-bit systems;
38 more on 64-bit systems).
39 - Support for large array lengths (up to 2^31^ - 1 on 32-bit systems;
40 up to 2^63^-1 on 64-bit systems).
41 - Support for large files, using 64-bit file positions.
45 - Executables have excellent running times.
46 - Generates small executables.
47 - Untagged and unboxed native integers, reals, and words.
48 - Unboxed native arrays.
49 - Multiple garbage collection strategies.
50 - Fast arbitrary-precision arithmetic based on the GMP.
54 - Source-level profiling for both time and allocation.
55 - MLLex lexer generator.
56 - MLYacc parser generator.
57 - MLNLFFIGEN foreign-function-interface generator.
61 - A simple and fast C FFI that supports calling from SML to C and from C
63 - The ML Basis system for programming in the very large.
64 - Libraries for continuations, finalization, interval timers, random numbers,
65 resource limits, resource usage, signal handlers, object size, system
66 logging, threads, weak pointers, and world save and restore.
69 == Build and Install (from source)
75 * http://gcc.gnu.org/[GCC] or http://clang.llvm.org[Clang] (The C compiler must support `-std=gnu11`.)
76 * http://gmplib.org[GMP] (GNU Multiple Precision arithmetic library)
77 * http://savannah.gnu.org/projects/make[GNU Make]
78 * http://www.gnu.org/software/bash/[GNU Bash]
79 * binutils (`ar`, `ranlib`, `strip`, ...)
80 * miscellaneous Unix utilities (`diff`, `find`, `grep`, `gzip`, `patch`, `sed`, `tar`, `xargs`, ...)
81 * Standard{nbsp}ML compiler and tools to bootstrap:
82 - http://mlton.org[MLton] (`mlton`, `mllex`, and `mlyacc`) recommended. Pre-built binary packages for MLton can be installed via an OS package manager or (for select platforms) obtained from `http://mlton.org`.
83 - http://www.smlnj.org[SML/NJ] (`sml`, `ml-lex`, `ml-yacc`) supported, but not recommended.
84 * (optional, for documentation only) https://ctan.org/tex/[TeX], http://asciidoc.org/[AsciiDoc], http://pygments.org/[Pygments], http://www.graphicsmagick.org/[GraphicsMagick] or https://www.imagemagick.org/[ImageMagick], ...
88 * ≥ 1GB RAM (for 32-bit platforms) or ≥ 2GB RAM (for 64-bit platforms)
90 === Build Instructions
92 On typical platforms, building MLton requires no configuration and can be
100 A small set of `Makefile` variables can be used to customize the build:
102 * `CC`: Specify C compiler. Can be used for alternative tools (e.g.,
103 `CC=clang` or `CC=gcc-7`).
104 * `WITH_GMP_DIR`, `WITH_GMP_INC_DIR`, `WITH_GMP_LIB_DIR`: Specify GMP include
105 and library paths, if not on default search paths. (If `WITH_GMP_DIR` is
106 set, then `WITH_GMP_INC_DIR` defaults to `$(WITH_GMP_DIR)/include` and
107 `WITH_GMP_LIB_DIR` defaults to `$(WITH_GMP_DIR)/lib`.)
108 * `MLTON_RUNTIME_ARGS`, `MLTON_COMPILE_ARGS`: Specify runtime and compile
109 arguments given to (the to-be-built) `mlton` when compiling distributed
110 executables ((self-compiled) `mlton`, `mllex`, `mlyacc`, `mlprof`, and
111 `mlnlffigen`). Can be used for testing (e.g., `MLTON_COMPILE_ARGS="-codegen
112 c"`) or for downstream packaging.
113 * `BOOTSTRAP_MLTON_RUNTIME_ARGS`, `BOOTSTRAP_MLTON_COMPILE_ARGS`: Specify
114 runtime and compile arguments given to "old" `mlton` when compiling
115 "bootstrapped" `mlton`. Can be used to work around bugs in "old" `mlton` when
116 compiling "bootstrapped" `mlton`.
122 $ make CC=clang WITH_GMP_DIR=/opt/gmp MLTON_COMPILE_ARGS="-codegen c" all
125 The build artifacts are located under `./build`. The just-built `mlton` can be
126 executed via `./build/bin/mlton`.
128 Building documentation can be accomplished via:
135 === Install Instructions
137 On typical platforms, installing MLton (after performing `make all` and,
138 optionally, `make docs`) to `/usr/local` can be accomplished via:
145 A small set of `Makefile` variables can be used to customize the installation:
147 * `PREFIX`: Specify the installation prefix.
153 $ make PREFIX=/opt/mlton install
156 == Install (from binary package)
162 * http://gcc.gnu.org/[GCC] or http://clang.llvm.org[Clang] (The C compiler must support `-std=gnu11`.)
163 * http://gmplib.org[GMP] (GNU Multiple Precision arithmetic library)
164 * http://savannah.gnu.org/projects/make[GNU Make]
165 * http://www.gnu.org/software/bash/[GNU Bash]
166 * miscellaneous Unix utilities (`bzip2`, `gzip`, `sed`, `tar`, ...)
170 A `.tgz` or `.tbz` binary package can be extracted at any location, yielding
171 `README.adoc` (this file), `CHANGELOG.adoc`, `LICENSE`, `Makefile`, `bin/`,
172 `lib/`, and `share/`. The compiler and tools can be executed in-place (e.g.,
175 A small set of `Makefile` variables can be used to customize the binary package
178 * `CC`: Specify C compiler. Can be used for alternative tools (e.g.,
179 `CC=clang` or `CC=gcc-7`).
180 * `WITH_GMP_DIR`, `WITH_GMP_INC_DIR`, `WITH_GMP_LIB_DIR`: Specify GMP include
181 and library paths, if not on default search paths. (If `WITH_GMP_DIR` is
182 set, then `WITH_GMP_INC_DIR` defaults to `$(WITH_GMP_DIR)/include` and
183 `WITH_GMP_LIB_DIR` defaults to `$(WITH_GMP_DIR)/lib`.)
189 $ make CC=clang WITH_GMP_DIR=/opt/gmp update
192 === Install Instructions
194 On typical platforms, installing MLton (after optionally performing
195 `make update`) to `/usr/local` can be accomplished via:
202 A small set of `Makefile` variables can be used to customize the installation:
204 * `PREFIX`: Specify the installation prefix.
210 $ make PREFIX=/opt/mlton install
217 - `MLton-devel@mlton.org` -- MLton developers
218 (https://sourceforge.net/mailarchive/forum.php?forum_name=mlton-devel[archive],
219 https://lists.sourceforge.net/lists/listinfo/mlton-devel[subscribe])
220 - `MLton-user@mlton.org` -- MLton user community
221 (https://sourceforge.net/mailarchive/forum.php?forum_name=mlton-user[archive],
222 https://lists.sourceforge.net/lists/listinfo/mlton-user[subscribe])
224 == Need help? Found a bug?
226 https://github.com/MLton/mlton/issues[Submit an issue] if you need any help.
227 We welcome pull requests with bug fixes or changes.