awesome-repositories.com
博客
awesome-repositories.com

通过 AI 驱动的搜索,发现最优秀的开源仓库。

探索精选搜索开源替代品自托管软件博客网站地图
项目关于排名机制媒体报道MCP 服务器
法律隐私政策服务条款
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
lark-parser avatar

lark-parser/lark

0
View on GitHub↗
5,914 星标·484 分支·Python·MIT·4 次浏览

Lark

Lark 是一个 Python 解析工具包,用于定义语法并将原始文本转换为带注释的解析树。它作为一个抽象语法树生成器和语法定义语言,用于通过终结符和正则表达式指定语言规则。

该库提供两种主要的解析实现:一种是能够处理所有上下文无关语言(包括具有歧义和左递归的语言)的 Earley 解析库;另一种是专为具有低内存开销的确定性语言设计的高性能 LALR 解析库。

除了核心解析外,该工具包还包括模块化语法组合、基于规则的树转换以及源位置坐标跟踪功能。它还支持将 LALR 语法序列化为独立的解析器模块。

Features

  • Parsing Toolkits - Provides a comprehensive suite of parsing algorithms and grammar definition tools for transforming raw text into structured parse trees.
  • AST Generators - Acts as a toolkit for transforming raw input text into hierarchical abstract syntax trees based on predefined grammars.
  • Parsing and Grammars - Converts raw text into annotated parse trees based on user-defined grammar rules.
  • Custom Language Definitions - Enables the definition of custom language structures using grammar rules and regular expressions.
  • Grammar Rule Specification - Allows users to define the structure of a language using a high-level syntax for recursive rules and regular expressions.
  • Context-Free Grammar Frameworks - Implements a framework capable of parsing all context-free languages, including those with ambiguity and left-recursion.
  • Formal Grammar Specifications - Allows the definition of recursive rules and terminals using extended Backus-Naur Form (EBNF) syntax.
  • Annotated Parse Trees - Transforms raw text into hierarchical parse trees annotated with grammar rule matches and source positions.
  • Abstract Syntax Tree Parsing - Automatically generates a hierarchical tree representation of the input text based on the defined grammar.
  • Concrete Parse Tree Generation - Automatically builds full, annotated hierarchical parse trees based on the specified grammar structure.
  • AST Generators - Automatically generates hierarchical abstract syntax trees by matching input tokens against defined grammar rules.
  • LALR Parsers - Implements a high-performance LALR parser using look-ahead left-to-right shift-reduce algorithms for deterministic languages.
  • Earley Parser Implementations - Implements the Earley parsing algorithm to support all context-free languages, including those with left-recursion.
  • Earley Parsers - Implements the Earley parsing algorithm to handle all context-free grammars, including those with ambiguity and left-recursion.
  • Interactive Grammar Debugging - Offers tools to design and debug language grammars by inspecting parser decisions interactively.
  • Ambiguity Management - Supports marking multiple valid interpretations of a single input string when using the Earley parsing algorithm.
  • High-Performance Text Processing - Uses LALR algorithms to process large volumes of text with high efficiency and low memory usage.
  • Grammar Compositions - Provides the ability to import terminals and rules from multiple external grammar files to build complex parsing logic.
  • Domain Specific Language Parsers - Provides tools to build specialized parsers for custom data formats and complex recursive configuration languages.
  • Parsing Optimizations - Implements high-performance LALR parsing to increase execution speed and reduce memory overhead.
  • Source Coordinate Tracking - Provides line and column offset tracking for tokens to map parse tree nodes back to the original source code.
  • Standalone Parser Generators - Compiles LALR grammars into self-contained parser modules to remove dependencies on the full toolkit.
  • Coordinate Tracking - Tracks line and column numbers for every element in the parse tree to facilitate precise error reporting and debugging.
  • Grammar Extensions - Imports terminals and rules from external libraries to reuse common language patterns within a grammar.
  • Grammar Compositions - Supports importing and combining separate grammar definitions to build complex languages from reusable components.
  • Syntax Tree Transformers - Uses a visitor-pattern mechanism to transform parse trees into custom data structures via specific grammar branch mappings.

Star 历史

lark-parser/lark 的 Star 历史图表lark-parser/lark 的 Star 历史图表

