| 1 | <!DOCTYPE html>\r |
| 2 | <html lang="en">\r |
| 3 | <head>\r |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\r |
| 5 | <meta name="generator" content="AsciiDoc 8.6.9">\r |
| 6 | <title>Features</title>\r |
| 7 | <link rel="stylesheet" href="./asciidoc.css" type="text/css">\r |
| 8 | <link rel="stylesheet" href="./pygments.css" type="text/css">\r |
| 9 | \r |
| 10 | \r |
| 11 | <script type="text/javascript" src="./asciidoc.js"></script>\r |
| 12 | <script type="text/javascript">\r |
| 13 | /*<![CDATA[*/\r |
| 14 | asciidoc.install();\r |
| 15 | /*]]>*/\r |
| 16 | </script>\r |
| 17 | <link rel="stylesheet" href="./mlton.css" type="text/css">\r |
| 18 | </head>\r |
| 19 | <body class="article">\r |
| 20 | <div id="banner">\r |
| 21 | <div id="banner-home">\r |
| 22 | <a href="./Home">MLton 20180207</a>\r |
| 23 | </div>\r |
| 24 | </div>\r |
| 25 | <div id="header">\r |
| 26 | <h1>Features</h1>\r |
| 27 | </div>\r |
| 28 | <div id="content">\r |
| 29 | <div id="preamble">\r |
| 30 | <div class="sectionbody">\r |
| 31 | <div class="paragraph"><p>MLton has the following features.</p></div>\r |
| 32 | </div>\r |
| 33 | </div>\r |
| 34 | <div class="sect1">\r |
| 35 | <h2 id="_portability">Portability</h2>\r |
| 36 | <div class="sectionbody">\r |
| 37 | <div class="ulist"><ul>\r |
| 38 | <li>\r |
| 39 | <p>\r |
| 40 | Runs on a variety of platforms.\r |
| 41 | </p>\r |
| 42 | <div class="ulist"><ul>\r |
| 43 | <li>\r |
| 44 | <p>\r |
| 45 | <a href="RunningOnARM">ARM</a>:\r |
| 46 | </p>\r |
| 47 | <div class="ulist"><ul>\r |
| 48 | <li>\r |
| 49 | <p>\r |
| 50 | <a href="RunningOnLinux">Linux</a> (Debian)\r |
| 51 | </p>\r |
| 52 | </li>\r |
| 53 | </ul></div>\r |
| 54 | </li>\r |
| 55 | <li>\r |
| 56 | <p>\r |
| 57 | <a href="RunningOnAlpha">Alpha</a>:\r |
| 58 | </p>\r |
| 59 | <div class="ulist"><ul>\r |
| 60 | <li>\r |
| 61 | <p>\r |
| 62 | <a href="RunningOnLinux">Linux</a> (Debian)\r |
| 63 | </p>\r |
| 64 | </li>\r |
| 65 | </ul></div>\r |
| 66 | </li>\r |
| 67 | <li>\r |
| 68 | <p>\r |
| 69 | <a href="RunningOnAMD64">AMD64</a>:\r |
| 70 | </p>\r |
| 71 | <div class="ulist"><ul>\r |
| 72 | <li>\r |
| 73 | <p>\r |
| 74 | <a href="RunningOnDarwin">Darwin</a> (Mac OS X)\r |
| 75 | </p>\r |
| 76 | </li>\r |
| 77 | <li>\r |
| 78 | <p>\r |
| 79 | <a href="RunningOnFreeBSD">FreeBSD</a>\r |
| 80 | </p>\r |
| 81 | </li>\r |
| 82 | <li>\r |
| 83 | <p>\r |
| 84 | <a href="RunningOnLinux">Linux</a> (Debian, Fedora, Ubuntu, …)\r |
| 85 | </p>\r |
| 86 | </li>\r |
| 87 | <li>\r |
| 88 | <p>\r |
| 89 | <a href="RunningOnOpenBSD">OpenBSD</a>\r |
| 90 | </p>\r |
| 91 | </li>\r |
| 92 | <li>\r |
| 93 | <p>\r |
| 94 | <a href="RunningOnSolaris">Solaris</a> (10 and above)\r |
| 95 | </p>\r |
| 96 | </li>\r |
| 97 | </ul></div>\r |
| 98 | </li>\r |
| 99 | <li>\r |
| 100 | <p>\r |
| 101 | <a href="RunningOnHPPA">HPPA</a>:\r |
| 102 | </p>\r |
| 103 | <div class="ulist"><ul>\r |
| 104 | <li>\r |
| 105 | <p>\r |
| 106 | <a href="RunningOnHPUX">HPUX</a> (11.11 and above)\r |
| 107 | </p>\r |
| 108 | </li>\r |
| 109 | <li>\r |
| 110 | <p>\r |
| 111 | <a href="RunningOnLinux">Linux</a> (Debian)\r |
| 112 | </p>\r |
| 113 | </li>\r |
| 114 | </ul></div>\r |
| 115 | </li>\r |
| 116 | <li>\r |
| 117 | <p>\r |
| 118 | <a href="RunningOnIA64">IA64</a>:\r |
| 119 | </p>\r |
| 120 | <div class="ulist"><ul>\r |
| 121 | <li>\r |
| 122 | <p>\r |
| 123 | <a href="RunningOnHPUX">HPUX</a> (11.11 and above)\r |
| 124 | </p>\r |
| 125 | </li>\r |
| 126 | <li>\r |
| 127 | <p>\r |
| 128 | <a href="RunningOnLinux">Linux</a> (Debian)\r |
| 129 | </p>\r |
| 130 | </li>\r |
| 131 | </ul></div>\r |
| 132 | </li>\r |
| 133 | <li>\r |
| 134 | <p>\r |
| 135 | <a href="RunningOnPowerPC">PowerPC</a>:\r |
| 136 | </p>\r |
| 137 | <div class="ulist"><ul>\r |
| 138 | <li>\r |
| 139 | <p>\r |
| 140 | <a href="RunningOnAIX">AIX</a> (5.2 and above)\r |
| 141 | </p>\r |
| 142 | </li>\r |
| 143 | <li>\r |
| 144 | <p>\r |
| 145 | <a href="RunningOnDarwin">Darwin</a> (Mac OS X)\r |
| 146 | </p>\r |
| 147 | </li>\r |
| 148 | <li>\r |
| 149 | <p>\r |
| 150 | <a href="RunningOnLinux">Linux</a> (Debian, Fedora, …)\r |
| 151 | </p>\r |
| 152 | </li>\r |
| 153 | </ul></div>\r |
| 154 | </li>\r |
| 155 | <li>\r |
| 156 | <p>\r |
| 157 | <a href="RunningOnPowerPC64">PowerPC64</a>:\r |
| 158 | </p>\r |
| 159 | <div class="ulist"><ul>\r |
| 160 | <li>\r |
| 161 | <p>\r |
| 162 | <a href="RunningOnAIX">AIX</a> (5.2 and above)\r |
| 163 | </p>\r |
| 164 | </li>\r |
| 165 | </ul></div>\r |
| 166 | </li>\r |
| 167 | <li>\r |
| 168 | <p>\r |
| 169 | <a href="RunningOnS390">S390</a>\r |
| 170 | </p>\r |
| 171 | <div class="ulist"><ul>\r |
| 172 | <li>\r |
| 173 | <p>\r |
| 174 | <a href="RunningOnLinux">Linux</a> (Debian)\r |
| 175 | </p>\r |
| 176 | </li>\r |
| 177 | </ul></div>\r |
| 178 | </li>\r |
| 179 | <li>\r |
| 180 | <p>\r |
| 181 | <a href="RunningOnSparc">Sparc</a>\r |
| 182 | </p>\r |
| 183 | <div class="ulist"><ul>\r |
| 184 | <li>\r |
| 185 | <p>\r |
| 186 | <a href="RunningOnLinux">Linux</a> (Debian)\r |
| 187 | </p>\r |
| 188 | </li>\r |
| 189 | <li>\r |
| 190 | <p>\r |
| 191 | <a href="RunningOnSolaris">Solaris</a> (8 and above)\r |
| 192 | </p>\r |
| 193 | </li>\r |
| 194 | </ul></div>\r |
| 195 | </li>\r |
| 196 | <li>\r |
| 197 | <p>\r |
| 198 | <a href="RunningOnX86">X86</a>:\r |
| 199 | </p>\r |
| 200 | <div class="ulist"><ul>\r |
| 201 | <li>\r |
| 202 | <p>\r |
| 203 | <a href="RunningOnCygwin">Cygwin</a>/Windows\r |
| 204 | </p>\r |
| 205 | </li>\r |
| 206 | <li>\r |
| 207 | <p>\r |
| 208 | <a href="RunningOnDarwin">Darwin</a> (Mac OS X)\r |
| 209 | </p>\r |
| 210 | </li>\r |
| 211 | <li>\r |
| 212 | <p>\r |
| 213 | <a href="RunningOnFreeBSD">FreeBSD</a>\r |
| 214 | </p>\r |
| 215 | </li>\r |
| 216 | <li>\r |
| 217 | <p>\r |
| 218 | <a href="RunningOnLinux">Linux</a> (Debian, Fedora, Ubuntu, …)\r |
| 219 | </p>\r |
| 220 | </li>\r |
| 221 | <li>\r |
| 222 | <p>\r |
| 223 | <a href="RunningOnMinGW">MinGW</a>/Windows\r |
| 224 | </p>\r |
| 225 | </li>\r |
| 226 | <li>\r |
| 227 | <p>\r |
| 228 | <a href="RunningOnNetBSD">NetBSD</a>\r |
| 229 | </p>\r |
| 230 | </li>\r |
| 231 | <li>\r |
| 232 | <p>\r |
| 233 | <a href="RunningOnOpenBSD">OpenBSD</a>\r |
| 234 | </p>\r |
| 235 | </li>\r |
| 236 | <li>\r |
| 237 | <p>\r |
| 238 | <a href="RunningOnSolaris">Solaris</a> (10 and above)\r |
| 239 | </p>\r |
| 240 | </li>\r |
| 241 | </ul></div>\r |
| 242 | </li>\r |
| 243 | </ul></div>\r |
| 244 | </li>\r |
| 245 | </ul></div>\r |
| 246 | </div>\r |
| 247 | </div>\r |
| 248 | <div class="sect1">\r |
| 249 | <h2 id="_robustness">Robustness</h2>\r |
| 250 | <div class="sectionbody">\r |
| 251 | <div class="ulist"><ul>\r |
| 252 | <li>\r |
| 253 | <p>\r |
| 254 | Supports the full SML 97 language as given in <a href="DefinitionOfStandardML">The Definition of Standard ML (Revised)</a>.\r |
| 255 | </p>\r |
| 256 | <div class="paragraph"><p>If there is a program that is valid according to the\r |
| 257 | <a href="DefinitionOfStandardML">Definition</a> that is rejected by MLton, or a\r |
| 258 | program that is invalid according to the\r |
| 259 | <a href="DefinitionOfStandardML">Definition</a> that is accepted by MLton, it is\r |
| 260 | a bug. For a list of known bugs, see <a href="UnresolvedBugs">UnresolvedBugs</a>.</p></div>\r |
| 261 | </li>\r |
| 262 | <li>\r |
| 263 | <p>\r |
| 264 | A complete implementation of the <a href="BasisLibrary">Basis Library</a>.\r |
| 265 | </p>\r |
| 266 | <div class="paragraph"><p>MLton’s implementation matches latest <a href="BasisLibrary">Basis Library</a>\r |
| 267 | <a href="http://www.standardml.org/Basis">specification</a>, and includes a\r |
| 268 | complete implementation of all the required modules, as well as many\r |
| 269 | of the optional modules.</p></div>\r |
| 270 | </li>\r |
| 271 | <li>\r |
| 272 | <p>\r |
| 273 | Generates standalone executables.\r |
| 274 | </p>\r |
| 275 | <div class="paragraph"><p>No additional code or libraries are necessary in order to run an\r |
| 276 | executable, except for the standard shared libraries. MLton can also\r |
| 277 | generate statically linked executables.</p></div>\r |
| 278 | </li>\r |
| 279 | <li>\r |
| 280 | <p>\r |
| 281 | Compiles large programs.\r |
| 282 | </p>\r |
| 283 | <div class="paragraph"><p>MLton is sufficiently efficient and robust that it can compile large\r |
| 284 | programs, including itself (over 190K lines). The distributed version\r |
| 285 | of MLton was compiled by MLton.</p></div>\r |
| 286 | </li>\r |
| 287 | <li>\r |
| 288 | <p>\r |
| 289 | Support for large amounts of memory (up to 4G on 32-bit systems; more on 64-bit systems).\r |
| 290 | </p>\r |
| 291 | </li>\r |
| 292 | <li>\r |
| 293 | <p>\r |
| 294 | Support for large array lengths (up to 2<sup>31</sup>-1 on 32-bit systems; up to 2<sup>63</sup>-1 on 64-bit systems).\r |
| 295 | </p>\r |
| 296 | </li>\r |
| 297 | <li>\r |
| 298 | <p>\r |
| 299 | Support for large files, using 64-bit file positions.\r |
| 300 | </p>\r |
| 301 | </li>\r |
| 302 | </ul></div>\r |
| 303 | </div>\r |
| 304 | </div>\r |
| 305 | <div class="sect1">\r |
| 306 | <h2 id="_performance">Performance</h2>\r |
| 307 | <div class="sectionbody">\r |
| 308 | <div class="ulist"><ul>\r |
| 309 | <li>\r |
| 310 | <p>\r |
| 311 | Executables have <a href="Performance">excellent running times</a>.\r |
| 312 | </p>\r |
| 313 | </li>\r |
| 314 | <li>\r |
| 315 | <p>\r |
| 316 | Generates small executables.\r |
| 317 | </p>\r |
| 318 | <div class="paragraph"><p>MLton takes advantage of whole-program compilation to perform very\r |
| 319 | aggressive dead-code elimination, which often leads to smaller\r |
| 320 | executables than with other SML compilers.</p></div>\r |
| 321 | </li>\r |
| 322 | <li>\r |
| 323 | <p>\r |
| 324 | Untagged and unboxed native integers, reals, and words.\r |
| 325 | </p>\r |
| 326 | <div class="paragraph"><p>In MLton, integers and words are 8 bits, 16 bits, 32 bits, and 64 bits\r |
| 327 | and arithmetic does not have any overhead due to tagging or boxing.\r |
| 328 | Also, reals (32-bit and 64-bit) are stored unboxed, avoiding any\r |
| 329 | overhead due to boxing.</p></div>\r |
| 330 | </li>\r |
| 331 | <li>\r |
| 332 | <p>\r |
| 333 | Unboxed native arrays.\r |
| 334 | </p>\r |
| 335 | <div class="paragraph"><p>In MLton, an array (or vector) of integers, reals, or words uses the\r |
| 336 | natural C-like representation. This is fast and supports easy\r |
| 337 | exchange of data with C. Monomorphic arrays (and vectors) use the\r |
| 338 | same C-like representations as their polymorphic counterparts.</p></div>\r |
| 339 | </li>\r |
| 340 | <li>\r |
| 341 | <p>\r |
| 342 | Multiple <a href="GarbageCollection">garbage collection</a> strategies.\r |
| 343 | </p>\r |
| 344 | </li>\r |
| 345 | <li>\r |
| 346 | <p>\r |
| 347 | Fast arbitrary precision arithmetic (<span class="monospaced">IntInf</span>) based on <a href="GnuMP">GnuMP</a>.\r |
| 348 | </p>\r |
| 349 | <div class="paragraph"><p>For <span class="monospaced">IntInf</span> intensive programs, MLton can be an order of magnitude or\r |
| 350 | more faster than Poly/ML or SML/NJ.</p></div>\r |
| 351 | </li>\r |
| 352 | </ul></div>\r |
| 353 | </div>\r |
| 354 | </div>\r |
| 355 | <div class="sect1">\r |
| 356 | <h2 id="_tools">Tools</h2>\r |
| 357 | <div class="sectionbody">\r |
| 358 | <div class="ulist"><ul>\r |
| 359 | <li>\r |
| 360 | <p>\r |
| 361 | Source-level <a href="Profiling">Profiling</a> of both time and allocation.\r |
| 362 | </p>\r |
| 363 | </li>\r |
| 364 | <li>\r |
| 365 | <p>\r |
| 366 | <a href="MLLex">MLLex</a> lexer generator\r |
| 367 | </p>\r |
| 368 | </li>\r |
| 369 | <li>\r |
| 370 | <p>\r |
| 371 | <a href="MLYacc">MLYacc</a> parser generator\r |
| 372 | </p>\r |
| 373 | </li>\r |
| 374 | <li>\r |
| 375 | <p>\r |
| 376 | <a href="MLNLFFIGen">MLNLFFIGen</a> foreign-function-interface generator\r |
| 377 | </p>\r |
| 378 | </li>\r |
| 379 | </ul></div>\r |
| 380 | </div>\r |
| 381 | </div>\r |
| 382 | <div class="sect1">\r |
| 383 | <h2 id="_extensions">Extensions</h2>\r |
| 384 | <div class="sectionbody">\r |
| 385 | <div class="ulist"><ul>\r |
| 386 | <li>\r |
| 387 | <p>\r |
| 388 | A simple and fast C <a href="ForeignFunctionInterface">ForeignFunctionInterface</a> that supports calling from SML to C and from C to SML.\r |
| 389 | </p>\r |
| 390 | </li>\r |
| 391 | <li>\r |
| 392 | <p>\r |
| 393 | The <a href="MLBasis">ML Basis system</a> for programming in the very large, separate delivery of library sources, and more.\r |
| 394 | </p>\r |
| 395 | </li>\r |
| 396 | <li>\r |
| 397 | <p>\r |
| 398 | A number of extension libraries that provide useful functionality\r |
| 399 | that cannot be implemented with the <a href="BasisLibrary">Basis Library</a>.\r |
| 400 | See below for an overview and <a href="MLtonStructure">MLtonStructure</a> for details.\r |
| 401 | </p>\r |
| 402 | <div class="ulist"><ul>\r |
| 403 | <li>\r |
| 404 | <p>\r |
| 405 | <a href="MLtonCont">continuations</a>\r |
| 406 | </p>\r |
| 407 | <div class="paragraph"><p>MLton supports continuations via <span class="monospaced">callcc</span> and <span class="monospaced">throw</span>.</p></div>\r |
| 408 | </li>\r |
| 409 | <li>\r |
| 410 | <p>\r |
| 411 | <a href="MLtonFinalizable">finalization</a>\r |
| 412 | </p>\r |
| 413 | <div class="paragraph"><p>MLton supports finalizable values of arbitrary type.</p></div>\r |
| 414 | </li>\r |
| 415 | <li>\r |
| 416 | <p>\r |
| 417 | <a href="MLtonItimer">interval timers</a>\r |
| 418 | </p>\r |
| 419 | <div class="paragraph"><p>MLton supports the functionality of the C <span class="monospaced">setitimer</span> function.</p></div>\r |
| 420 | </li>\r |
| 421 | <li>\r |
| 422 | <p>\r |
| 423 | <a href="MLtonRandom">random numbers</a>\r |
| 424 | </p>\r |
| 425 | <div class="paragraph"><p>MLton has functions similar to the C <span class="monospaced">rand</span> and <span class="monospaced">srand</span> functions, as well as support for access to <span class="monospaced">/dev/random</span> and <span class="monospaced">/dev/urandom</span>.</p></div>\r |
| 426 | </li>\r |
| 427 | <li>\r |
| 428 | <p>\r |
| 429 | <a href="MLtonRlimit">resource limits</a>\r |
| 430 | </p>\r |
| 431 | <div class="paragraph"><p>MLton has functions similar to the C <span class="monospaced">getrlimit</span> and <span class="monospaced">setrlimit</span> functions.</p></div>\r |
| 432 | </li>\r |
| 433 | <li>\r |
| 434 | <p>\r |
| 435 | <a href="MLtonRusage">resource usage</a>\r |
| 436 | </p>\r |
| 437 | <div class="paragraph"><p>MLton supports a subset of the functionality of the C <span class="monospaced">getrusage</span> function.</p></div>\r |
| 438 | </li>\r |
| 439 | <li>\r |
| 440 | <p>\r |
| 441 | <a href="MLtonSignal">signal handlers</a>\r |
| 442 | </p>\r |
| 443 | <div class="paragraph"><p>MLton supports signal handlers written in SML. Signal handlers run in\r |
| 444 | a separate MLton thread, and have access to the thread that was\r |
| 445 | interrupted by the signal. Signal handlers can be used in conjunction\r |
| 446 | with threads to implement preemptive multitasking.</p></div>\r |
| 447 | </li>\r |
| 448 | <li>\r |
| 449 | <p>\r |
| 450 | <a href="MLtonStructure">size primitive</a>\r |
| 451 | </p>\r |
| 452 | <div class="paragraph"><p>MLton includes a primitive that returns the size (in bytes) of any\r |
| 453 | object. This can be useful in understanding the space behavior of a\r |
| 454 | program.</p></div>\r |
| 455 | </li>\r |
| 456 | <li>\r |
| 457 | <p>\r |
| 458 | <a href="MLtonSyslog">system logging</a>\r |
| 459 | </p>\r |
| 460 | <div class="paragraph"><p>MLton has a complete interface to the C <span class="monospaced">syslog</span> function.</p></div>\r |
| 461 | </li>\r |
| 462 | <li>\r |
| 463 | <p>\r |
| 464 | <a href="MLtonThread">threads</a>\r |
| 465 | </p>\r |
| 466 | <div class="paragraph"><p>MLton has support for its own threads, upon which either preemptive or\r |
| 467 | non-preemptive multitasking can be implemented. MLton also has\r |
| 468 | support for <a href="ConcurrentML">Concurrent ML</a> (CML).</p></div>\r |
| 469 | </li>\r |
| 470 | <li>\r |
| 471 | <p>\r |
| 472 | <a href="MLtonWeak">weak pointers</a>\r |
| 473 | </p>\r |
| 474 | <div class="paragraph"><p>MLton supports weak pointers, which allow the garbage collector to\r |
| 475 | reclaim objects that it would otherwise be forced to keep. Weak\r |
| 476 | pointers are also used to provide finalization.</p></div>\r |
| 477 | </li>\r |
| 478 | <li>\r |
| 479 | <p>\r |
| 480 | <a href="MLtonWorld">world save and restore</a>\r |
| 481 | </p>\r |
| 482 | <div class="paragraph"><p>MLton has a facility for saving the entire state of a computation to a\r |
| 483 | file and restarting it later. This facility can be used for staging\r |
| 484 | and for checkpointing computations. It can even be used from within\r |
| 485 | signal handlers, allowing interrupt driven checkpointing.</p></div>\r |
| 486 | </li>\r |
| 487 | </ul></div>\r |
| 488 | </li>\r |
| 489 | </ul></div>\r |
| 490 | </div>\r |
| 491 | </div>\r |
| 492 | </div>\r |
| 493 | <div id="footnotes"><hr></div>\r |
| 494 | <div id="footer">\r |
| 495 | <div id="footer-text">\r |
| 496 | </div>\r |
| 497 | <div id="footer-badges">\r |
| 498 | </div>\r |
| 499 | </div>\r |
| 500 | </body>\r |
| 501 | </html>\r |