Crate cfg [] [src]

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

Reexports

pub use rule::GrammarRule;

Modules

cycles

Cycle detection and elimination.

history

Any data carried alongside a grammar rule can be its history. Rule histories may contain more than semantic actions.

precedence

Precedenced rules are built with the builder pattern.

prediction

Prediction for predictive parsers.

remap

Remaps symbols and removes unused symbols.

rule

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."

sequence

Sequences are similar to regex repetitions with numbering.

symbol

A type that can represent symbols in a context-free grammar. Symbols are distinguished by their IDs.

usefulness

Analysis of rule usefulness.

Structs

BinarizedCfg

Representation for grammars where right-hand sides of all rules have at most two symbols.

Cfg

Basic representation of context-free grammars.

Symbol

A common grammar symbol type.

Traits

ContextFree

Trait for context-free grammars.

ContextFreeMut

Allows access to a ContextFreeRef through mutable references.

ContextFreeRef

This trait is currently needed to make the associated Rules iterator generic over a lifetime parameter.