MLton requires that you have the GNU multiprecision library installed on your machine. MLton must be able to find both the gmp.h include file and the libgmp.a or libgmp.so library. If you see the error message gmp.h: No such file or directory, you should copy gmp.h to /usr/lib/mlton/self/include. If you see the error message /usr/bin/ld: cannot find -lgmp, you should add a -link-opt -L argument in the /usr/bin/mlton script so that the linker can find libgmp. If, for example, libgmp.a is in /tmp, then add -link-opt -L/tmp.
Installation of MLton creates the following files and directories.
-
/usr/bin/mllex
-
/usr/bin/mlnlffigen
-
/usr/bin/mlprof
-
/usr/bin/mlton
-
/usr/bin/mlyacc
-
/usr/lib/mlton
-
/usr/share/man/man1/mllex.1, mlnlffigen.1, mlprof.1, mlton.1, mlyacc.1
-
/usr/share/doc/mlton
-
The MLLex lexer generator.
-
The ML-NLFFI tool.
-
A Profiling tool.
-
A script to call the compiler. This script may be moved anywhere, however, it makes use of files in /usr/lib/mlton.
-
The MLYacc parser generator.
-
Directory containing libraries and include files needed during compilation.
-
Man pages.
-
Directory containing the user guide for MLton, mllex, and mlyacc, as well as example SML programs (in the examples dir), and license information.
Hello, World!
Once you have installed MLton, create a file called hello-world.sml with the following contents.
print "Hello, world!\n";Now create an executable, hello-world, with the following command.
mlton hello-world.smlYou can now run hello-world to verify that it works. There are more small examples in /usr/share/doc/mlton/examples.