| 1 |
= Features |
| 2 |
|
| 3 |
MLton has the following features. |
| 4 |
|
| 5 |
== Robustness |
| 6 |
|
| 7 |
* Supports the full SML{nbsp}97 language as given in <<DefinitionOfStandardML#,The Definition of Standard{nbsp}ML (Revised)>>. |
| 8 |
+ |
| 9 |
If there is a program that is valid according to the |
| 10 |
<<DefinitionOfStandardML#,Definition>> that is rejected by MLton, or a |
| 11 |
program that is invalid according to the |
| 12 |
<<DefinitionOfStandardML#,Definition>> that is accepted by MLton, it is |
| 13 |
a bug. For a list of known bugs, see <<UnresolvedBugs#>>. |
| 14 |
|
| 15 |
* A complete implementation of the <<BasisLibrary#,Basis Library>>. |
| 16 |
+ |
| 17 |
MLton's implementation matches latest <<BasisLibrary#,Basis Library>> |
| 18 |
https://smlfamily.github.io/Basis[specification], and includes a |
| 19 |
complete implementation of all the required modules, as well as many |
| 20 |
of the optional modules. |
| 21 |
|
| 22 |
* Generates standalone executables. |
| 23 |
+ |
| 24 |
No additional code or libraries are necessary in order to run an |
| 25 |
executable, except for the standard shared libraries. MLton can also |
| 26 |
generate statically linked executables. |
| 27 |
|
| 28 |
* Compiles large programs. |
| 29 |
+ |
| 30 |
MLton is sufficiently efficient and robust that it can compile large |
| 31 |
programs, including itself (over 190K lines). The distributed version |
| 32 |
of MLton was compiled by MLton. |
| 33 |
|
| 34 |
* Support for large amounts of memory (up to 4G on 32-bit systems; more on 64-bit systems). |
| 35 |
|
| 36 |
* Support for large array lengths (up to 2^31^-1 on 32-bit systems; up to 2^63^-1 on 64-bit systems). |
| 37 |
|
| 38 |
* Support for large files, using 64-bit file positions. |
| 39 |
|
| 40 |
== Performance |
| 41 |
|
| 42 |
* Executables have <<Performance#,excellent runtime performance>>. |
| 43 |
|
| 44 |
* Generates small executables. |
| 45 |
+ |
| 46 |
MLton takes advantage of whole-program compilation to perform very |
| 47 |
aggressive dead-code elimination, which often leads to smaller |
| 48 |
executables than with other SML compilers. |
| 49 |
|
| 50 |
* Untagged and unboxed native integers, reals, and words. |
| 51 |
+ |
| 52 |
In MLton, integers and words are 8 bits, 16 bits, 32 bits, and 64 bits |
| 53 |
and arithmetic does not have any overhead due to tagging or boxing. |
| 54 |
Also, reals (32-bit and 64-bit) are stored unboxed, avoiding any |
| 55 |
overhead due to boxing. |
| 56 |
|
| 57 |
* Unboxed native arrays. |
| 58 |
+ |
| 59 |
In MLton, an array (or vector) of integers, reals, or words uses the |
| 60 |
natural C-like representation. This is fast and supports easy |
| 61 |
exchange of data with C. Monomorphic arrays (and vectors) use the |
| 62 |
same C-like representations as their polymorphic counterparts. |
| 63 |
|
| 64 |
* Multiple <<GarbageCollection#,garbage collection>> strategies. |
| 65 |
|
| 66 |
* Fast arbitrary precision arithmetic (`IntInf`) based on <<GMP#>>. |
| 67 |
+ |
| 68 |
For `IntInf` intensive programs, MLton can be an order of magnitude or |
| 69 |
more faster than Poly/ML or SML/NJ. |
| 70 |
|
| 71 |
== Tools |
| 72 |
|
| 73 |
* Source-level <<Profiling#>> of both time and allocation. |
| 74 |
* <<MLLex#>> lexer generator |
| 75 |
* <<MLYacc#>> parser generator |
| 76 |
* <<MLNLFFIGen#>> foreign-function-interface generator |
| 77 |
|
| 78 |
== Extensions |
| 79 |
|
| 80 |
* The <<MLBasis#,ML Basis system>> for programming in the very large, separate delivery of library sources, and more. |
| 81 |
|
| 82 |
* A number of useful <<SuccessorML#,language extensions>>. |
| 83 |
|
| 84 |
* A simple and fast C <<ForeignFunctionInterface#>> that supports calling from SML to C and from C to SML. |
| 85 |
|
| 86 |
* A number of extension libraries that provide useful functionality |
| 87 |
that cannot be implemented with the <<BasisLibrary#,Basis Library>>. |
| 88 |
See below for an overview and <<MLtonStructure#>> for details. |
| 89 |
|
| 90 |
** <<MLtonCont#,continuations>> |
| 91 |
+ |
| 92 |
MLton supports continuations via `callcc` and `throw`. |
| 93 |
|
| 94 |
** <<MLtonFinalizable#,finalization>> |
| 95 |
+ |
| 96 |
MLton supports finalizable values of arbitrary type. |
| 97 |
|
| 98 |
** <<MLtonItimer#,interval timers>> |
| 99 |
+ |
| 100 |
MLton supports the functionality of the C `setitimer` function. |
| 101 |
|
| 102 |
** <<MLtonRandom#,random numbers>> |
| 103 |
+ |
| 104 |
MLton has functions similar to the C `rand` and `srand` functions, as well as support for access to `/dev/random` and `/dev/urandom`. |
| 105 |
|
| 106 |
** <<MLtonRlimit#,resource limits>> |
| 107 |
+ |
| 108 |
MLton has functions similar to the C `getrlimit` and `setrlimit` functions. |
| 109 |
|
| 110 |
** <<MLtonRusage#,resource usage>> |
| 111 |
+ |
| 112 |
MLton supports a subset of the functionality of the C `getrusage` function. |
| 113 |
|
| 114 |
** <<MLtonSignal#,signal handlers>> |
| 115 |
+ |
| 116 |
MLton supports signal handlers written in SML. Signal handlers run in |
| 117 |
a separate MLton thread, and have access to the thread that was |
| 118 |
interrupted by the signal. Signal handlers can be used in conjunction |
| 119 |
with threads to implement preemptive multitasking. |
| 120 |
|
| 121 |
** <<MLtonStructure#,size primitive>> |
| 122 |
+ |
| 123 |
MLton includes a primitive that returns the size (in bytes) of any |
| 124 |
object. This can be useful in understanding the space behavior of a |
| 125 |
program. |
| 126 |
|
| 127 |
** <<MLtonSyslog#,system logging>> |
| 128 |
+ |
| 129 |
MLton has a complete interface to the C `syslog` function. |
| 130 |
|
| 131 |
** <<MLtonThread#,threads>> |
| 132 |
+ |
| 133 |
MLton has support for its own threads, upon which either preemptive or |
| 134 |
non-preemptive multitasking can be implemented. MLton also has |
| 135 |
support for <<ConcurrentML#,Concurrent ML>> (CML). |
| 136 |
|
| 137 |
** <<MLtonWeak#,weak pointers>> |
| 138 |
+ |
| 139 |
MLton supports weak pointers, which allow the garbage collector to |
| 140 |
reclaim objects that it would otherwise be forced to keep. Weak |
| 141 |
pointers are also used to provide finalization. |
| 142 |
|
| 143 |
** <<MLtonWorld#,world save and restore>> |
| 144 |
+ |
| 145 |
MLton has a facility for saving the entire state of a computation to a |
| 146 |
file and restarting it later. This facility can be used for staging |
| 147 |
and for checkpointing computations. It can even be used from within |
| 148 |
signal handlers, allowing interrupt driven checkpointing. |
| 149 |
|
| 150 |
== Portability |
| 151 |
|
| 152 |
* Runs on a wide variety of platforms. |
| 153 |
|
| 154 |
** <<RunningOnARM#,ARM>>: |
| 155 |
*** <<RunningOnLinux#,Linux>> (Debian) |
| 156 |
*** <<RunningOnFreeBSD#,FreeBSD>> |
| 157 |
|
| 158 |
** <<RunningOnAlpha#,Alpha>>: |
| 159 |
*** <<RunningOnLinux#,Linux>> (Debian) |
| 160 |
|
| 161 |
** <<RunningOnAMD64#,AMD64>>: |
| 162 |
*** <<RunningOnDarwin#,Darwin>> (Mac OS X) |
| 163 |
*** <<RunningOnFreeBSD#,FreeBSD>> |
| 164 |
*** <<RunningOnLinux#,Linux>> (Debian, Fedora, Ubuntu, ...) |
| 165 |
*** <<RunningOnOpenBSD#,OpenBSD>> |
| 166 |
*** <<RunningOnSolaris#,Solaris>> (10 and above) |
| 167 |
|
| 168 |
** <<RunningOnHPPA#,HPPA>>: |
| 169 |
*** <<RunningOnHPUX#,HPUX>> (11.11 and above) |
| 170 |
*** <<RunningOnLinux#,Linux>> (Debian) |
| 171 |
|
| 172 |
** <<RunningOnIA64#,IA64>>: |
| 173 |
*** <<RunningOnHPUX#,HPUX>> (11.11 and above) |
| 174 |
*** <<RunningOnLinux#,Linux>> (Debian) |
| 175 |
|
| 176 |
** <<RunningOnPowerPC#,PowerPC>>: |
| 177 |
*** <<RunningOnAIX#,AIX>> (5.2 and above) |
| 178 |
*** <<RunningOnDarwin#,Darwin>> (Mac OS X) |
| 179 |
*** <<RunningOnLinux#,Linux>> (Debian, Fedora, ...) |
| 180 |
|
| 181 |
** <<RunningOnPowerPC64#,PowerPC64>>: |
| 182 |
*** <<RunningOnAIX#,AIX>> (5.2 and above) |
| 183 |
|
| 184 |
** <<RunningOnS390#,S390>> |
| 185 |
*** <<RunningOnLinux#,Linux>> (Debian) |
| 186 |
|
| 187 |
** <<RunningOnSparc#,Sparc>> |
| 188 |
*** <<RunningOnLinux#,Linux>> (Debian) |
| 189 |
*** <<RunningOnSolaris#,Solaris>> (8 and above) |
| 190 |
|
| 191 |
** <<RunningOnX86#,X86>>: |
| 192 |
*** <<RunningOnCygwin#,Cygwin>>/Windows |
| 193 |
*** <<RunningOnDarwin#,Darwin>> (Mac OS X) |
| 194 |
*** <<RunningOnFreeBSD#,FreeBSD>> |
| 195 |
*** <<RunningOnLinux#,Linux>> (Debian, Fedora, Ubuntu, ...) |
| 196 |
*** <<RunningOnMinGW#,MinGW>>/Windows |
| 197 |
*** <<RunningOnNetBSD#,NetBSD>> |
| 198 |
*** <<RunningOnOpenBSD#,OpenBSD>> |
| 199 |
*** <<RunningOnSolaris#,Solaris>> (10 and above) |