awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
Hardmath123 avatar

Hardmath123/nearley

0
View on GitHub↗
3,740 stars·234 forks·JavaScript·MIT·11 viewsnearley.js.org↗

Nearley

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 for testing and a visualization tool that converts grammar definitions into SVG railroad diagrams.

The project covers a broad range of parsing capabilities, including the generation of abstract syntax trees through post-parse transformations, incremental input streaming for real-time processing, and modular grammar composition. It provides utilities for ambiguity detection, internal parse table inspection, and the integration of external lexers.

The generated parsers can be executed in both Node.js and web browser environments.

Features

  • Context-Free Grammar Frameworks - Implements a framework for specifying language rules that supports complex context-free grammar features like left recursion.
  • Earley Parsers - Provides a complete Earley parsing engine capable of handling all context-free grammars, including those with left-recursion.
  • Left-Recursive Grammar Parsing - Handles grammars with direct left recursion and right recursion without infinite loops.
  • Grammar Compilation - Transforms EBNF grammar definitions into executable JavaScript modules to process input text efficiently.
  • Ambiguous Parse Resolution - Identifies and returns all possible valid interpretations for a single input string when multiple valid paths exist.
  • Domain Specific Language Parsers - Provides tools to analyze and interpret domain-specific languages to generate structured data.
  • Language Definition Frameworks - Offers a toolkit for specifying the syntax and structure of custom programming or data languages.
  • Input String Parsing - Analyzes text strings using a compiled grammar to produce structured parse trees.
  • JavaScript Parser Toolkits - Provides a complete toolkit for defining context-free grammars and generating parsers for JavaScript environments.
  • Parse Tree Construction - Transforms sequences of tokens into structured derivations or parse trees based on defined production rules.
  • Abstract Syntax Tree Parsing - Converts raw parse trees into structured abstract syntax trees using custom post-parse transformation functions.
  • Incremental Parsing - Processes input via a streaming interface to provide partial results for real-time user interfaces.
  • Grammar Debugging Tools - Includes tools for inspecting parse tables and failure points to identify and resolve grammar conflicts.
  • Ambiguity Management - Handles input strings with left-recursive and ambiguous structures without failing using a chart-parsing algorithm.
  • Ambiguity Detection - Identifies when a single input string results in multiple valid parse trees to highlight grammar conflicts.
  • Parser Debugging Tools - Allows developers to inspect internal parse tables and test input strings to debug grammar rules.
  • Grammar Compositions - Supports importing and combining separate grammar definitions into a single integrated parser.
  • Visual Grammar Representations - Converts technical grammar rules into visual SVG railroad diagrams for better readability.
  • Tree Simplification - Reduces the complexity of parse trees by removing redundant data and whitespace to produce abstract syntax trees.
  • Logic Injection - Allows embedding of arbitrary code within grammar definitions to support complex post-processing or helper functions.
  • Incremental Stream Processing - Processes input incrementally as a stream to avoid loading entire datasets into memory.
  • Incremental Parsing Streams - Processes input through a streaming interface to provide partial parse results for real-time applications.
  • Grammatical Ambiguity Resolution - Implements strategies to identify and return multiple valid structural interpretations of a single input string.
  • Incremental Parsing Streams - Provides the ability to access partial parse results during incremental input processing for responsive interfaces.
  • Post-Parse Transformation - Runs custom functions after a rule match to convert raw arrays into structured objects or filtered data.
  • Grammar Macros - Uses macros to define reusable rule patterns that accept arguments and expand during compilation.
  • Railroad Diagram Generation - Converts grammar definitions into SVG railroad diagrams to provide a visual representation of language structure.
  • Parse Error Reporters - Identifies the exact location and cause of parsing failures to simplify the grammar debugging process.
  • Syntax Diagram Generators - Generates visual SVG railroad diagrams from formal grammar definitions for documentation.
  • Fuzz Testing - Generates random valid strings based on grammar definitions to find edge cases and bugs through fuzzing.
  • Grammar-Based Fuzzing - Produces automated tests and fuzzers from grammar definitions to ensure robust handling of diverse inputs.
  • Grammar-Based Generation - Produces synthetic input strings that strictly adhere to a defined grammar for parser stress testing.
  • Fuzzing Input Generators - Generates randomized data sequences specifically designed to trigger crashes and edge cases in the parser.
  • Incremental Parse Feedback - Parses input streams in real time to provide immediate feedback or predictive results in a UI.
  • Parser Generators - Simple and fast parser toolkit for JavaScript.

Star history

Star history chart for hardmath123/nearleyStar history chart for hardmath123/nearley

How this analysis was created: This summary and feature list are AI-generated from collected project material and can contain mistakes. Stars, license and language are imported from GitHub. Inclusion does not mean that we have tested or audited this project. Check the source documentation for any feature you depend on. Learn more on our About page.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Projects sharing features with Nearley

These projects share indexed features with Nearley. Shared tags can include platform or build tooling; verify the primary use case before treating a result as a replacement.
  • kach/nearleykach avatar

    kach/nearley

    3,740View on 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
    View on GitHub↗3,740
  • lark-parser/larklark-parser avatar

    lark-parser/lark

    5,914View on GitHub↗

    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

    Pythoncykearleygrammar
    View on GitHub↗5,914
  • ohmjs/ohmohmjs avatar

    ohmjs/ohm

    5,471View on 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
    View on GitHub↗5,471
  • dtolnay/syndtolnay avatar

    dtolnay/syn

    3,292View on GitHub↗

    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

    Rustproc-macro
    View on GitHub↗3,292
Compare all 30 related projects→

Frequently asked questions

What does hardmath123/nearley do?

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.

What are the main features of hardmath123/nearley?

The main features of hardmath123/nearley are: Context-Free Grammar Frameworks, Earley Parsers, Left-Recursive Grammar Parsing, Grammar Compilation, Ambiguous Parse Resolution, Domain Specific Language Parsers, Language Definition Frameworks, Input String Parsing.

Which projects share features with hardmath123/nearley?

Projects with overlapping indexed features include: kach/nearley — Nearley is a JavaScript parser toolkit and context-free grammar compiler. It functions as an Earley parser generator… lark-parser/lark — Lark is a Python parsing toolkit used to define grammars and convert raw text into annotated parse trees. It serves as… ohmjs/ohm — Ohm is a formal grammar parser generator and domain-specific language framework. It provides a system for defining… dtolnay/syn — syn is a Rust syntax tree parser and token stream converter. It serves as a toolkit for procedural macro development,… pest-parser/pest — Pest is a Rust parsing library and automatic parser generator that transforms formal grammar definitions into… rust-bakery/nom — nom is a parser combinator framework for Rust used to build complex parsers by combining small, reusable parsing…