diff --git a/CFGBoltzmann.py b/CFGBoltzmann.py index a9ffd3483eebd54b4136aefeb81f49aaace257dc..028f3e88895cde3c2673701edbe7d71e234f6b81 100644 --- a/CFGBoltzmann.py +++ b/CFGBoltzmann.py @@ -451,13 +451,14 @@ class CFGBoltzmann: else: # CASE B print(" "* depth +"GPRIM CASE B FIRST PRODUCES", [xijk], "with depth", depth) - reduct = self.Gprim(nonterminal_index, chosen_production, how_far_into_the_RHS + 1, exact_length_total - 1, depth+1, root_of_tree, nonterminal_root) - retstring = [xijk] + reduct - print(" "* depth +"GPRIM CASE B THEN ADDS ON", reduct, "with depth", depth) newnode = TreeNode(xijk, []) nonterminal_root.subnodes.append(newnode) + reduct = self.Gprim(nonterminal_index, chosen_production, how_far_into_the_RHS + 1, exact_length_total - 1, depth+1, root_of_tree, nonterminal_root) + retstring = [xijk] + reduct + print(" "* depth +"GPRIM CASE B THEN ADDS ON", reduct, "with depth", depth) + print(" "* depth +"Gprim inside the production of a nonterminal, adding terminal", xijk) # print(" "* depth +"GPRIM CASE B RETURNING", retstring) diff --git a/python_arborist.py b/python_arborist.py index b1e755a347dbe24a7c071ba0682da8f936ebe14d..424843c3b1e44813516fdeca5572674a696ffaec 100644 --- a/python_arborist.py +++ b/python_arborist.py @@ -316,7 +316,7 @@ list_of_terminals = [INTEGER, ADDOP, MULTOP, OPENPAREN, CLOSEPAREN] z = CFGBoltzmann.CFGBoltzmann(rules, list_of_nonterminals, list_of_terminals) cooked_rules = z.preprocessor() -bgen = z.Gzero_shimmed(EXPRESSION, 3) +bgen = z.Gzero_shimmed(EXPRESSION, 7) parse_me = bgen[0] print("derivation tree was")