smlfmt

Custom parser and code formatter for Standard ML


Keywords
autoformat, formatter, parser, standard-ml
License
MIT
Install
brew install smlfmt

Documentation

parse-sml

A custom lexer/parser for Standard ML with the goal of providing better error messages. Supports standard SML source files (.sml, .sig, .fun, etc.) as well as MLBasis compilation files (.mlb) using MLton conventions, including MLBasis path maps.

Examples

Example 1

Example 2

Example 3

Build and run

You need mlton installed.

Do make and then pass either a .sml file or a .mlb file, for example:

$ make
$ ./main src/main.sml
$ ./main test/succeed/full-sml-basis-library.mlb --no-skip-basis

When given a .mlb, the default behavior is to ignore any file in the installed standard basis library. Passing --no-skip-basis overrides this.

Command-line options

-mlb-path-var '<key> <value>' for handling path variables, similar to MLton's path maps.

--no-skip-basis to also parse standard basis files.