Skip to content
famished-tiger edited this page Jan 23, 2022 · 10 revisions

Parsers are used every time there is the need to turn strings of characters into meaningful data structures (like trees, ...).
Their emblematic use can be found in programming language implementations (where they are part of compilers or interpreters).
But they're essential in other uses as well:

  • In domain-specific languages,
  • Reading formatted text files (e.g., HTML, CSS, YAML, JSON,...).

Rley is a parser with the following features:

  • Implementation of the Earley parsing algorithm
  • In use in multiple programming language interpreters and NLP projects,
  • Provides a DSL for creating grammar rules,
  • 100% Ruby code (no C extensions required),
  • No runtime dependency outside standard Ruby distribution,
  • Clean object-oriented design.

Even if parsing algorithms isn't your prime concern, it is good to know that Earley parsers are capable of coping with any context-free grammars.
This includes ambiguous grammars, left- or right-recursive rules, ...

In fact, Rley is the only Earley parser written in Ruby that has been used in several open-source projects.