grammargen

command
v0.20.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 10 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL