human
I am working on the file "ANTLR4-Python/SLR-Parser-Generator/SLR-Table-Generator.ipynb".
The first task is:
The Class GrammarRule
The class GrammarRule is used to store a single grammar rule.  As we have to use objects of type GrammarRule as keys in a dictionary later, we have to provide the methods __eq__, __ne__, and __hash__.
Can you write Python code for it?

Give me a the Python code you requested?
assistant
#Here is the Python code you requested.

class GrammarRule:
    def __init__(self, variable, body):
        self.mVariable = variable
        self.mBody     = body
        
    def __eq__(self, other):
        return isinstance(other, GrammarRule)    and \
               self.mVariable == other.mVariable and \
               self.mBody     == other.mBody
    
    def __ne__(self, other):
        return not self.__eq__(other)
    
    def __hash__(self):
        return hash(self.__repr__())
    
    def __repr__(self):
        return f'{self.mVariable} → {" ".join(self.mBody)}'