Exemplo n.º 1
0
        public static bool Read(this IAutomaton @this, string input)
        {
            @this.Print();
            var state = new HashSet <int>(@this.GetEpsilonClosure(@this.StartState));

            foreach (var c in input)
            {
                state = new HashSet <int>(@this.Step(state, c));
                if (!state.Any())
                {
                    return(false);
                }
            }
            return(@this.AcceptingStates.Intersect(state).Any());
        }