For syntax processors, the strongest matches are lark-parser/lark (Lark is a Python parsing toolkit that supports grammar), facebook/jscodeshift (This JavaScript-focused toolkit parses source code into abstract syntax) and tree-sitter/tree-sitter (Tree-sitter is a parser generator and incremental parsing framework). dotnet/roslyn and eliben/pycparser round out the shortlist. Each is ranked by relevance to your query, popularity and recent activity.
Hand-picked open-source syntax parser repositories ranked by stars and activity. Compare the top alternatives and pick the right one.
Lark is a Python parsing toolkit used to define grammars and convert raw text into annotated parse trees. It serves as an abstract syntax tree generator and a grammar definition language for specifying language rules through terminals and regular expressions. The library provides two primary parsing implementations: an Earley parsing library capable of handling all context-free languages, including those with ambiguity and left-recursion, and a high-performance LALR parsing library designed for deterministic languages with low memory overhead. Beyond core parsing, the toolkit includes capabi
Lark is a Python parsing toolkit that supports grammar definitions, Earley and LALR algorithms, and tree transformations, fitting the syntax processor and AST generation requirements directly.
jscodeshift is a JavaScript AST transformation toolkit and codemod engine designed for large-scale code refactoring and structural migrations. It provides a set of utilities to parse source code into abstract syntax trees, programmatically modify those trees, and convert them back into source text. The tool distinguishes itself by preserving original source formatting and stylistic properties during the transformation process. It utilizes a builder for generating structurally valid AST nodes and integrates interchangeable parsing engines to support different language standards and experimenta
This JavaScript-focused toolkit parses source code into abstract syntax trees, supports visitor patterns and AST modifications, and transforms code back into source text, making it a strong fit despite its language scope being limited to JavaScript rather than multi-language.
Tree-sitter is a parsing system and incremental parsing framework designed to generate high-performance syntax trees from source code. It functions as a language parsing engine that compiles formal grammar definitions into portable code, which can then be integrated into text editors and development tools to facilitate structural analysis, code navigation, and syntax highlighting. The project distinguishes itself through its ability to maintain valid, usable syntax tree structures even when source code contains syntax errors or incomplete fragments. It utilizes a generalized parsing algorithm
Tree-sitter is a parser generator and incremental parsing framework that builds error-resilient syntax trees from source code across multiple languages, perfectly matching the required capabilities for code analysis and transformation.
The .NET Compiler Platform is a collection of open-source APIs for C# and Visual Basic that provides deep code analysis, refactoring, and automated source code generation. It serves as the core infrastructure for building development tools, offering a platform to inspect, modify, and understand source code through immutable syntax trees and semantic models. The platform distinguishes itself by providing full-fidelity syntax trees that preserve every character of source code, including whitespace and comments, alongside an incremental compilation pipeline that enables near-instant feedback dur
This repository provides rich compiler APIs and syntax trees specifically for C# and Visual Basic, matching your need for code parsing, AST manipulation, and transformation tools.
pycparser is a C99 parser library that converts C source code into an abstract syntax tree consisting of Python objects. It functions as an abstract syntax tree generator, transforming preprocessed C code into a structured hierarchy for programmatic analysis and transformation. The library integrates with a C preprocessor to handle directives before parsing. It also features a stub header parser, which uses minimal mock headers to allow the parsing of C code without requiring a full system C library installation. The project provides tools for static code analysis, C program analysis, and so
pycparser is a C99 parser library that generates abstract syntax trees and supports visitor patterns for Python, though its scope is limited specifically to the C language rather than multi-language support.
This project is a framework for building, manipulating, and analyzing abstract syntax trees. It provides a toolkit for defining, traversing, and validating syntax trees that are compatible with the Mozilla Parser API, serving as a foundation for static code inspection and automated transformation tasks. The library distinguishes itself through a declarative type system that enforces structural integrity across node hierarchies. By wrapping raw syntax nodes in context-aware objects, it enables developers to track parent relationships and ancestor chains without modifying the underlying tree st
This library provides abstract syntax tree generation, traversal, and transformation capabilities for JavaScript and related syntaxes, aligning well with your search for code parsing and manipulation tools.
ANTLR is a grammar-based code generator and multi-language parser generator used to design and implement custom languages. It functions as a toolkit for transforming formal language definitions into executable source code for processing structured text or binary files, while providing a framework for automatically constructing and traversing hierarchical parse trees. The project is distinguished by its ability to generate lexers and parsers in various target programming languages from a single shared grammar definition. It supports grammars containing direct left recursion and utilizes adapti
ANTLR is a robust grammar-based parser generator that builds lexers and parsers across multiple target languages while supporting automatic tree construction and traversal.
OpenRewrite is an automated refactoring engine and source-to-source migration framework. It uses a lossless semantic tree parser to represent source code as type-aware trees that preserve original whitespace and formatting, enabling precise and deterministic modifications. The project utilizes a declarative refactoring pipeline where sequences of transformations are defined in YAML to resolve breaking changes and technical debt. It features type-aware pattern matching and cross-language model mapping to apply similar refactoring patterns across different programming languages. The framework
OpenRewrite is an automated refactoring engine and source-to-source migration framework that parses source code into lossless semantic trees, supporting type-aware code transformation and visitor-based refactoring across languages.
Rector is an automated PHP refactoring and modernization tool designed to upgrade language versions and modernize syntax using predefined rules. It functions as a static analysis engine that inspects code structures and types to identify refactoring targets without executing the code. The project provides a framework for defining custom transformation logic to automate project-specific changes. It distinguishes itself by offering specialized capabilities for migrating legacy or custom frameworks to modern alternatives and converting docblock annotations into native language attributes. The s
Rector is an automated PHP refactoring and modernization tool that parses and transforms code using an abstract syntax tree, though its specialized focus on refactoring makes it narrower than a general-purpose parser generator.
Recast is a JavaScript AST parser and printer designed for automated code refactoring. It converts source code into abstract syntax trees that can be modified and then printed back into source code. The project focuses on formatting-preserving transformations, storing original whitespace and indentation metadata within syntax tree nodes to reconstruct code without losing its original layout. It also generates character-level source maps to maintain precise correspondences between original input and transformed output. The toolkit includes utilities for syntax tree manipulation using a visito
Recast is a JavaScript syntax transformer and AST printer that preserves original formatting, though its language support is primarily focused on JavaScript rather than multi-language parsing.
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
Ohm is a dedicated grammar parser generator and language framework that produces abstract syntax trees from input text, though it uses a parsing expression/Earley approach rather than a traditional lexer-parser split.
PegJS is a parsing expression grammar tool and JavaScript parser generator. It functions as a grammar compiler that transforms formal grammar specifications into executable JavaScript code for analyzing structured text and processing complex input strings. The system generates deterministic parsers that avoid the ambiguity of context-free grammars. It utilizes a packrat parsing model with memoization to ensure linear time complexity and employs recursive descent parsing to process input in a top-down hierarchical manner. The toolset supports the implementation of domain-specific languages an
PegJS is a parser generator that transforms formal grammar specifications into executable JavaScript code, fitting the core need for generating custom parsers and structured text processors despite lacking built-in multi-language output.
Mitosis is a cross-framework compiler that transforms a single JSX-based source into native components for multiple frontend libraries simultaneously. It functions as a multi-target UI library builder, allowing developers to maintain a single source of truth for design systems while generating production-ready code for diverse environments including React, Vue, Angular, and Svelte. The system operates by parsing unified component code into an intermediate JSON representation, which serves as the foundation for all downstream framework generators. This architecture utilizes a visitor-based tra
Mitosis is a compiler library that parses JSX into an abstract syntax tree and transforms it into components for multiple frontend frameworks, though it focuses specifically on UI compilation rather than a general-purpose parser generator.
syn is a Rust syntax tree parser and token stream converter. It serves as a toolkit for procedural macro development, providing a framework to parse Rust source code into structured syntax trees for analysis and transformation. The project enables the manipulation of Rust abstract syntax trees through specialized visitor and folder patterns for traversing and mutating nodes. It provides a bidirectional mapping that allows developers to convert token streams into structured trees and print those trees back into tokens for code generation. The library covers a broad range of syntax analysis ca
This library parses Rust source code into abstract syntax trees for procedural macros, supporting visitors and code transformation, though it is specifically scoped to the Rust ecosystem rather than multi-language parsing.
This project is a high-performance markdown-to-HTML parser designed for use in browser, server-side, and command-line environments. It functions as a configurable syntax processor that transforms plain text documents into structured web content, providing a flexible engine for rendering dynamic documentation and web-based text. The parser features a modular, extensible pipeline that allows developers to intercept the document transformation process at multiple stages. Through custom tokenization, rendering overrides, and lifecycle hooks, users can define unique syntax, modify the token stream
Marked is a markdown parser and transformer that handles document conversion, though its narrow focus on markdown makes it a specialized syntax processor rather than a general-purpose AST generator.
Babel is a pluggable JavaScript compiler and transpiler that converts modern ECMAScript syntax into backwards-compatible versions of the language. It functions as an abstract syntax tree manipulator, parsing source code into a hierarchical structure to traverse and modify nodes for custom code transformations. The system utilizes a plugin-driven architecture to apply specific transformation rules and supports presets that bundle multiple plugins into named configuration groups. This enables the transformation of experimental syntax and the injection of non-global polyfills to ensure consisten
Babel is a JavaScript compiler and AST manipulation tool that parses and transforms source code, though it is specifically tailored to JavaScript rather than multi-language support.
Prettier is an opinionated code formatter that parses source code and reprints it from scratch to enforce a consistent, project-wide visual style. By transforming code into an abstract syntax tree and applying a recursive document printing process, it eliminates manual style debates and ensures that all source files adhere to a unified appearance. The project is distinguished by its extensible, plugin-based architecture, which decouples language-specific parsing logic from the core engine. This modular design allows for uniform style enforcement across diverse programming languages and comple
Prettier parses source code into abstract syntax trees to format and reprint it, making it a specialized syntax processor though focused on code formatting rather than a general-purpose parser generator.
PostCSS is a CSS post-processor and abstract syntax tree transformation tool that parses stylesheets into a structured tree for programmatic analysis and modification. It functions as a plugin-driven pipeline where JavaScript plugins can modify, insert, or delete nodes to transform styles. The project provides a framework for building a custom plugin ecosystem to extend the CSS language with non-standard features such as loops, conditionals, and shorthand properties. It supports multi-syntax parsing through pluggable parsers and stringifiers, allowing it to process various style formats and c
PostCSS is a syntax processor and abstract syntax tree transformation tool for CSS that parses stylesheets into a navigable tree for programmatic modification and plugin-driven analysis.
Standard is a zero-configuration static analyzer, linter, and formatter for JavaScript. It functions as a style guide that enforces consistent coding rules and identifies programming errors without requiring manual configuration files. The tool distinguishes itself by providing an automatic code fixer that scans source files to correct style violations and ensure a uniform codebase. It implements a predefined rule set to eliminate the need for project-specific configuration. The project covers a broad range of static analysis capabilities, including support for experimental language syntax a
Standard is a zero-configuration JavaScript linter and formatter that performs static code analysis, fitting the category as a syntax-processing tool even though it lacks a general-purpose lexer and parser generator.
The project is a modular compiler infrastructure framework designed for building programming language toolchains, frontends, and backends. It provides a comprehensive suite of reusable libraries and tools that enable developers to transform source code into efficient native executables across diverse hardware architectures and operating systems. At its core, the system utilizes a language-agnostic intermediate representation bitcode, which serves as a unified format for code analysis, optimization, and machine-specific code generation. What distinguishes this framework is its highly decoupled
This modular compiler infrastructure framework provides robust tools for parsing, code generation, and source transformation, fitting the category well despite being tailored for full toolchains rather than lightweight text parsing.
Pest is a Rust parsing library and automatic parser generator that transforms formal grammar definitions into functional parsers. It specializes in Parsing Expression Grammar to recognize and structure complex text patterns, providing a system for context-free grammar parsing. The library implements zero-copy tokenization and static grammar compilation to reduce runtime overhead. It supports no-std runtime compatibility, allowing the parser to be compiled for embedded or bare-metal environments where a standard library is unavailable. The project covers a range of parsing capabilities, inclu
Pest is a Rust parser generator that transforms formal grammars into functional parsers with parse tree extraction, though it focuses heavily on PEG rather than general multi-language support.
Parser Building Toolkit for JavaScript
Chevrotain is a parser building toolkit for JavaScript that generates lexers and parsers, though it focuses on parser construction rather than high-level AST generation or multi-language support.
Python library for creating PEG parsers
This Python library provides a parser-combinator approach to building PEG parsers and text processing tools, fitting the core category well despite lacking a traditional parser generator or visitor pattern framework.
The project provides a standardized abstract syntax tree specification and utility library for parsing, transforming, and serializing markdown documents. It serves as a comprehensive document processing architecture that translates between raw text markup and structured node representations in both directions. The capability surface covers syntax parsing for extended markdown features, custom syntax extensions, metadata blocks, and embedded expressions, alongside document serialization that converts syntax trees back into standard and extended markup formats. It includes node modeling and val
This repository provides an abstract syntax tree format and processing utilities specifically for Markdown, making it a fitting tool for structured text parsing and transformation despite its narrower scope.
Php-generator is a metaprogramming library for programmatically generating, inspecting, parsing, and manipulating PHP source code using expressive object-oriented structures. It allows developers to construct classes, interfaces, traits, enums, functions, closures, and complete files without writing raw strings. The library features automated namespace resolution to manage fully qualified class names and use statements, preventing naming collisions in generated output. It also includes configurable formatting utilities that transform abstract syntax trees into text strings adhering to establ
This repository generates structured PHP code programmatically and supports modern language features, fitting the code-generation aspect of syntax and code processing tools.
UglifyJS2 is a suite of tools designed for parsing, beautifying, mangling, and minifying JavaScript code. It functions by converting source code into an abstract syntax tree to enable programmatic analysis and transformation, and it includes a dedicated generator for creating associated source maps. The project optimizes web production builds by compressing script logic and removing unreachable code. It utilizes name mangling to shorten variable and property names and implements a beautifier to reconstruct compressed scripts into a human-readable layout. The toolset covers broad capability a
UglifyJS2 parses JavaScript code into an abstract syntax tree and provides tools for transformation and generation, though its scope is specialized for minification rather than general multi-language parsing.
ast-grep is a command-line utility and static analysis engine designed for searching, linting, and refactoring source code. It operates by identifying and transforming code blocks based on their underlying syntactic structure rather than relying on text-based or regular expression matching. The tool utilizes a language-agnostic abstraction to normalize diverse programming grammars into a unified tree structure. By employing a rule-driven engine, it allows users to define complex patterns that capture syntax nodes as variables, enabling consistent and syntactically valid modifications across e
This command-line utility and static analysis engine operates directly on abstract syntax trees to search, lint, and refactor code, though it focuses primarily on structural search and rule-based refactoring rather than serving as a general-purpose lexer and parser generator library.
swift-syntax is a library for parsing, manipulating, and generating Swift source code. It provides a source-accurate abstract syntax tree representation of Swift code, acting as a parser, transformer, and code generator. The project serves as the infrastructure for Swift macro development, enabling the expansion and transformation of source code during compilation. It is used to build compiler tooling for static analysis, formatting, and automated refactoring. The system covers a broad range of source analysis capabilities, including the ability to convert source code into structured trees f
This library provides abstract syntax tree generation, lexer and parser capabilities, and code transformation specifically for Swift source code.
| Repository | Stars | Sprache | Lizenz | Letzter Push |
|---|---|---|---|---|
| lark-parser/lark | 5.9K | Python | MIT | |
| facebook/jscodeshift | 10K | JavaScript | mit | |
| tree-sitter/tree-sitter | 23.8K | Rust | mit | |
| dotnet/roslyn | 20.2K | C# | mit | |
| eliben/pycparser | 3.5K | Python | other | |
| benjamn/ast-types | 1.2K | TypeScript | MIT | |
| antlr/antlr4 | 18.9K | Java | BSD-3-Clause | |
| openrewrite/rewrite | 3.3K | Java | apache-2.0 | |
| rectorphp/rector | 10.2K | PHP | mit | |
| benjamn/recast | 5.2K | TypeScript | MIT |