To compile with MLton, you need the binary versions of mlton, mllex, and mlyacc that come with the binary rpm or tgz. To compile, run make from within the src directory.
% make mlyacc front-end/ml.grm 1 shift/reduce conflict mllex front-end/ml.lex Number of states = 278 Number of distinct rows = 183 Approx. memory size of trans. table = 188856 bytes Compiling mlton (takes a while) time mlton @MLton -- -v -o mlton-compile mlton.cm MLton starting Compile SML starting pre codegen starting ...This calls mlyacc and mllex to build the parser and lexer, and then calls mlton to compile itself.
Compiling MLton requires at least 400m of memory. By default, MLton limits itself to using 85% of the total RAM available on your machine. Thus, if your machine has less than 512m, it is likely that self-compilation will fail. Even if you have enough memory, there simply may not be enough available, due to memory consumed by other processes. In this case, you will likely see the following error during self-compilation.
mmap failed (Cannot allocate memory)The only fix is to make sure that enough virtual memory is available.
You can force MLton to use swap space, but we do not recommend it because MLton's two-space stop-and-copy gc means that MLton has a large working set. Nevertheless, if you would like to force MLton to use swap space, and you have at least 400m combined swap plus RAM, you can change the FLAGS line in src/mlton/Makefile to something like the following.
FLAGS = @MLton max-heap 400m -- -v -o $(AOUT)