lark
a modern parsing library
Decision gist · record as of 2026-08-14
Yes. Lark is actively maintained, has no runtime dependencies, carries a permissive MIT license, and ranks in the top 1000 PyPI packages with no known vulnerabilities. It's the right choice if you need to parse context-free grammars with flexibility and automatic AST generation; if you only need to tokenize or handle simple regex-based parsing, lighter alternatives may suffice.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or later; since version 1.2, earlier Python versions are not supported.
- Low install friction with no runtime dependencies; actively maintained with recent commits and a large community (5955 stars).
- Last release was 291 days ago.
License · maintenance · safety
MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
last release 2025-10-27 (291 days) · last repo commit 2026-08-13 · 5,955 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 79,690,057 downloads/mo, #426 on PyPI
Alternatives
Verify before relying
pip install lark
from lark import Lark
grammar = '''
start: "hello" name
name: /\w+/
'''
parser = Lark(grammar)
tree = parser.parse("hello world")- Performance characteristics and memory overhead compared to other parsing libraries in real-world scenarios.
- Completeness and quality of the standard library of terminals mentioned in the description.
What it is and what it does
Lark is a general-purpose parsing library that takes a grammar definition and automatically generates a parser capable of building abstract syntax trees. It supports three parsing algorithms—Earley (handles any context-free grammar including ambiguous ones), LALR(1) (fast and competitive with PLY), and CYK (for highly ambiguous grammars)—allowing you to choose the right balance of flexibility and performance for your use case. The library handles Unicode, tracks line and column information automatically, and can generate standalone parsers that don't require Lark as a runtime dependency.
You define your grammar using EBNF syntax, optionally importing from Nearley.js, and Lark builds the parse tree structure automatically based on your grammar rules. It's commonly used for domain-specific languages, configuration file parsing, query languages, and any scenario where you need to parse structured text into a tree representation. With zero runtime dependencies and support for current Python versions, it integrates cleanly into existing projects.
Use it for
- Parse domain-specific languages (DSLs) and configuration file formats into structured trees for processing.
- Build query language parsers for databases or search systems that need to interpret user input.
- Generate standalone parsers from grammars that can be distributed without Lark as a dependency.
- Handle ambiguous or complex grammars where flexibility matters more than raw parsing speed.
- Extract structured data from text formats by defining a grammar and walking the resulting AST.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Lark is actively maintained, has no runtime dependencies, carries a permissive MIT license, and ranks in the top 1000 PyPI packages with no known vulnerabilities. It's the right choice if you need to parse context-free grammars with flexibility and automatic AST generation; if you only need to tokenize or handle simple regex-based parsing, lighter alternatives may suffice.
Install
lark on PyPI
Before you install
Low install friction with no runtime dependencies; actively maintained with recent commits and a large community (5955 stars). Last release was 291 days ago.
Requires Python 3.8 or later; since version 1.2, earlier Python versions are not supported.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install lark
from lark import Lark
grammar = '''
start: "hello" name
name: /\w+/
'''
parser = Lark(grammar)
tree = parser.parse("hello world")
Verify before relying
- Performance characteristics and memory overhead compared to other parsing libraries in real-world scenarios.
- Completeness and quality of the standard library of terminals mentioned in the description.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 291 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 79,690,057 / month, #426 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 :: MIT LicenseProgramming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: GeneralTopic :: Text Processing :: Linguistic |
Evidence: lark-1.3.1-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 › “parse tree builder”
- larkLark is a parsing library that builds abstract syntax trees from…
- parsimoniousParsimonious is a pure-Python PEG (parsing expression grammar) parser…
- html5rdfParses HTML documents into tree structures compatible with RDFLib,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also lark-oapi · lark-parser · lark-js · spark-parser · pycep-parser · textparser · tree-sitter-python · tree-sitter-typescript · abnf · llguidance