skillfed

lark-parser

a modern parsing library

lark-parser v0.12.0 3.7M downloads/30d#2,535 on PyPI5,958
Permissive license MIT Active released

What it is and what it does

Lark is a general-purpose parsing library that transforms grammar definitions into working parsers. It supports three parsing algorithms—Earley (handles all context-free grammars including ambiguous ones), LALR(1) (fast and compact), and CYK (for highly ambiguous grammars)—and automatically builds parse trees from input text based on your grammar structure.

The library is designed for minimal boilerplate: you write a grammar in EBNF notation and Lark generates a parser that can immediately process text matching that grammar. It includes conveniences like automatic line and column tracking, a standard library of common terminals (strings, numbers, identifiers), and Unicode support. With no runtime dependencies and support for both Python 2 and 3, it's straightforward to integrate into existing projects.

Use it for:

  • Parse domain-specific languages or configuration file formats by defining their grammar rules
  • Build compilers or interpreters that need to convert source code into abstract syntax trees
  • Extract structured data from text by defining patterns as a context-free grammar
  • Implement query languages or expression parsers for applications requiring user-defined syntax
  • Generate stand-alone parsers from LALR grammars for deployment without the library

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Lark is a parsing library that builds abstract syntax trees from context-free grammars using Earley, LALR(1), or CYK parsing algorithms, with minimal code required.

Yes. Lark is production-stable, dependency-free, actively maintained, and widely used (top 5000 PyPI packages). Choose it if you need to parse structured text or implement a language. The main caveat: the latest release is from 2021-08-30, so verify current Python version compatibility before adopting in new projects.

Install

lark-parser on PyPI

pip

pip install lark-parser

uv

uv add lark-parser

poetry

poetry add lark-parser

Installing lark-parser

Before you install

Installation is straightforward with no runtime dependencies. The package is actively maintained with recent commits and has been stable since its first release in 2017-02-11.

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

Quickstart

pip install lark-parser

from lark import Lark

grammar = r"""
    start: "hello" name
    name: /\w+/
"""
parser = Lark(grammar)
tree = parser.parse("hello world")

Verify before relying

  • Whether the package receives active maintenance updates beyond the 2021-08-30 latest release date
  • Current compatibility with modern Python versions given the last release predates recent Python releases

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 1,810 days since the last release
Last repo commit
First released
Downloads 3,665,702/month — #2,535 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: lark_parser-0.12.0-py2.py3-none-any.whl

Keywords: Earley, LALR, parser, parsing, ast

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2.7Programming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: GeneralTopic :: Text Processing :: Linguistic

Tags

context-free grammar parserast parser libraryearley lalr parserparsing library pythongrammar-based parsingsyntax tree generatorgeneral-purpose parser
parser-generatordslcompiler-tools

More Python Modules packages