There is a dozen implementations of Standard ML. MLton produces very optimized code, but has no REPL. SML/NJ is the most widely used, but has slightly difficult error messages for learning purposes. Moscow ML and Poly/ML are easy to get started with, but don't support the .mlb package format. That isn't essential for getting started, though.
Here are instructions for installing each of SML/NJ, Moscow ML and Poly/ML divided by operating system.
SML/NJ:
C:\Program Files (x86)\SML NJ\bin\sml.bat
.Moscow ML:
C:\Program Files (x86)\mosml\bin\mosml.exe
.SML/NJ:
brew install smlnj
as your own user. Test REPL with smlnj
.Moscow ML:
$PATH
now?SML/NJ:
sudo apt-get install smlnj
as the super user. Test REPL with smlnj
.Moscow ML:
(Ubuntu) Add the PPA as the super user. Test REPL with mosml
.
sudo add-apt-repository ppa:kflarsen/mosml
sudo apt-get update
sudo apt-get install mosml
In order to be able to use the arrow keys to navigate lines that were previously typed into the REPL, most of the SML compilers can benefit from the program rlwrap
. Using Homebrew on MacOS, install this by brew install rlwrap
, and on Ubuntu / Debian Linux, install this by sudo apt-get install rlwrap
. Then in the terminal, try the following:
alias mosml='rlwrap mosml -P full'
alias sml='rlwrap sml'
alias poly='rlwrap poly'
These aliases can be added to e.g. your ~/.bashrc
so they work by default.
The arrows key should now work better.