def parse(input_ids,
          rules,
          nonterminals,
          start_idx_set,
          populate_fn,
          postprocess_fn,
          max_single_nt_applications=1,
          verbose=False):
  """Run bottom up parser where all inputs are terminals."""
  input_symbols = tuple(
      [cfg_rule.CFGSymbol(idx, cfg_rule.TERMINAL) for idx in input_ids])
  return parse_symbols(
      input_symbols,
      rules,
      nonterminals,
      start_idx_set,
      populate_fn,
      postprocess_fn,
      max_single_nt_applications=max_single_nt_applications,
      verbose=verbose)
Run bottom up parser where all inputs are terminals.
language/compgen/csl/cky/cfg_parser.py