public void TestAccepts04() {
var productions = new HashSet<Production> {
CFGParser.Production("<X_2> -> <X_3> <X_1>"),
CFGParser.Production("<X_3> -> <X_1> <X_1>"),
CFGParser.Production("<X_0> -> 'x2' 'x0' <X_3> <X_2> <X_2>"),
CFGParser.Production("<X_2> -> 'x0' 'x3' <X_1> 'x0' 'x0'"),
CFGParser.Production("<X_3> -> <X_1>"),
CFGParser.Production("<X_2> -> <X_1> 'x4'"),
CFGParser.Production("<X_1> -> ε"),
CFGParser.Production("<X_0> -> <X_2>"),
CFGParser.Production("<X_1> -> 'x4' <X_2> <X_1> 'x0' 'x1'"),
CFGParser.Production("<X_1> -> <X_2> 'x0' 'x1' <X_2> <X_2>"),
CFGParser.Production("<X_2> -> 'x1' <X_2> 'x3'"),
CFGParser.Production("<X_1> -> <X_3> <X_0> <X_2> <X_3>"),
};
var g = new Grammar(productions, Nonterminal.Of("X_0"));
var h = g.ToCNF();
Assert.IsTrue(h.Accepts(Sentence.FromWords("x2 x0 x0 x3 x0 x0 x4")));
Assert.IsTrue(h.Accepts(Sentence.FromWords("x2 x0 x4 x4")));
Assert.IsTrue(h.Accepts(Sentence.FromWords("x0 x3 x0 x0")));
Assert.IsTrue(h.Accepts(Sentence.FromWords("x2 x0")));
Assert.IsTrue(h.Accepts(Sentence.FromWords("x4")));
}