AI 搜索

探索更多 awesome 仓库

用简单的语言描述您的需求 —— AI 将根据相关性为您从数千个精选开源项目中进行排序。

Start searching with AI

常见问题解答

lark-parser/lark 是做什么的?

Lark 是一个 Python 解析工具包,用于定义语法并将原始文本转换为带注释的解析树。它作为一个抽象语法树生成器和语法定义语言,用于通过终结符和正则表达式指定语言规则。

lark-parser/lark 的主要功能有哪些?

lark-parser/lark 的主要功能包括:Parsing Toolkits, AST Generators, Parsing and Grammars, Custom Language Definitions, Grammar Rule Specification, Context-Free Grammar Frameworks, Formal Grammar Specifications, Annotated Parse Trees。

lark-parser/lark 有哪些开源替代品?

lark-parser/lark 的开源替代品包括: ohmjs/ohm — Ohm is a formal grammar parser generator and domain-specific language framework. It provides a system for defining… hardmath123/nearley — Nearley is a JavaScript parser toolkit used to define context-free grammars and generate corresponding parsers. It… kach/nearley — Nearley is a JavaScript parser toolkit and context-free grammar compiler. It functions as an Earley parser generator… harc/ohm — Ohm is a compiler construction toolkit and parser combinator library used to build parsers, interpreters, and… commonmark/commonmark-spec — This project is a formal markdown specification standard that provides a detailed markup syntax definition and a… dtolnay/syn — syn is a Rust syntax tree parser and token stream converter. It serves as a toolkit for procedural macro development,…

Lark 的开源替代方案

相似的开源项目,按与 Lark 的功能重合度排序。
  • ohmjs/ohmohmjs 的头像

    ohmjs/ohm

    5,471在 GitHub 上查看↗

    Ohm is a formal grammar parser generator and domain-specific language framework. It provides a system for defining custom languages to parse, validate, and extract data from input text, transforming raw strings into hierarchical abstract syntax trees based on specified formal rules. The project utilizes an Earley parsing algorithm, which allows it to support all context-free grammars, including those with left recursion and ambiguity, without requiring predefined operator precedence. It also includes a dedicated debugging toolkit for tracing and visualizing the step-by-step state transitions

    JavaScriptcompilergrammarsjavascript
    在 GitHub 上查看↗5,471
  • hardmath123/nearleyHardmath123 的头像

    Hardmath123/nearley

    3,740在 GitHub 上查看↗

    Nearley is a JavaScript parser toolkit used to define context-free grammars and generate corresponding parsers. It features an EBNF grammar compiler that transforms language definitions written in extended Backus-Naur Form into executable JavaScript code, utilizing an Earley parser implementation to process any context-free grammar. The toolkit distinguishes itself by its ability to handle left-recursion and ambiguity without failing, allowing it to identify and return multiple valid derivations for a single input string. It also includes a grammar fuzzing generator to produce random strings

    JavaScript
    在 GitHub 上查看↗3,740
  • kach/nearleykach 的头像

    kach/nearley

    3,740在 GitHub 上查看↗

    Nearley is a JavaScript parser toolkit and context-free grammar compiler. It functions as an Earley parser generator that transforms BNF-like grammar definitions into executable code capable of analyzing text and generating abstract syntax trees. The project is distinguished by its ability to handle any context-free grammar, including those with left recursion and ambiguity, by maintaining multiple valid derivations for a single input. It further supports incremental parsing, allowing input strings to be processed in chunks to provide partial results and real-time feedback. Beyond core parsi

    JavaScript
    在 GitHub 上查看↗3,740
  • harc/ohmharc 的头像

    harc/ohm

    5,530在 GitHub 上查看↗

    Ohm is a compiler construction toolkit and parser combinator library used to build parsers, interpreters, and compilers. It provides a formal grammar language for specifying the structural rules of data formats to ensure precise parsing of input strings. The project functions as a parsing debugging tool and program execution visualizer. It generates text traces and graphical visualizations to show the step-by-step logic used during parsing and renders runtime state changes and method call hierarchies. The toolkit covers custom parser development and the construction of compilers and interpre

    JavaScript
    在 GitHub 上查看↗5,530
  • 查看 Lark 的所有 30 个替代方案→