human
Write me a the Python program you requested given the following:
I am working on the file "ANTLR4-Python/LR-Parser-Generator/LR-Table-Generator.ipynb".
The first task is:
Extended Marked Rules
The class ExtendedMarkedRule stores a single marked rule of the form
$$ v \rightarrow \alpha \bullet \beta : L $$
where the variable $v$ is stored in the member variable mVariable, while $\alpha$ and $\beta$ are stored in the variables mAlphaand mBeta respectively.  The set of follow tokens $L$ is stored in the variable mFollow. These variables are assumed to contain tuples of grammar symbols.  A grammar symbol is either
- a variable,
- a token, or
- a literal, i.e. a string enclosed in single quotes.
Later, we need to maintain sets of marked rules to represent states.  Therefore, we have to define the methods __eq__, __ne__, and __hash__.
Can you write Python program for it?
assistant
#Here is the Python program you requested.

class ExtendedMarkedRule():
    def __init__(self, variable, alpha, beta, follow):
        self.mVariable = variable
        self.mAlpha    = alpha
        self.mBeta     = beta
        self.mFollow   = follow
        
    def __eq__(self, other):
        return isinstance(other, ExtendedMarkedRule) and \
               self.mVariable == other.mVariable     and \
               self.mAlpha    == other.mAlpha        and \
               self.mBeta     == other.mBeta         and \
               self.mFollow   == other.mFollow
    
    def __ne__(self, other):
        return not self.__eq__(other)
    
    def __hash__(self):
        return hash(self.mVariable) + \
               hash(self.mAlpha)    + \
               hash(self.mBeta)     + \
               hash(self.mFollow)
    
    def __repr__(self):
        alphaStr  = ' '.join(self.mAlpha)
        betaStr   = ' '.join(self.mBeta)
        if len(self.mFollow) > 1:
            followStr = '{' + ','.join(self.mFollow) + '}'
        else:
            followStr = ','.join(self.mFollow)
        return f'{self.mVariable} → {alphaStr} • {betaStr}: {followStr}'