Summary
Add a pretty-printer that renders the AST back to Sploosh source, plus a round-trip corpus test (parse → print → parse, asserting AST equality). This validates §16 against the spec's own examples — the v0.5.11 audit found §16 had never been checked against real source, and a round-tripping parser+printer is the mechanism that forces that check.
Part of the Frontend milestone (see the Compiler Roadmap, #66). Was the v0.6.0 stretch goal in the bootstrap scoping.
Spec
- §16 EBNF grammar (the printer must emit grammar-conforming source); §2 lexical structure (tokens, comments).
Scope
Notes
Most valuable once the parser covers more of §16 (the control-flow issues #59–#62), but the printer can grow incrementally alongside the AST. Catches grammar drift the moment a spec example fails to round-trip.
Summary
Add a pretty-printer that renders the AST back to Sploosh source, plus a round-trip corpus test (parse → print → parse, asserting AST equality). This validates §16 against the spec's own examples — the v0.5.11 audit found §16 had never been checked against real source, and a round-tripping parser+printer is the mechanism that forces that check.
Part of the Frontend milestone (see the Compiler Roadmap, #66). Was the v0.6.0 stretch goal in the bootstrap scoping.
Spec
Scope
tests/corpus/*.sp: parse → print → re-parse, assert the two ASTs are equal (modulo spans).tests/roundtrip.rs.Notes
Most valuable once the parser covers more of §16 (the control-flow issues #59–#62), but the printer can grow incrementally alongside the AST. Catches grammar drift the moment a spec example fails to round-trip.