TL;DR
Gren-format, a code formatter for the Gren programming language, was built using the Gren compiler's v2 parser, addressing challenges like comment placement and idempotency. The key outcome was a reliable formatter that maintains consistent output across runs.
✦ Why It Matters
Implement a position barrier in your own formatting tools to ensure consistent output.
Key Takeaways
How It Works
Gren-format uses the Gren compiler's v2 parser to generate a syntax tree without comments, addressing the challenge of comment placement by assigning roles to comments early in the formatting process. This ensures that comments are consistently placed according to their designated roles, rather than relying on potentially changing source positions.
Related