Struct cfg::prediction::FirstSets
[−]
[src]
pub struct FirstSets { // some fields omitted }
FIRST sets.
Methods
impl FirstSets
fn new<'a, G>(grammar: &'a G) -> Self where G: ContextFree, &'a G: ContextFreeRef<'a, Target=G>
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.
fn first_sets(&self) -> &PerSymbolSets
Returns a reference to FIRST sets.