[][src]Struct cfg::earley::BinarizedGrammar

pub struct BinarizedGrammar { /* fields omitted */ }

Drop-in replacement for cfg::BinarizedCfg.

Methods

impl BinarizedGrammar[src]

pub fn new() -> Self[src]

Creates a new BinarizedGrammar.

pub fn set_start(&mut self, start: Symbol)[src]

pub fn start(&self) -> Symbol[src]

impl BinarizedGrammar[src]

Methods from Deref<Target = BinarizedCfg<History>>

pub fn sort(&mut self)[src]

Sorts the rule array.

pub fn sort_by<F>(&mut self, compare: F) where
    F: FnMut(&BinarizedRule<H>, &BinarizedRule<H>) -> Ordering
[src]

Sorts the rule array in place, using the argument to compare elements.

pub fn dedup(&mut self)[src]

Removes consecutive duplicate rules.

pub fn sym<T>(&mut self) -> T where
    T: SymbolContainer
[src]

Returns generated symbols.

pub fn next_sym(&mut self) -> Symbol[src]

Generates a new unique symbol.

pub fn num_syms(&self) -> usize[src]

Returns the number of symbols in use.

pub fn eliminate_nulling_rules(&mut self) -> BinarizedCfg<H>[src]

Eliminates all rules of the form A ::= epsilon.

In other words, this splits off the set of nulling rules.

The language represented by the grammar is preserved, except for the possible lack of the empty string. Unproductive rules aren't preserved.

Trait Implementations

impl ContextFree for BinarizedGrammar[src]

impl<'a> ContextFreeRef<'a> for &'a BinarizedGrammar[src]

type RuleRef = RuleRef<'a, History>

Immutable reference to a rule.

type Rules = BinarizedRules<'a, History>

Iterator over immutable references to the grammar's rules.

impl RuleContainer for BinarizedGrammar[src]

type History = History

The type of history carried with the rule.

impl Clone for BinarizedGrammar[src]

impl Default for BinarizedGrammar[src]

impl Deref for BinarizedGrammar[src]

type Target = BinarizedCfg<History>

The resulting type after dereferencing.

impl DerefMut for BinarizedGrammar[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]