public TransitionTable GetTransitionTable()
        {

            string alphabet = this.CalculateAlphabet();

            DottedItemSet currentState = this.InitialSet;

            DottedItemSetIndex states = new DottedItemSetIndex();

            states.Add(currentState);

            Queue<int> unexpandedStates = new Queue<int>();
            unexpandedStates.Enqueue(0);

            TransitionTable transitionTable = new TransitionTable();

            while (unexpandedStates.Count > 0)
            {

                int currentStateIndex = unexpandedStates.Dequeue();
                currentState = states.GetItemSet(currentStateIndex);

                foreach (char input in alphabet)
                {

                    DottedItemSet nextState = currentState.GetFollowingSet(input);

                    if (nextState.IsEmpty)
                        continue;

                    int nextStateIndex;

                    if (states.Contains(nextState))
                    {
                        nextStateIndex = states.GetIndexFor(nextState);
                    }
                    else
                    {
                        states.Add(nextState);
                        nextStateIndex = states.GetIndexFor(nextState);
                        unexpandedStates.Enqueue(nextStateIndex);
                    }

                    transitionTable.SetTransition(currentStateIndex, input, nextStateIndex);

                    nextState
                        .TryReduceTokenClass()
                        .ForEach((tokenClass) => transitionTable.SetReduction(nextStateIndex, tokenClass));

                }

            }

            return transitionTable;

        }
 public TransitionTableVisualizer(TransitionTable table)
 {
     Contract.Requires<ArgumentNullException>(table != null, "Transition table must be non-null.");
     this.Table = table;
 }
 public TableDrivenLexer(TransitionTable transitionTable)
 {
     Contract.Requires<ArgumentNullException>(transitionTable != null, "Transition table must be non-null.");
     this.Table = transitionTable;
 }