Skip to content

JosephPotashnik/EarleyParser

Repository files navigation

EarleyParser C# Implementation

A robust and efficient implementation of the Earley parsing algorithm in C#. This parser handles context-free grammars and provides detailed parse trees for natural language processing, programming language parsing, and other text analysis tasks.

Overview

The Earley algorithm is a powerful chart parsing technique that can process any context-free grammar, including ambiguous grammars, without the need for grammar transformations. This implementation offers:

  • Support for any context-free grammar (CFG)
  • Efficient parsing with O(n³) time complexity in the worst case
  • Detailed parse tree construction
  • Ambiguity handling

Documentation :

Generated from XML code documentation: here

Installation

Via NuGet Package Manager

Install-Package EarleyParser

Via .NET CLI

dotnet add package EarleyParser

Usage

Basic Example

using EarleyParser;

// Define a simple grammar

// Create a parser with the grammar


// Parse a sentence

Handling Ambiguity

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

  • Jay Earley, for developing the original algorithm

About

An optimised Earley Parser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published