// If nfa1 has form s1s ----> s1e // then nfa0 has form s0s ----> s0s // s0s -eps-> s1s // s1e -eps-> s0s public override Nfa MkNfa(Nfa.NameSource names) { Nfa nfa1 = r.MkNfa(names); int s0s = names.next(); Nfa nfa0 = new Nfa(s0s, s0s); foreach (KeyValuePair <int, List <Transition> > entry in nfa1.Trans) { nfa0.AddTrans(entry); } nfa0.AddTrans(s0s, null, nfa1.Start); nfa0.AddTrans(nfa1.Exit, null, s0s); return(nfa0); }
// If nfa1 has form s1s ----> s1e // then nfa0 has form s0s ----> s0s // s0s -eps-> s1s // s1e -eps-> s0s public override Nfa MkNfa(Nfa.NameSource names) { var nfa1 = r.MkNfa(names); var s0s = names.next(); var nfa0 = new Nfa(s0s, s0s); foreach (var entry in nfa1.Trans) { nfa0.AddTrans(entry); } nfa0.AddTrans(s0s, null, nfa1.Start); nfa0.AddTrans(nfa1.Exit, null, s0s); return(nfa0); }
// If nfa1 has form s1s ----> s1e // and nfa2 has form s2s ----> s2e // then nfa0 has form s1s ----> s1e -eps-> s2s ----> s2e public override Nfa MkNfa(Nfa.NameSource names) { Nfa nfa1 = r1.MkNfa(names); Nfa nfa2 = r2.MkNfa(names); Nfa nfa0 = new Nfa(nfa1.Start, nfa2.Exit); foreach (KeyValuePair <int, List <Transition> > entry in nfa1.Trans) { nfa0.AddTrans(entry); } foreach (KeyValuePair <int, List <Transition> > entry in nfa2.Trans) { nfa0.AddTrans(entry); } nfa0.AddTrans(nfa1.Exit, null, nfa2.Start); return(nfa0); }
// If nfa1 has form s1s ----> s1e // and nfa2 has form s2s ----> s2e // then nfa0 has form s1s ----> s1e -eps-> s2s ----> s2e public override Nfa MkNfa(Nfa.NameSource names) { var nfa1 = r1.MkNfa(names); var nfa2 = r2.MkNfa(names); var nfa0 = new Nfa(nfa1.Start, nfa2.Exit); foreach (var entry in nfa1.Trans) { nfa0.AddTrans(entry); } foreach (var entry in nfa2.Trans) { nfa0.AddTrans(entry); } nfa0.AddTrans(nfa1.Exit, null, nfa2.Start); return(nfa0); }
public abstract Nfa MkNfa(Nfa.NameSource names);
abstract public Nfa MakeNfa(Nfa.NameSource names);