Expand description
The printer — one Node tree, two surfaces.
docs/02-syntax.md §2.2: “beck fmt --sexpr orders.beck
emits the canonical Lisp form. beck fmt --py orders.sx emits the Python form.” §2.8 asks for
it early because “every later phase uses it”: macro expansion dumps, beck ast, and the error
renderer all print Nodes.
Round-tripping is lossless modulo formatting: parse(print(parse(src))) is structurally equal
to parse(src), which is the property tests/roundtrip.rs asserts over the corpus.
Functions§
- to_
python - The Python surface. This is what
beck fmtwrites, and §2.6’s style rules (“snake_casevalues,PascalCasetypes … enforced bybeck fmt”) are applied by the formatter, not here: this function prints faithfully, so that printing an already-renamed tree is idempotent. - to_
sexpr - Canonical S-expressions, one line. The notation the sketch is written in.
- to_
sexpr_ pretty - Canonical S-expressions, broken across lines where a form is long.