def METHOD_NAME(self):
    while True:
        top = self.stack.pop()
        if isinstance(top, Root):
            self.push_symbol(top)
            break
        elif isinstance(top, Action):
            self.action_function(top)
        elif not isinstance(top, Terminal):
            self.stack.extend(top.production)
        else:
            raise Exception(f"Internal Parser Exception: {top}")