コード例 #1
0
        public Nfa Kleene()
        {
            var newStart = new NfaState();
            var newEnd   = new NfaState();

            newStart.AddEpsilon(Start);
            newStart.AddEpsilon(newEnd);

            newEnd.AddEpsilon(Start);
            End.AddEpsilon(newEnd);

            return(new Nfa(newStart, newEnd));
        }
コード例 #2
0
        public Nfa Union(Nfa other)
        {
            var newStart = new NfaState();
            var newEnd   = new NfaState();

            newStart.AddEpsilon(Start);
            newStart.AddEpsilon(other.Start);

            End.AddEpsilon(newEnd);
            other.End.AddEpsilon(newEnd);

            return(new Nfa(newStart, newEnd));
        }
コード例 #3
0
 public Nfa Concatenation(Nfa other)
 {
     End.AddEpsilon(other.Start);
     return(this);
 }