Commit 161a397d authored by Vladimír Štill's avatar Vladimír Štill
Browse files

lib: Determinise string representation of {D,N}FA

parent 597b1e4e
Pipeline #113846 passed with stage
in 1 minute and 20 seconds
......@@ -71,7 +71,7 @@ def _unquote(txt: str) -> str:
def dfa_to_str(dfa: DFA, full: bool = False) -> str:
transition = ""
for key, dest_state in dfa.transition.items():
for key, dest_state in sorted(dfa.transition.items()):
state_1, character = key
transition += f"({state_1.name},{character.name})={dest_state.name} "
......@@ -116,7 +116,7 @@ def cfg_to_str(gra: CFG, full: bool = False) -> str:
def nfa_to_str(nfa: NFA, full: bool = False) -> str:
transition = ""
for key, set_states in nfa.transition.items():
for key, set_states in sorted(nfa.transition.items()):
state, character = key
dest_states = nfa.transition[state, character]
transition += f"({state.name},{character.name})=" \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment