Standard ML of New Jersey (SML/NJ) is a compiler, interactive system, and programming environment for the Standard ML language. This document is a partial guide to programming in Standard ML using SML/NJ for new users.

The Standard ML Programming Language

The main web site for the Standard ML language is https://smlfamily.org. Several very useful books on the Standard ML programming language are available, and some on-line Standard ML tutorials are available. Our literature page summaries these general information sources.

Using Standard ML of New Jersey

Obtaining and installing the SML/NJ Software

SML/NJ is free and open source software, governed by a BSD 3 Clause License. For links to downloadable installers for macOS and Windows, see the README for the most recent release at Index of versions. To build the current (legacy) release from source, see the README file for the legacy repository.

The SML/NJ FAQ

A FAQ for SML/NJ is "under suspended development" and is thus still very fragmentary and incomplete.

The SML/NJ Interactive System

How to get started with sml: how to compile and run programs.

The Compilation Manager

The SML/NJ compilation manager, CM, organizes and optimizes the compilation process. CM calculates and caches the dependence graph between modules. When a module has been edited and is recompiled, CM compares the export type-signature of the new module to that of the old, to minimize the number of modules that need to be recompiled. See the CM Manual for details.

SML/NJ Error Messages

An (incomplete and outdated) explanation of the error messages printed by the SML/NJ compiler.

Special system features of SML/NJ

A set of structures, including SMLofNJ and its substructures, provides special system functionality for SML programs. Included with this group are the structures Cont and Susp that introduce first-class continuations and suspensions, respectively.

Language extensions of SML/NJ

SML/NJ supports some extensions to the Standard ML language, such as record expressions and patterns, OR patterns, and higher-order functors.

The Compiler structure

This structure contains user-settable flags to control the operation of the compiler and interactive system, and also interfaces to individual phases of the SML/NJ compiler.

SML '97 Conversion Guide

The Standard ML '97 language is almost, but not quite, compatible with the 1990 definition supported by earlier versions of SML/NJ. In the very unlikely event that one needs to convert code predating the introduction of Standard ML '97, this conversion guide explains the differences, and gives examples of how to convert SML \'90 code to be SML \'97 code.

Libraries

The Standard ML Basis Library

This library consists of the types, functions, and interfaces that are part of the ML standard, including modules for I/O, the operating-system interface, arithmetic on integers, reals, and words (unsigned integers), mathematical functions, operations on strings and substrings, and so on.

The Standard ML of New Jersey Library

The SML/NJ Library contains library and utility functions that are not part of the standard Standard. The SML/NJ library includes modules for binary search trees, adjustable arrays, and other useful data structures in the Util directory. The Unix directory supplies additional Unix-specific features, while the HTML directory supports processing web pages.

Programming Tools and Libraries

ML-Lex

A lexical-analyzer generator similar to the classic Unix lex.

ML-Yacc

A parser generator similar to the classic Unix yacc, but with syntax error repair features.

\\ [JHR?] Need better and more complete discription for the link, which is the the pdf manual. ml-lpt:: A newer set of libraries for generating lexers and parsers.

\\ This seems to be the right link for CML. Concurrent ML:: A library adding concurrency to SML.

\\ Is this the best link for eXene? eXene:: An X-windows based graphical interface toolkit.

\\ This item should be replaced by a link and description for nlffi. SMLNJ-C/index.html[SML/NJ C Interface Library]:: Lorenz Huelsbergen’s library for building SML interfaces to C libraries and programs. (Superceded by Matthias Blume’s nlffi.)

\\ Missing a link for MLRISC. Could link to the NYU Tech Report pdf. MLRISC:: The legacy SML/NJ compiler uses Lal George’s and Allen Leung’s MLRISC code generation framework (currently used only for AMD64 = x86-64).

\\ This seems to be the up-to-date link for Emacs sml-mode. Emacs Editing and Interaction Support:: Matthew J. Morley’s sml-mode for the emacs editor family, currently maintained by Stefan Monnier.