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

Grammar

How to author and design tree-sitter grammars.

Abstract

This section covers grammar authoring and design.

Grammar design directly affects parser quality, performance, usability.

  • Well-designed: Unambiguous, efficient, maintainable.
  • Poor design: Parsing conflicts, performance issues, difficult query patterns.