예제 #1
0
        public static FiniteAutomata GenerateAutomataForRegex(string input)
        {
            var rootNode = NodeTreeCreator.Initialize(input);
            var states   = rootNode.Apply();
            var alphabet = new Alphabet(input.ToCharArray());
            var automata = new FiniteAutomata(
                $"Automata for regular expression {input}",
                alphabet,
                states,
                new List <Word>(),
                false,
                false);

            automata.AcceptWords();
            return(automata);
        }
예제 #2
0
        public static Node Initialize(string input)
        {
            var symbols = NodeTreeCreator.ParseToSymbols(input);

            return(NodeTreeCreator.CreateTree(symbols));
        }