static void Remove_Epsilon(string state, CAutomat automat, string fake_state, CAutomat NonEpsilon) { foreach (CTranzitie Aux_tranz in automat.get_Tranzitii()) { if (state == Aux_tranz.get_dinspre()) { if (Aux_tranz.get_cost() == "e") { Remove_Epsilon(Aux_tranz.get_catre(), automat, fake_state, NonEpsilon); } else { var tranz_noua = new CTranzitie(Aux_tranz.get_catre(), fake_state, Aux_tranz.get_cost()); NonEpsilon.Accept_Tranzitii(tranz_noua); } } } }
static void Main(string[] args) { CAutomat automat = new CAutomat(); Citeste_automatul(args[0], automat); Afiseaza_automatul(automat); CAutomat NonEpsilon = new CAutomat(automat); foreach (CTranzitie Aux_tranz in automat.get_Tranzitii()) { Remove_Epsilon(Aux_tranz.get_dinspre(), automat, Aux_tranz.get_dinspre(), NonEpsilon); } File.AppendAllText("out.txt", Environment.NewLine); File.AppendAllText("out.txt", Environment.NewLine); NonEpsilon.Clean_automat(); NonEpsilon.Remove_useless_states(); // NonEpsilon.Clean_automat(); Afiseaza_automatul(NonEpsilon); }