Struct cfg::cycles::Cycles
[−]
[src]
pub struct Cycles<G> { /* fields omitted */ }
Provides information about cycles among unit derivations in the grammar. There are two ways of pruning cycles.
Methods
impl<'a, G> Cycles<&'a mut G> where
G: ContextFree,
&'b G: ContextFreeRef<'b, Target = G>,
&'b mut G: ContextFreeMut<'b, Target = G>,
[src]
G: ContextFree,
&'b G: ContextFreeRef<'b, Target = G>,
&'b mut G: ContextFreeMut<'b, Target = G>,
fn new(grammar: &'a mut G) -> Cycles<&'a mut G>
Analyzes the grammar's cycles.
fn cycle_free(&self) -> bool
Checks whether the grammar is cycle-free.
impl<'a, G> Cycles<&'a mut G> where
G: ContextFree,
&'a G: ContextFreeRef<'a, Target = G>,
&'a mut G: ContextFreeMut<'a, Target = G>,
[src]
G: ContextFree,
&'a G: ContextFreeRef<'a, Target = G>,
&'a mut G: ContextFreeMut<'a, Target = G>,
fn cycle_participants(
&'a self
) -> CycleParticipants<'a, G, <&'a G as ContextFreeRef<'a>>::Rules>
&'a self
) -> CycleParticipants<'a, G, <&'a G as ContextFreeRef<'a>>::Rules>
Iterates over rules that participate in a cycle.
fn remove_cycles(&mut self) where
&'a G: ContextFreeRef<'a, Target = G>,
&'a mut G: ContextFreeMut<'a, Target = G>,
&'a G: ContextFreeRef<'a, Target = G>,
&'a mut G: ContextFreeMut<'a, Target = G>,
Removes all rules that participate in a cycle. Doesn't preserve the language represented by the grammar.
fn rewrite_cycles(&mut self) where
G::History: Clone,
&'a G: ContextFreeRef<'a, Target = G>,
&'a mut G: ContextFreeMut<'a, Target = G>,
G::History: Clone,
&'a G: ContextFreeRef<'a, Target = G>,
&'a mut G: ContextFreeMut<'a, Target = G>,
Rewrites all rules that participate in a cycle. Preserves the language represented by the grammar.