Example #1
0
        /// <summary>
        /// Retorna o estado correspondente ao fecho.
        /// </summary>
        /// <returns>O estado correspondente.</returns>
        new public GrammarState PowerSetToState()
        {
            GrammarState newState = new GrammarState(State);

            foreach (StateTransiction <string, Symbol> transiction in Transictions)
            {
                if (!transiction.Transiction.Value.Equals(Terminal.Empty))
                {
                    newState.AddTransiction(transiction);
                }
            }

            return(newState);
        }
Example #2
0
        /// <summary>
        /// Converte um estado genérico com T = string e E = símbolo para um GrammarState
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        public static GrammarState ConvertFrom(State <string, Symbol> state)
        {
            if (state == null)
            {
                return(null);
            }

            GrammarState newState = new GrammarState(state.StateValue, state.IsFinal);
            List <StateTransiction <string, Symbol> > transictions = state.Transictions;

            foreach (StateTransiction <string, Symbol> transiction in transictions)
            {
                newState.AddTransiction(transiction);
            }

            return(newState);
        }