You can compile MLton with SML/NJ, however the resulting compiler will run much more slowly than MLton compiled by itself. We don’t recommend using SML/NJ as a means of porting MLton to a new platform or bootstrapping on a new platform.

If you do want to build MLton with SML/NJ, it is best to have a binary MLton package installed. If you don’t, here are some issues you may encounter when you run make smlnj-mlton.

You will get (many copies of) the error messages:

/bin/sh: mlton: command not found


make[2]: mlton: Command not found

The Makefile calls mlton to determine dependencies, and can proceed in spite of this error.

If you don’t have an mllex executable, you will get the error message:

mllex: Command not found

Building MLton requires mllex and mlyacc executables, which are distributed with a binary package of MLton. The easiest solution is to copy the front-end lexer/parser files from a different machine (ml.grm.sml, ml.grm.sig, ml.lex.sml, mlb.grm.sig, mlb.grm.sml).