pub struct FirstSets { /* private fields */ }Expand description
Collector of FIRST sets.
Implementations§
Source§impl FirstSets
impl FirstSets
Sourcepub fn new(grammar: &Cfg) -> Self
pub fn new(grammar: &Cfg) -> Self
Compute all FIRST sets of the grammar.
We define a binary relation FIRST(N, S), in which N is related to S
if the grammar has a production of the form N ⸬= α S β, where
α is a nullable string of symbols.
We compute the transitive closure of this relation.
Sourcepub fn first_set_for_string(&self, string: &[Symbol]) -> PerSymbolSetVal
pub fn first_set_for_string(&self, string: &[Symbol]) -> PerSymbolSetVal
Calculates a FIRST set for a string of symbols.
Trait Implementations§
Source§impl PredictSets for FirstSets
impl PredictSets for FirstSets
Source§fn predict_sets(&self) -> &PerSymbolSets
fn predict_sets(&self) -> &PerSymbolSets
Returns a reference to FIRST sets.
Auto Trait Implementations§
impl Freeze for FirstSets
impl RefUnwindSafe for FirstSets
impl Send for FirstSets
impl Sync for FirstSets
impl Unpin for FirstSets
impl UnwindSafe for FirstSets
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more