TatSu
TatSu takes a grammar in a variation of EBNF as input, and outputs a memoizing PEG/Packrat parser in Python.
Decision gist · record as of 2026-08-14
Yes. TatSu is a mature, actively maintained parser generator with zero dependencies, permissive licensing, and broad Python version support. Install it if you need to parse hierarchical data, build a DSL, or generate parsers from grammars. The low friction and active development make it a reliable choice for grammar-based parsing tasks.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >=3.12; earlier versions should use TatSu-LTS fork.
- Low install friction with no runtime dependencies.
- Active maintenance with recent releases; last commit 2026-07-10 and version 5.24.0 released 2026-07-09.
License · maintenance · safety
permissive license (permissive) — BSD-4-Clause permissive license permits commercial and private use with attribution and disclaimer requirements. No copyleft restrictions; you may use generated parsers in proprietary projects.
last release 2026-07-09 (36 days) · last repo commit 2026-07-10 · 444 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 921,479 downloads/mo, #4,718 on PyPI
Alternatives
Verify before relying
pip install TatSu
from tatsu import parse
grammar = '''
start: expression $
expression: expression '+' term | term
term: /\d+/
'''
ast = parse(grammar, '3 + 5')- Whether the generated parsers handle all real-world grammar complexity without manual post-processing.
- Performance characteristics of generated parsers on large or deeply nested inputs.
- Whether left-recursive rule support covers all practical use cases or has known limitations.
What it is and what it does
TatSu is a PEG (Parsing Expression Grammar) parser generator that takes grammars written in extended EBNF and produces Python parsers capable of building abstract syntax trees (ASTs). It uses memoization (Packrat parsing) to ensure linear-time parsing and supports left-recursive rules—a feature uncommon in traditional PEG tools. The package can be used as a library to compile grammars at runtime and parse input on the fly, or to generate standalone Python modules that implement the parser.
The tool solves the problem of parsing hierarchical, context-dependent data—tasks where regular expressions fail. It handles recursive structures (like nested conditionals or folder hierarchies), format translation with meaning preservation, and the creation of domain-specific languages. TatSu has no runtime dependencies, installs cleanly, and is actively maintained for modern Python versions (3.12 and 3.13).
Use it for
- Build a custom configuration file parser for domain-specific settings without writing hand-coded recursive descent logic.
- Generate an AST from mathematical expressions or query languages to enable semantic analysis and transformation.
- Create a domain-specific language (DSL) for hardware description, music notation, or business rules with proper operator precedence.
- Translate between structured formats (e.g., one markup language to another) while preserving hierarchical meaning.
- Parse nested or recursive data structures like JSON variants, nested templates, or multi-level configuration formats.
- Validate and extract meaning from complex command syntax where simple regex matching is insufficient.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
TatSu is a mature, actively maintained parser generator with zero dependencies, permissive licensing, and broad Python version support. Install it if you need to parse hierarchical data, build a DSL, or generate parsers from grammars. The low friction and active development make it a reliable choice for grammar-based parsing tasks.
Install
tatsu on PyPI
Before you install
Low install friction with no runtime dependencies. Active maintenance with recent releases; last commit 2026-07-10 and version 5.24.0 released 2026-07-09. Requires Python >=3.12 but tests run on Python 3.12 and 3.13.
Requires Python >=3.12; earlier versions should use TatSu-LTS fork.
License in practice
BSD-4-Clause permissive license permits commercial and private use with attribution and disclaimer requirements. No copyleft restrictions; you may use generated parsers in proprietary projects.
Quickstart
pip install TatSu
from tatsu import parse
grammar = '''
start: expression $
expression: expression '+' term | term
term: /\d+/
'''
ast = parse(grammar, '3 + 5')
Verify before relying
- Whether the generated parsers handle all real-world grammar complexity without manual post-processing.
- Performance characteristics of generated parsers on large or deeply nested inputs.
- Whether left-recursive rule support covers all practical use cases or has known limitations.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.12 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 36 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 921,479 / month, #4,718 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishProgramming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Software Development :: CompilersTopic :: Text Processing :: General |
Evidence: tatsu-5.24.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “PEG parser generator”
- TatSuTatSu compiles extended EBNF grammars into memoizing PEG parsers in…
- pyPEG2pyPEG2 is a PEG (Parsing Expression Grammar) parser generator that…
- PyMeta3PyMeta3 compiles pattern-matching grammars based on Parsing…
Give your agent the search over MCP, or paste the wish link into any chat.
More Compilers packages
pyparsing provides a library for building text parsers directly in Python code using composable grammar classes, handling quoted strings, whitespace variation, and embedded comments without regex or lex/yacc.
Install it if you need to parse text or define grammars programmatically.
Cython is a source code translator that compiles Python code to C, enabling optional static typing and direct C/C++ interoperability to generate efficient native extensions.
Install it if you need to optimize Python performance, wrap C/C++ libraries, or build fast native extensions.
Annotates Python abstract syntax trees with the positions of tokens and source code text, enabling tools to map AST nodes back to their originating code for refactoring, analysis, and transformation.
Numba is a just-in-time compiler that accelerates numerically-focused Python code by compiling it to machine code via LLVM, with support for NumPy functions, loop parallelization, and GPU code generation.
Python bindings to the tree-sitter parsing library, enabling incremental parsing and syntax tree analysis for source code.
llvmlite provides a lightweight Python binding to LLVM's IR builder, optimizer, and JIT compiler APIs, enabling you to write JIT compilers and code generators without needing the full LLVM C++ API surface.
See also Arpeggio · PyMeta3 · pyPEG2 · abnf · textX · Parsley · parsimonious · tree-sitter-typescript · tree-sitter-haskell · tree-sitter-language-pack