def METHOD_NAME(self: _P) -> _P:
    """
    Copy the grammar.
    """
    new = self.__class__()
    for dict_attr in (
        "symbol2number",
        "number2symbol",
        "dfas",
        "keywords",
        "soft_keywords",
        "tokens",
        "symbol2label",
    ):
        setattr(new, dict_attr, getattr(self, dict_attr).METHOD_NAME())
    new.labels = self.labels[:]
    new.states = self.states[:]
    new.start = self.start
    new.version = self.version
    new.async_keywords = self.async_keywords
    return new