Verified Commit dffa3596 authored by Vladimír Štill's avatar Vladimír Štill
Browse files

Add a textual representation of terminals and nonterminals for the sake of debugging

parent 7f4e8d1b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -12,6 +12,9 @@ class Terminal:
    def __hash__(self):
        return hash(self.name)

    def __repr__(self) -> str:
        return f"Terminal({self.name})"


class Nonterminal:
    def __init__(self, name: str):
@@ -28,6 +31,9 @@ class Nonterminal:
    def __lt__(self, other) -> bool:
        return self.name < other.name

    def __repr__(self) -> str:
        return f"Nonterminal({self.name})"


class Character:
    def __init__(self, name: str):