public static Pair <HashSet <char>, Automaton <BDD> > parseRegexFromXML(XElement regex, XElement alphabet, CharSetSolver solver) { HashSet <char> al = new HashSet <char>(); XElement xmlAlphabet = XElement.Parse(RemoveAllNamespaces(alphabet.ToString())); string alRex = ""; bool first = true; foreach (XElement child in xmlAlphabet.Elements()) { char element = Convert.ToChar(child.Value); al.Add(element); if (first) { first = false; alRex += element; } else { alRex += "|" + element; } } XElement Regex = XElement.Parse(RemoveAllNamespaces(regex.ToString())); string rexpr = Regex.Value.Trim(); var escapedRexpr = string.Format(@"^({0})$", rexpr); Automaton <BDD> aut = null; try { aut = solver.Convert(escapedRexpr); } catch (ArgumentException e) { throw new PDLException("The input is not a well formatted regular expression: " + e.Message); } catch (AutomataException e) { throw new PDLException("The input is not a well formatted regular expression: " + e.Message); } var diff = aut.Intersect(solver.Convert(@"^(" + alRex + @")*$").Complement(solver), solver); if (!diff.IsEmpty) { throw new PDLException( "The regular expression should only accept strings over (" + alRex + ")*. Yours accepts the string '" + DFAUtilities.GenerateShortTerm(diff.Determinize(solver), solver) + "'"); } return(new Pair <HashSet <char>, Automaton <BDD> >(al, aut)); }