Documentation
¶
Overview ¶
Command grammargen generates tree-sitter parser artifacts from grammar definitions.
Usage:
grammargen [flags] <grammar-name-or-file>
Input sources:
<name> Built-in grammar (json, calc, glr, go, js, ts, tsx, fortran, etc.) -js <path> Import a tree-sitter grammar.js file -json <path> Import a resolved tree-sitter grammar.json file -grammar <path> Parse a portable .grammar file
Output formats:
-bin <path> Write gotreesitter .bin blob -c <path> Write tree-sitter parser.c -go <path> Write grammargen Go DSL source -json-out <path> Write resolved grammar.json (emit subcommand)
Authoring helpers:
parse Parse a sample and print text, S-expression, or JSON output doctor Validate, generate, test, parse samples, and report next steps
Other flags:
-lr-split Enable LR(1) state splitting before generation -validate Check grammar for issues without generating -report Show generation report with conflict diagnostics -list List available built-in grammars
Click to show internal directories.
Click to hide internal directories.