Crate cfg

source ·
Expand description

Library for manipulations on context-free grammars. Most transformations are abstracted over grammar representations.

Modules

  • Binarized rules are rules that have at most two symbols on the right-hand side. A binarized grammar contains only such rules.
  • Classification of rules and grammars.
  • Generate strings from a grammar.
  • Any data carried alongside a grammar rule can be its history. Rule histories may contain more than semantic actions.
  • Precedenced rules are built with the builder pattern.
  • Prediction for predictive parsers.
  • Remaps symbols and removes unused symbols.
  • This module defines grammar rules. Each rule in a context-free grammar consists of a single symbol on its left-hand side and an array of symbols on its right-hand side. In this library, each rule carries additional value called “history.”
  • Sequences are similar to regex repetitions with numbering.
  • A type that can represent symbols in a context-free grammar. Symbols are distinguished by their IDs.