You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix per symbol first set computation (Spec._firstSets()) for a non-epsilon
production to omit epsilon unless all RHS symbols' first sets contain epsilon.
Prior to this fix, epsilon was merged into the first set under the weaker
condition that a prefix of RHS contained epsilon in its first set. Note that
computeFirstSet(), which computes the first set for symbol strings (e.g. of RHS
prefixes during item set closure computation), does not contain this flaw.
In order for epsilon to be in a symbol's first set, the entire syntax subtree
rooted at the symbol must be capable of being constructed without containing any
tokens. The simplest case is for the symbol to have an epsilon production; the
more involved case (that this change fixes) is for the symbol to reduce one or
more RHS symbols which transitively contain only epsilon-reduced symbols at the
leaves.
Impacts:
- Per symbol first sets could erroneously contain epsilon.
- Per symbol follow sets could erroneously contain additional tokens. Follow
sets are not used for any purpose other than logging.
- Parser tables were affected only if a symbol had multiple productions which
could reduce on epsilon. But such productions would induce a parsing
ambiguity, so it was impossible to for LR(1)-compatible parsers to be
affected.
0 commit comments