code: def build_c_generator(
      grammar: Grammar,
      grammar_file: str,
      tokens_file: str,
      output_file: str,
      compile_extension: bool = False,
      verbose_c_extension: bool = False,
      keep_asserts_in_extension: bool = True,
      skip_actions: bool = False,
  ) -> ParserGenerator:
      with open(tokens_file, "r") as tok_file:
          (
              all_tokens,
              exact_tok,
              non_exact_tok,
          ) = generate_token_definitions(tok_file)
      with open(output_file, "w") as file:
          gen: ParserGenerator = CParserGenerator(
              grammar,
              all_tokens,
              exact_tok,
              non_exact_tok,
              file,
              skip_actions=skip_actions,
          )
          gen.generate(grammar_file)
  
      if compile_extension:
          with tempfile.TemporaryDirectory() as build_dir:
              compile_c_extension(
                  output_file,
                  build_dir=build_dir,
                  verbose=verbose_c_extension,
                  keep_asserts=keep_asserts_in_extension,
              )
      return gen
  
imports: import itertools
  import logging
  import os
  import pathlib
  import sys
  import sysconfig
  import tempfile
  import tokenize
  from typing import IO, Any, Dict, List, Optional, Set, Tuple
  from pegen.c_generator import CParserGenerator
  from pegen.grammar import Grammar
  from pegen.grammar_parser import GeneratedParser
  from pegen.parser import Parser
  from pegen.parser_generator import ParserGenerator
  from pegen.python_generator import PythonParserGenerator
  from pegen.tokenizer import Tokenizer
label_desc: Use image node_id 6 for calling a global function with example usage: build_c_generator(grammar, grammar_file, tokens_file, output_file, compile_extension, verbose_c_extension, keep_asserts_in_extension, skip_actions) and returns: gen