sexpfmt

S-expressions are easy for machines to write, but generating formatted S-expressions can be painful. sexpfmt formats an input stream in a consistent way such that the output is both line-diffable and human-readable.

The formatting style used by sexpfmt is highly regular, unlike what many Lispers and Schemers prefer. Each indentation increments spaces by a fixed number of spaces (by default, 2).

sexp (object (object (name "croissant") (quantity 2)) (object (name "latte") (quantity 1) (size "tall")))

The S-expression data format used is highly simplified compared to LISP's. There is no support for quote, quasiquote, unquote, or dot pair-builders. The character literal #\ (for space) is not supported either. Use #\space instead. There is also no support for #1234 = ... expressions to construct graphs.


Setup and Installation


Example Usage

bash $ cat my-file.sexp | sexpfmt > my-formatted-file.sexp $ ./build/my-sexp-generator-program arg1 arg2 | sexpfmt >> formatted-logfile.sexp

For examples of sexpfmt's behavior, see the test directory.


TODO