Beispiel #1
0
        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));
        }
Beispiel #2
0
		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);
		}
Beispiel #3
0
		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;
		}
Beispiel #4
0
        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;
        }