public void TestCFG_EmptyRHS() { var input = "S -> (x) S (y) | () | (a)"; ContextFreeGrammar cfg = ContextFreeGrammar.Parse(input); TestCFG_EmptyRHS_check(cfg); ContextFreeGrammar cfg_ = ContextFreeGrammar.Parse(cfg.ToString()); TestCFG_EmptyRHS_check(cfg_); }
public String ToString() { double inPerc = numberOfShortWords * 1.0 / possibleShortWords; double outPerc = 1 - inPerc; double sparsity = Math.Min(inPerc, outPerc); return(" qual=" + Quality() + " dif=" + Difficulty() + " inNeeded=" + inNeeded + " outNeeded=" + outNeeded + " inPerc=" + inPerc + " outPerc=" + outPerc + " sparcity=" + sparsity + "\n" + grammar.ToString()); }
public String ToString() { String s = ""; foreach (var x in cykTable) { foreach (var y in x) { s += "{"; foreach (var nt in y.Item1) { s += nt; } s += "}"; } s += "\n"; } return(s + word + " qual=" + Quality() + " dif=" + Difficulty() + " fill=" + getFillingDegree() + " rep=" + getRepetetiveness() + "\n" + grammar.ToString()); }
public String ToString() { int inputProd = grammar.GetProductions().Count(); int outputProd = 0; if (sol != null) { outputProd = sol.GetProductions().Count(); } return(" qual=" + Quality() + " dif=" + Difficulty() + " inputProd=" + inputProd + " outputProd=" + outputProd + "\n" + grammar.ToString() + "\n ------- \n" + sol); }