Пример #1
0
  /**
   * Produce a (semi-) human readable dump of the complete viable prefix recognition state machine.
   */
  public static void dump_machine() {
    lalr_state ordered[] = new lalr_state[lalr_state.number()];

    /* put the states in sorted order for a nicer display */
    for (Enumeration s = lalr_state.all(); s.hasMoreElements(); ) {
      lalr_state st = (lalr_state) s.nextElement();
      ordered[st.index()] = st;
    }

    System.err.println("===== Viable Prefix Recognizer =====");
    for (int i = 0; i < lalr_state.number(); i++) {
      if (ordered[i] == start_state) System.err.print("START ");
      System.err.println(ordered[i]);
      System.err.println("-------------------");
    }
  }
Пример #2
0
 /** Call the emit routines necessary to write out the generated parser. */
 protected static void emit_parser() throws internal_error {
   emit.symbols(symbol_class_file, include_non_terms);
   emit.parser(
       parser_class_file,
       action_table,
       reduce_table,
       start_state.index(),
       emit.start_production,
       opt_compact_red);
 }