diff --git a/bison_xml_file_ingest.py b/bison_xml_file_ingest.py index 288ca3ed702c62d07eda0f144d03957930406db0..3f46ae9e9a2396a1a4ed45a18372af99e1209070 100644 --- a/bison_xml_file_ingest.py +++ b/bison_xml_file_ingest.py @@ -103,7 +103,6 @@ acceptrule_number = the_special_accept_rule[0] #print(acceptrule_number) -list_of_automaton_states = {} renormalized_state_number = 0 state_original_to_monotone = {} @@ -118,6 +117,7 @@ for child in root.findall("./automaton/*"): print(state_original_to_monotone, "\n", state_monotone_to_original) +list_of_automaton_states = {} for child in root.findall("./automaton/*"): state_number = child.attrib["number"] @@ -162,15 +162,21 @@ for state_number, x in list_of_automaton_states.items(): -# we normalize rule numbers so we can use our convention elsewhere of there not being gaps, starting at 0 etc -# so we can use rule numbers as indices into arrays. Perhaps bison doesn't leave gaps but it's better to +# we have normalized rule and state numbers so we can use rule and state numbers +# as indices into arrays. Perhaps bison doesn't leave gaps but it's better to # be sure. -# Now we convert it into a 2-dimensional table: + + + +SRAction = Enum("Shift/Reduce Table Action", "SHIFT REDUCE ACCEPT") + +GOTOAction = Enum("Goto Table Action", "GOTO") + +# Now we convert the SHIFTs and REDUCEs into a 2-dimensional table: shift_reduce_table = [] -#for rule_number, state in list