ifdef::env-github[] image:https://github.com/MLton/mlton/actions/workflows/ci.yml/badge.svg[CI, link = https://github.com/MLton/mlton/actions/workflows/ci.yml] endif::[]
MLton is a whole-program optimizing compiler for the Standard{nbsp}ML programming language. MLton generates small executables with excellent runtime performance, utilizing untagged and unboxed native integers, reals, and words, unboxed native arrays, fast arbitrary-precision arithmetic based on GMP, and multiple code generation and garbage collection strategies. In addition, MLton provides a feature rich Standard{nbsp}ML programming environment, with full support for SML97 as given in The Definition of Standard{nbsp}ML (Revised), a number of useful language extensions, a complete implementation of the Standard ML Basis Library, various useful libraries, a simple and fast C foreign function interface, the ML Basis system for programming with source libraries, and tools such as a lexer generator, a parser generator, and a profiler.
== Features
Robustness.
Performance.
Tools.
Extensions.
Portability.
== Build and Install (from source)
=== Requirements
==== Software
-std=gnu11
.)ar
, ranlib
, strip
, ...)diff
, find
, grep
, gzip
, patch
, sed
, tar
, ...)mlton
) recommended. Pre-built binary packages for MLton can be installed via an OS package manager or (for select platforms) obtained from http://mlton.org
.sml
) supported, but not recommended.polyc
) supported, but not recommended.mlkit
) supported, but not recommended.==== Hardware
=== Build Instructions
On typical platforms, building MLton requires no configuration and can be accomplished via:
A small set of Makefile
variables can be used to customize the build:
CC
: Specify C compiler. Can be used for alternative tools (e.g.,
CC=clang
or CC=gcc-7
).WITH_GMP_DIR
, WITH_GMP_INC_DIR
, WITH_GMP_LIB_DIR
: Specify GMP include
and library paths, if not on default search paths. (If WITH_GMP_DIR
is
set, then WITH_GMP_INC_DIR
defaults to $(WITH_GMP_DIR)/include
and
WITH_GMP_LIB_DIR
defaults to $(WITH_GMP_DIR)/lib
.)MLTON_RUNTIME_ARGS
, MLTON_COMPILE_ARGS
: Specify runtime and compile
arguments given to (the to-be-built) mlton
when compiling distributed
executables ((self-compiled) mlton
, mllex
, mlyacc
, mlprof
, and
mlnlffigen
). Can be used for testing (e.g., MLTON_COMPILE_ARGS="-codegen c"
) or for downstream packaging.OLD_MLTON_RUNTIME_ARGS
, OLD_MLTON_COMPILE_ARGS
: Specify runtime and
compile arguments given to "old" mlton
when compiling "new" mlton
. Can be
used to work around bugs in "old" mlton
when compiling "new" mlton
.For example:
The build artifacts are located under ./build
. The just-built mlton
can be
executed via ./build/bin/mlton
.
Building documentation can be accomplished via:
=== Install Instructions
On typical platforms, installing MLton (after performing make all
and,
optionally, make docs
) to /usr/local
can be accomplished via:
A small set of Makefile
variables can be used to customize the installation:
PREFIX
: Specify the installation prefix.For example:
== Install (from binary package)
=== Requirements
==== Software
-std=gnu11
.)bzip2
, gzip
, sed
, tar
, ...)=== Binary Package
A .tgz
or .tbz
binary package can be extracted at any location, yielding
README.adoc
(this file), CHANGELOG.adoc
, LICENSE
, Makefile
, bin/
,
lib/
, and share/
. The compiler and tools can be executed in-place (e.g.,
./bin/mlton
).
A small set of Makefile
variables can be used to customize the binary package
via make update
:
CC
: Specify C compiler. Can be used for alternative tools (e.g.,
CC=clang
or CC=gcc-7
).WITH_GMP_DIR
, WITH_GMP_INC_DIR
, WITH_GMP_LIB_DIR
: Specify GMP include
and library paths, if not on default search paths. (If WITH_GMP_DIR
is
set, then WITH_GMP_INC_DIR
defaults to $(WITH_GMP_DIR)/include
and
WITH_GMP_LIB_DIR
defaults to $(WITH_GMP_DIR)/lib
.)For example:
=== Install Instructions
On typical platforms, installing MLton (after optionally performing
make update
) to /usr/local
can be accomplished via:
A small set of Makefile
variables can be used to customize the installation:
PREFIX
: Specify the installation prefix.For example:
== Resources
http://mlton.org
https://github.com/MLton/mlton
MLton-devel@mlton.org
-- MLton developers
(https://sourceforge.net/mailarchive/forum.php?forum_name=mlton-devel[archive],
https://lists.sourceforge.net/lists/listinfo/mlton-devel[subscribe])MLton-user@mlton.org
-- MLton user community
(https://sourceforge.net/mailarchive/forum.php?forum_name=mlton-user[archive],
https://lists.sourceforge.net/lists/listinfo/mlton-user[subscribe])== Support and Contributing
To report bugs or suggest new features, use the https://github.com/MLton/mlton/issues[issue tracker] or ask on the mailto:mlton-user@mlton.org[mailing list].
https://github.com/MLton/mlton/pulls[Pull requests] with bug fixes or changes are welcome.