Example #1
0
        // 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 = this.r1.MkNfa(names);
            var nfa2 = this.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);
        }
Example #2
0
 public abstract Nfa MkNfa(Nfa.NameSource names);