Struct cfg::BinarizedCfg [] [src]

pub struct BinarizedCfg<H = NullHistory> { /* fields omitted */ }

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

Methods

impl<H> BinarizedCfg<H>
[src]

Creates a BinarizedCfg.

Creates an empty BinarizedCfg with the given symbol source.

Creates a BinarizedCfg by binarizing a context-free grammar.

Sorts the rule array.

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

Removes consecutive duplicate rules.

impl<H> BinarizedCfg<H> where
    H: Binarize
[src]

Returns generated symbols.

Generates a new unique symbol.

Returns the number of symbols in use.

impl<H> BinarizedCfg<H> where
    H: Binarize + Clone + EliminateNulling
[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<H: Clone> Clone for BinarizedCfg<H>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<H> ContextFree for BinarizedCfg<H> where
    H: Binarize
[src]

Starts building a new rule.

Starts building a new precedenced rule.

impl<'a, H> ContextFreeRef<'a> for &'a BinarizedCfg<H> where
    H: Binarize + 'a, 
[src]

Immutable reference to a rule.

Iterator over immutable references to the grammar's rules.

Returns an iterator over immutable references to the grammar's rules.

impl<'a, H> ContextFreeMut<'a> for &'a mut BinarizedCfg<H> where
    H: Binarize + 'a, 
[src]

impl<H> RuleContainer for BinarizedCfg<H> where
    H: Binarize
[src]

The type of history carried with the rule.

Returns an immutable reference to the grammar's symbol source.

Returns a mutable reference to the grammar's symbol source.

Retains only the rules specified by the predicate. Read more

Inserts a rule with lhs and rhs on its LHS and RHS. The rule carries history.

Returns generated symbols.

Generates a new unique symbol.

Returns the number of symbols in use.