Obtaining a copy of ML (updated Oct 2011)

There are three main implementations of the standard ML language, all freely available (and open source):

You will probably have the most success using poly/ML, which can be made to run on Windows, Linux or OSX. All of them give you a simple command-line interface as per the one you see in the practicals.

If you are particularly adventurous, you might want to try compiling the version we use in the ticks (Cambridge ML): Download the source. However, it's old and buggy and often difficult to set up. One particular gotcha is that the install needs to be in a place where the path has no spaces. So "C:Program Files/whatever" won't work, but "C:/CML" would.


Cambridge ML an old implementation that has very few built-in functions. So, for example, to find the length of a list you need to write a length function in CML. In your ticks you should not rely on built in functions (i.e. anything that CML wouldn't know about).

Notes for Windows users

While MacOS X and Linux provide terminal windows with full editing capabilities, Windows is not really designed with console access in mind and there can be some tricky things. Copy and paste is a common problem, and might be solved thus:

  1. Open the command line.
  2. Click on the program icon in the top left of the window (alt + space).
  3. Select properties.
  4. Make sure that "QuickEdit Mode" is ticked.
  5. Press OK.

Once this is done, to paste code into the command line, perform one right click. Also you can highlight code by dragging a box over it. Once highlighted, you can then copy the selection by pressing enter.

Thanks to D A Wright for this tip.

Note for Mac users

The easiest way to install lots of open source software, including ML compilers, is via the package manager MacPorts. It is easy to use and installs software fairly quickly. In particular, it provides packages for all three of the main ML systems: mosml, polyml and smlnj. if you feel brave, you can also install the huge and baffling editor, emacs. Installing a package requires typing a simple command into a Terminal window:

sudo port install mosml

If you would rather use a GUI, download the application Porticus. Then, you can use its search window to find applications and you can install them by clicking the appropriate buttons.

I have written an ML Language Module for BBEdit and TextWrangler, two Macintosh text editors (TextWrangler is free!). It provides syntax colouring for keywords, strings and comments for filenames having the extension ML, sml or sig. To install for BBEdit, first quit the application. Then, copy the file StandardML.plist into the directory Library/Application Support/BBEdit/Language Modules/. The installation instructions for TextWrangler are analogous.