def main_production(self):
        """Returns main rule"""
        for rule in self.productions:
            if rule.leftside[0] == self._initialsymbol:
                return rule
        raise IndexError
def main_production ( self ) : for rule in self . productions : if rule . leftside [ 0 ] == self . _initialsymbol : return rule raise IndexError
Returns main rule