How to run stand-alone scripts with SML / NJ?

How to use SML / NJ to run a script that reads from STDIN and writes to STDOUT? Is there any way to get rid of the result of the interpreter itself?

+4
source share
1 answer

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.

+3
source

Source: https://habr.com/ru/post/1381977/


All Articles