public void AddGoto(Symbol s, State next) { this.Goto[s] = next; if (s is Terminal) terminalTransitions.Add((Terminal)s); else nonTerminalTransitions.Add((NonTerminal)s, new Transition(this, (NonTerminal)s, next)); }
private void ExpandState(Symbol sym, State newState) { newState.accessedBy = sym; this.states.Add(newState); if (!this.accessedBy.ContainsKey(sym)) { this.accessedBy[sym] = new List<State>(); } this.accessedBy[sym].Add(newState); newState.AddClosure(); this.ComputeGoto(newState); }
private State FindExistingState(Symbol sym, List<ProductionItem> itemSet) { if (this.accessedBy.ContainsKey(sym)) { foreach (State current in this.accessedBy[sym]) { if (ProductionItem.SameProductions(current.kernal_items, itemSet)) { return current; } } } return null; }
private State FindExistingState(Symbol sym, List<ProductionItem> itemSet) { if (accessedBy.ContainsKey(sym)) foreach (State state in accessedBy[sym]) if (ProductionItem.SameProductions(state.kernal_items, itemSet)) return state; return null; }