public void debug_parse() throws java.lang.Exception {
  int act;
  symbol lhs_sym;
  short handle_size, lhs_sym_num;
  production_tab=production_table();
  action_tab=action_table();
  reduce_tab=reduce_table();
  debug_message("# Initializing parser");
  init_actions();
  user_init();
  cur_token=scan();
  debug_message("# Current token is #" + cur_token.sym);
  stack.push(new symbol(0,start_state()));
  tos=0;
  for (_done_parsing=false; !_done_parsing; ) {
    act=get_action(((symbol)stack.peek()).parse_state,cur_token.sym);
    if (act > 0) {
      cur_token.parse_state=act - 1;
      debug_shift(cur_token);
      stack.push(cur_token);
      tos++;
      cur_token=scan();
      debug_message("# Current token is #" + cur_token.sym);
    }
 else     if (act < 0) {
      lhs_sym=do_action((-act) - 1,this,stack,tos);
      lhs_sym_num=production_tab[(-act) - 1][0];
      handle_size=production_tab[(-act) - 1][1];
      debug_reduce((-act) - 1,lhs_sym_num,handle_size);
      for (int i=0; i < handle_size; i++) {
        stack.pop();
        tos--;
      }
      act=get_reduce(((symbol)stack.peek()).parse_state,lhs_sym_num);
      lhs_sym.parse_state=act;
      stack.push(lhs_sym);
      tos++;
      debug_message("# Goto state #" + act);
    }
 else     if (act == 0) {
      syntax_error(cur_token);
      if (!error_recovery(true)) {
        unrecovered_syntax_error(cur_token);
        done_parsing();
      }
    }
  }
}

public void debug_parse ( ) throws java . lang . Exception { int act ; symbol lhs_sym ; short handle_size , lhs_sym_num ; production_tab = production_table ( ) ; action_tab = action_table ( ) ; reduce_tab = reduce_table ( ) ; debug_message ( "# Initializing parser" ) ; init_actions ( ) ; user_init ( ) ; cur_token = scan ( ) ; debug_message ( "# Current token is #" + cur_token . sym ) ; stack . push ( new symbol ( 0 , start_state ( ) ) ) ; tos = 0 ; for ( _done_parsing = false ; ! _done_parsing ; ) { act = get_action ( ( ( symbol ) stack . peek ( ) ) . parse_state , cur_token . sym ) ; if ( act > 0 ) { cur_token . parse_state = act - 1 ; debug_shift ( cur_token ) ; stack . push ( cur_token ) ; tos ++ ; cur_token = scan ( ) ; debug_message ( "# Current token is #" + cur_token . sym ) ; } else if ( act < 0 ) { lhs_sym = do_action ( ( - act ) - 1 , this , stack , tos ) ; lhs_sym_num = production_tab [ ( - act ) - 1 ] [ 0 ] ; handle_size = production_tab [ ( - act ) - 1 ] [ 1 ] ; debug_reduce ( ( - act ) - 1 , lhs_sym_num , handle_size ) ; for ( int i = 0 ; i < handle_size ; i ++ ) { stack . pop ( ) ; tos -- ; } act = get_reduce ( ( ( symbol ) stack . peek ( ) ) . parse_state , lhs_sym_num ) ; lhs_sym . parse_state = act ; stack . push ( lhs_sym ) ; tos ++ ; debug_message ( "# Goto state #" + act ) ; } else if ( act == 0 ) { syntax_error ( cur_token ) ; if ( ! error_recovery ( true ) ) { unrecovered_syntax_error ( cur_token ) ; done_parsing ( ) ; } } } }
perform a parse with debugging output . this does exactly the same things as parse ( ) , except that it calls debug_shift ( ) and debug_reduce ( ) when shift and reduce moves are taken by the parser and produces various other debugging messages .
