| Crates.io | tlafmt |
| lib.rs | tlafmt |
| version | 0.4.1 |
| created_at | 2025-02-23 18:21:05.251321+00 |
| updated_at | 2025-04-07 22:28:13.224832+00 |
| description | A formatter for TLA+ specs |
| homepage | |
| repository | https://github.com/domodwyer/tlafmt |
| max_upload_size | |
| id | 1566555 |
| size | 59,692 |
A formatter for TLA+ specs.
It looks like this:
Add(t, k, v) == \* Using transaction t, add value v to the store under key k.
/\ t \in tx
/\ snapshotStore[t][k] = NoVal
/\ snapshotStore' = [snapshotStore EXCEPT ![t][k] = v]
/\ written' = [written EXCEPT ![t] = @ \union {k}]
/\ UNCHANGED << tx, missed, store >>
Some TLA specs are hand-crafted works of art - but not all of them - this tool is for those ugly specs!
Download pre-built binaries from the releases page.
Or if you have Rust installed, compile it yourself: cargo install tlafmt.
Format a file and print the formatted result to stdout:
% tlafmt bananas.tla
Or overwrite the input file with the formatted result:
% tlafmt --in-place bananas.tla
To check if a file is formatted and return an error if it isn't, use --check:
% tlafmt --check bananas.tla
# Exits code 3 for unformatted code.
Check out the --help text too.
This formatter doesn't aim to enforce a prescriptive, universal style across the whole spec. Instead it aims to improve consistency by making small changes, respecting the general style of the input spec.
Formatting is being iterated on - please report any undesirable rendering as an issue.