Skip to content

Releases: shwestrick/smlfmt

v1.1.0 (Nov 2, 2023)

02 Nov 15:25
Compare
Choose a tag to compare

In this release:

  • #77: --safety-check flag for checking that the output of smlfmt is correct, i.e., that the result is valid SML that exactly matches the source except for whitespace.
    • Note: originally called --check but renamed to --safety-check in #92.
  • #84, #86: allow passing input and output through stdin and stdout.
    • For example: echo "val x = 5 val y = 6" | ./smlfmt or cat test.sml | ./smlfmt > output.sml
  • #87: --read-only flag, useful for checking for syntax errors
  • #93: make install formula
  • #92: --check flag, to check if a file has already been formatted. Useful for CI.
  • Some bugfixes and other small improvements, e.g., 656885b 4d1952a

Also note that https://github.com/diku-dk/smlfmt.el offers Emacs integration for smlfmt.

Thanks @kopecs @p-ouellette @brandonspark @athas @ratsclub for your contributions!

v1.0.0 (Jan 10, 2023)

10 Jan 17:09
5188a13
Compare
Choose a tag to compare

smlfmt is a custom parser and code formatter for Standard ML.

Features

  • Full support for Standard ML according to the formal definition.
  • Fast -- see performance results below.
  • Usable for large projects.
    • Whole-project formatting via .mlb files using MLton conventions.
  • Helpful error messages with visual code references and syntax highlighting.
  • Support for various SuccessorML syntax extensions.
  • Configurable indentation size and maximum width.

Performance

smlfmt is fast enough for live reformatting on large individual files, and can reformat large projects in seconds.

Here are measurements for smlfmt --preview-only INPUT > out on my MacBook Air (M2, 2022).

Input Size (LoC) Time
src/prettier-print/PrettierExpAndDec.sml 1024 31 ms
src/base/PrettyTabbedDoc.sml 1349 29 ms
src/parse/ParseExpAndDec.sml 1363 28 ms
MLton elaborate-core.fun 3942 104 ms
MLton x86-allocate-registers.fun 11034 216 ms
Entire MLton source code (mlton.mlb) 160000 (approx.) 6.6s

(Timings are averages reported by hyperfine.)