public NFA Evaluate() { if (Op == RegOperation.String) { return(NFA.GenerateFromString(Content, Alphabet)); } if (Op == RegOperation.Set) { return(NFA.GenerateFromSet(Content, Alphabet)); } else if (Op == RegOperation.Union) { return(NFA.Union(Left.Evaluate(), Right.Evaluate())); } else if (Op == RegOperation.Concat) { return(NFA.Concat(Left.Evaluate(), Right.Evaluate())); } else if (Op == RegOperation.Star) { return(NFA.KleeneStar(Left.Evaluate())); } else if (Op == RegOperation.Plus) { return(NFA.Plus(Left.Evaluate())); } else if (Op == RegOperation.Group || Op == RegOperation.NonGroup) { return(Left.Evaluate()); } else { return(null); } }
public override NFA Visit() { return(NFA.Concat(Left.Visit(), Right.Visit())); }
public static NFA Plus(NFA m) { var ret = NFA.Concat(m, NFA.KleeneStar(m)); return(ret); }