class_docstr: Keeps reference counts of all the arguments, so that they are not
  garbage collected by Python.
class_docstr_tok: ["Keeps","reference","counts","of","all","the","arguments",",","so","that","they","are","not","garbage","collected","by","Python","."]
docstr: Initialize the grammar pointer from the parsed state.
docstr_tok: ["Initialize","the","grammar","pointer","from","the","parsed","state","."]
code: def __init__(
      self,
      parsed_grammar: "parse_state",
  ) -> None:
      """Initialize the grammar pointer from the parsed state."""
      self._grammar_rules = (
          parsed_grammar.c_rules()
      )  # type: std.vector[std.vector[LlamaGrammarElement]]
      self._n_rules = self._grammar_rules.size()  # type: int
      self._start_rule_index = parsed_grammar.symbol_ids.at(
          "root"
      )  # type: int
      self.init()
  
imports: from pathlib import Path
  import sys
  from ctypes import *
  from enum import Enum
  from itertools import islice
  from typing import Any, Callable, Dict, Generic, List, Optional, OrderedDict, TextIO, Tuple, TypeVar, Union, overload
  import llama_cpp.llama_cpp
  import json
  import re
  from typing import List, Optional
label_desc: Use image node_id 2 to create a new LlamaGrammar object  with example: obj = LlamaGrammar(parsed_grammar)