Just to be extremely clear, SML / NJ is not a strictly interpreter. This is a compiler that just has REPL. The best way to achieve what you are proposing is to create a cumulus image (basically a compiled binary file ready to be loaded by the SML / NJ runtime system) and then run it directly using sml @SMLload=heapfile.img , where heapfile.img is the name of the heap file created. You can also pass @SMLquiet as a command line parameter. This will stop any output when loading the heap file.
You can also just compile the program into something that you can run autonomously, in which case you might like the MLton compiler.
source share