Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Writing a formatter has never been so easy: a Topiary tutorial

Yann Hamdaoui has written a step-by-step guide on how to write a new formatter for your own language, starting from zero.

Part 1

Part 1 introduces Topiary and motivates its use to create a formatter for a toy language, Yolo. Yann first guides you through the creation of a Tree-sitter grammar for Yolo, then plugs it into Topiary to write its formatting queries.