private void ComputeIncludes() { // (p,A) include (q,B) iff B -> Beta A Gamma and Gamma => empty and q -> Beta -> p foreach (State q in states) { foreach (Transition qB in q.nonTerminalTransitions.Values) { foreach (Production prod in qB.A.productions) { for (int i = prod.rhs.Count - 1; i >= 0; i--) { Symbol A = prod.rhs[i]; if (A is NonTerminal) { State p = PathTo(q, prod, i); p.nonTerminalTransitions[(NonTerminal)A].includes.Add(qB); } if (!A.IsNullable()) { break; } } } } } }
private void ComputeIncludes() { foreach (State current in this.states) { foreach (Transition current2 in current.nonTerminalTransitions.Values) { foreach (Production current3 in current2.A.productions) { for (int i = current3.rhs.Count - 1; i >= 0; i--) { Symbol symbol = current3.rhs[i]; if (symbol is NonTerminal) { State state = this.PathTo(current, current3, i); state.nonTerminalTransitions[(NonTerminal)symbol].includes.Add(current2); } if (!symbol.IsNullable()) { break; } } } } } }