public static DFA NFAtoDFA(NFA nfa) { DFA dfa = new DFA(); HashSet <HashSet <state> > markedStates = new HashSet <HashSet <state> >(); HashSet <HashSet <state> > unMarkedStates = new HashSet <HashSet <state> >(); Dictionary <HashSet <state>, state> dfaStateNum = new Dictionary <HashSet <state>, state>(); HashSet <state> nfaInitial = new HashSet <state>(); nfaInitial.Add(nfa.start); return(dfa); }
public static void Main(string[] args) { HashSet <state> ab = new HashSet <state>(); ab.Add("q0"); NFA a = new NFA("q0", ab); List <state> aa = new List <state> { "q0", "q1", "q2" }; List <state> a2 = new List <state> { "q2" }; a.transitionTable.Add(new KeyValuePair <state, input>("q0", '0'), aa); a.transitionTable.Add(new KeyValuePair <state, input>("q1", '1'), a2); a.Show(); //DFA df = new DFA //{ // start = "q0", //}; //df.final.Add("q1"); //df.transitionTable.Add(new KeyValuePair<state, input>("q0", '0'), "q1"); //df.transitionTable.Add(new KeyValuePair<state, input>("q1", '1'), "q0"); //Console.WriteLine("The String {0} is {1}: " , "0101", df.Simulate("0101")); //df.Show(); Console.ReadKey(); }