--- id: tatsu version: "5.24.0" license: SPDX-License-Identifier: BSD-4-Clause TATSU - A PEG/Packrat parser generator for Python Copyright (c) 2017-2026 Juancarlo Añez (apalala@gmail.com) All rights reserved. Redistribution and use in… (full text in the JSON record) license_treatment: permissive maintenance: active --- # TatSu — TatSu takes a grammar in a variation of EBNF as input, and outputs a memoizing PEG/Packrat parser in Python. License: permissive · Maintenance: active · Downloads: 921.5K/mo ## 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 above — verify before relying. TatSu compiles extended EBNF grammars into memoizing PEG parsers in Python, or generates Python source code that implements those parsers. 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 pip install tatsu uv add tatsu poetry add tatsu ## Installing TatSu 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. 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') Requires Python >=3.12; earlier versions should use TatSu-LTS fork. 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: SPDX-License-Identifier: BSD-4-Clause TATSU - A PEG/Packrat parser generator for Python Copyright (c) 2017-2026 Juancarlo Añez (apalala@gmail.com) All rights reserved. Redistribution and use in… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 921.5K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags PEG parser generator, EBNF grammar compiler, packrat parser python, grammar to parser, DSL parser generator, left-recursive grammar support, abstract syntax tree builder, parser-generator, dsl-tools, compiler-tools [View on SkillFed](https://skillfed.io/packages/tatsu) · [View on PyPI](https://pypi.org/project/tatsu/)