Skip to content
An interpreter for Standard ML written in TypeScript.
TypeScript JavaScript
Branch: master
Clone or download
Latest commit 149a233 Sep 12, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows try gh actions Sep 12, 2019
src Merge branch 'dev' Sep 11, 2019
test fix tests Dec 24, 2018
.gitignore versioning scripts added (#98) Jan 30, 2019
LICENSE Create LICENSE Aug 22, 2017 squidfixes Sep 12, 2019
package-lock.json squidfixes Aug 12, 2019
package.json ... Jun 18, 2019
tsconfig.json steps toward npm Oct 15, 2017
tslint.json fixing lint error (#99) Feb 1, 2019
webpack.cli.js add cli interface for the interpreter Nov 28, 2018
webpack.config.js split interpreter and frontend Jul 29, 2017 split interpreter and frontend Jul 29, 2017 ... Jun 18, 2019

SOSML - Online SML

SOSML is an online interpreter for the functional programming language Standard ML, written in TypeScript. It is to be used as a learning tool in a freshman class at Saarland University; you can try it out at


Correctly lexing, parsing, elaborating and interpreting any SML core language program, i.e. a program that may contain the following constructs:

  • Supported declarations (partially supported declarations in italics)
    • value declarations (val x = 42;)
    • function declarations (fun f 0 = 42 | f x = f (x-1);)
    • type alias declarations (type t = 'a -> (int * int))
    • datatype declarations (datatype tree = T of tree list;)
      • withtype will not be supported.
    • abstract datatype declarations (abstype tree = T of tree list with val empty = T [];) Note that abstype is implemented as a derived form as proposed by Successor ML.
      • withtype will not be supported.
    • exception declarations (exception E of int;)
    • local declarations (local val x = 42; in val y = x + 2; end;)
    • declaring operators as infix, nonfix, left, and right associative via infix, infixr, and nonfix
    • open declarations
    • structure declarations (structure S = struct end;)
    • signature declarations (signature S = sig end;)
    • functor declarations (functor F = struct end;)
  • Supported expressions (This list is non-exhaustive)
    • tuple ((1, 2, 3)), records ({a = 1, b = 2}), and lists ([1, 2, 3])
    • application expressions (f x)
    • infix expressions (3 + 4 - 5 * 6)
    • andalso and orelse expressions
    • raise and handle expressions
    • conditionals (if true then 2 else 3)
    • case analyses (case x of 0 => 0 | _ => 1)
    • abstractions (fn 0 => 0 | _ => 1)
    • while loops
    • print
    • ref, !, and :=
    • structures
    • signatures
    • functors
  • Supported standard library constructs (Note that all available libraries are loaded per default, currently SOSML has not implemented any user-space loading of modules.)
    • Math library
    • Char library ord, chr, Char.isLower, Char.isUpper, Char.isDigit, Char.isAlpha
    • Int library Int.minInt, Int.maxInt, and
    • Real library, Real.fromInt, Real.round, Real.floor, and Real.ceil
    • Option library
    • List and Listsort libraries
    • Vector library fromList, tabulate, length, sub, update, app, map, foldl, foldr
    • Array library fromList, tabulate, length, sub, update, vector, foldl, foldr
    • String library

Building and installation

The dependencies of this package must be installed to test or build.

npm install

To build the interpreter and pack it into one file using Webpack run:

npm run build

This will create a file in the directory build called interpreter.js.

To also minify the result run:

npm run dist

This will create a file in the directory build called interpreter.min.js.


To run the tests use:

npm test

This runs all tests located in the test directory.


We welcome you to open an Issue for any error you may find, and we will try to fix it ASAP. Further, if you want additional parts of the Standard Library or other features in general implemented, feel free to open a new Issue.

If you want to contribute via writing code, you may check the Issues page for any unresolved problems or unimplemented features and then submit a pull request after solving that problem or implementing that feature.

You can’t perform that action at this time.