view tests/agcl/parsifal/good/ss-kb.cpp @ 24:a4899cdfc2d6 default tip

Obfuscate the regexps to strip off the IBM compiler's copyright banners. I don't want bots scanning github to think they're real copyright notices because that could cause real problems.
author David A. Holland
date Mon, 13 Jun 2022 00:40:23 -0400
parents 13d2b8934445
children
line wrap: on
line source


/*
 * AnaGram, A System for Syntax Directed Programming
 * File generated by: ...
 *
 * AnaGram Parsing Engine
 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
 *
 * This software is provided 'as-is', without any express or implied
 * warranty.  In no event will the authors be held liable for any damages
 * arising from the use of this software.
 *
 * Permission is granted to anyone to use this software for any purpose,
 * including commercial applications, and to alter it and redistribute it
 * freely, subject to the following restrictions:
 *
 * 1. The origin of this software must not be misrepresented; you must not
 *    claim that you wrote the original software. If you use this software
 *    in a product, an acknowledgment in the product documentation would be
 *    appreciated but is not required.
 * 2. Altered source versions must be plainly marked as such, and must not be
 *    misrepresented as being the original software.
 * 3. This notice may not be removed or altered from any source distribution.
 */

#ifndef SS-KB_H
#include "ss-kb.h"
#endif

#ifndef SS-KB_H
#error Mismatched header file
#endif

#include <stdio.h>

#define RULE_CONTEXT (&((PCB).cs[(PCB).ssx]))
#define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx])
#define CONTEXT ((PCB).cs[(PCB).ssx])



ss-kb_pcb_type ss-kb_pcb;
#define PCB ss-kb_pcb
#define CHANGE_REDUCTION(x) ss-kb_change_reduction(ss-kb_##x##_token)
int ss-kb_change_reduction(ss-kb_token_type);

#define REDUCTION_CHOICES(x) ss-kb_reduction_choices(x)
int ss-kb_reduction_choices(int *ag_tp);

/*  Line -, ss-kb.syn */
#include "ssd.h"

char text_buffer[100];
int text_index;
pair<int> text_cursor = {INPUT_LINE, 1};

#define GET_INPUT {int c;\
  PCB.input_code = ((c=getch()) != 0 ? c : getch()+256);}

#define SYNTAX_ERROR

#define STATUS(x,y) PCB.reduction_token = (x)?kb_##y##_token:kb_not_##y##_token

void beep(void) {
  sound(440);
  delay(75);
  nosound();
}

void accept_text(message *m, char *t) {
  display_message(m);
  init_text_edit(t);
}

void backspace_char(void) {
  if (text_cursor.col == 1) return;
  text_cursor_left();
  delete_char();
}

int check_digits(void){
  char *tb = text_buffer + 1;
  int n;
  for (n = 0; *tb;) n = 10*n + *tb++ - '0';
  if (n > 7) CHANGE_REDUCTION(bad_digits_spec);
  return n;
}

void delete_cell(void) {
  cell_pointer cp = ss[ac.ssc.row][ac.ssc.col];
  if (cp) free(cp);
  ss[ac.ssc.row][ac.ssc.col] = NULL;
  update_cell(ac.scc, ac.ssc);
  set_active_cell();
}

void delete_char(void) {
  strcpy(&text_buffer[text_cursor.col], &text_buffer[text_cursor.col+1]);
  display_field(
    text_cursor,
    SCREEN_WIDTH - text_cursor.col,
    LEFT,
    TEXT_COLOR,
    "%s",
    &text_buffer[text_cursor.col]
  );
  set_cursor(text_cursor);
}

void delete_column(void) {
  int i,j;
  new_column = ac.ssc.col;
  for (i = 0; i < MAXROWS; i++) if (ss[i][new_column]) free(ss[i][new_column]);
  for (i = new_column; i < max_col; i++)
    for (j = 0; j <= max_row; j++)
      ss[j][i] = ss[j][i+1];
  for (j = 0; j <= max_row; j++) ss[j][max_col] = NULL;
  max_col--;
  inserted_columns = -1;
  relabel(0,new_column);
  new_column = inserted_columns = 0;
}

void delete_row(void) {
  int i,j;
  new_row = ac.ssc.row;
  for (i = 0; i < MAXCOLS; i++) if (ss[new_row][i]) free(ss[new_row][i]);
  for (i = new_row; i < max_row; i++)
    for (j = 0; j <= max_col; j++)
      ss[i][j] = ss[i+1][j];
  for (j = 0; j <= max_col; j++) ss[max_row][j] = NULL;
  max_row--;
  inserted_rows = -1;
  relabel(new_row,0);
  new_row = inserted_rows = 0;
}

void init_cell_edit(void) {
  cell_pointer cp = ss[ac.ssc.row][ac.ssc.col];
  if (cp) strcpy(text_buffer+1, cp->text);
  else text_buffer[1] = 0;
  text_cursor.col = strlen(text_buffer+1) + 1;
  textattr(TEXT_COLOR);
  _setcursortype(_NORMALCURSOR);
  input_msg.msg = text_buffer+1;
  display_message(&input_msg);
  set_cursor(text_cursor);
}

void init_text_edit(char *c) {
  if (c) strcpy(text_buffer+1, c);
  text_cursor.col = strlen(text_buffer+1) + 1;
  textattr(TEXT_COLOR);
  _setcursortype(_NORMALCURSOR);
  input_msg.msg = text_buffer+1;
  display_message(&input_msg);
  set_cursor(text_cursor);
}

void init_text_input(int c) {
  textattr(TEXT_COLOR);
  _setcursortype(_NORMALCURSOR);
  text_buffer[text_cursor.col = 1] = c;
  set_cursor(text_cursor);
  putch(c);
  text_buffer[++text_cursor.col] = 0;
}

void insert_char(int c){
  int n = strlen(&text_buffer[text_cursor.col]);
  memmove(&text_buffer[text_cursor.col+1], &text_buffer[text_cursor.col], n+1);
  text_buffer[81] = 0;
  text_buffer[text_cursor.col++] = c;
  putch(c);
  display_field(text_cursor, n, LEFT, TEXT_COLOR, &text_buffer[text_cursor.col]);
  set_cursor(text_cursor);
}

void insert_column(void) {
  int i,j;
  if (max_col + 1 >= MAXCOLS) {
    for (i = 0; i < MAXROWS; i++) if (ss[i][max_col]) free(ss[i][max_col]);
  }
  max_col++;
  new_column = ac.ssc.col;
  for (i = max_col; i > new_column; i--)
    for (j = 0; j <= max_row; j++)
      ss[j][i] = ss[j][i-1];
  for (j = 0; j < MAXROWS; j++) ss[j][new_column] = NULL;
  inserted_columns = 1;
  relabel(0,new_column);
  new_column = inserted_columns = 0;
}

void insert_row(void) {
  int i,j;
  if (max_row + 1 >= MAXROWS) {
    for (i = 0; i < MAXCOLS; i++) if (ss[max_row][i]) free(ss[max_row][i]);
  }
  max_row++;
  new_row = ac.ssc.row;
  for (i = max_row; i > new_row; i--)
    for (j = 0; j <= max_col; j++)
      ss[i][j] = ss[i-1][j];
  for (j = 0; j < MAXCOLS; j++) ss[new_row][j] = NULL;
  inserted_rows = 1;
  relabel(new_row,0);
  new_row = inserted_rows = 0;
}

void recalc(void) {
  int i,j;
  recalc_flag = 1;
  circular_flag = 0;
  for (i = 0; i <= max_row; i++) for (j = 0; j <= max_col; j++) {
    cell_pointer cp = ss[i][j];

    if (cp == NULL || cp->type != formula) continue;
    if (cp->recalc == recalc_count) eval(cp);
  }
  recalc_count += 2;
  recalc_flag = 0;
  update_screen();
  set_active_cell();
}

void relabel(int row, int col) {
  int i,j;

  n_changes++;
  for (i = row; i <= max_row; i++) for (j = col; j <= max_col; j++) {
    cell_pointer cp = ss[i][j];

    if (cp == NULL || cp->type != formula) continue;
    relabel_formula(cp);
  }
  update_screen();
  set_active_cell();
}

void set_cell_text(void) {
  char *tb = text_buffer + 1;
  cell_pointer cp = realloc(
    ss[ac.ssc.row][ac.ssc.col],
    sizeof(cell_descriptor) + strlen(tb)
  );
  n_changes++;
  assert(cp);
  if (ac.ssc.row > max_row) max_row = ac.ssc.row;
  if (ac.ssc.col > max_col) max_col = ac.ssc.col;
  strcpy(cp->text, tb);
  cp->error = 0;
  ss[ac.ssc.row][ac.ssc.col] = cp;
  cp->recalc = recalc_count;
  _setcursortype(_NOCURSOR);
  eval(cp);
  if (cp->type != text && autocalc_flag) recalc();
  else {
    update_cell(ac.scc, ac.ssc);
    set_active_cell();
  }
}

void text_cursor_end(void) {
  while (text_buffer[text_cursor.col]) {
    text_cursor.col++;
  }
  set_cursor(text_cursor);
}

void text_cursor_home(void) {
  if (text_cursor.col == 1) return;
  text_cursor.col = 1;
  set_cursor(text_cursor);
}

void text_cursor_left(void) {
  if (text_cursor.col == 1) return;
  text_cursor.col--;
  set_cursor(text_cursor);
}

void text_cursor_right(void) {
  if (text_buffer[text_cursor.col] == 0) return;
  if (text_cursor.col >= SCREEN_WIDTH) return;
  text_cursor.col++;
  set_cursor(text_cursor);
}

void toggle_formula_display(void) {
  formula_flag = !formula_flag;
  display_message(&form_msg);
  update_screen();
  set_active_cell();
}


#ifndef CONVERT_CASE
#define CONVERT_CASE(c) (c)
#endif
#ifndef TAB_SPACING
#define TAB_SPACING 8
#endif

static void ag_rp_1(void) {
/* Line -, ss-kb.syn */
  display_message(&file_error_msg);
}

static void ag_rp_2(void) {
/* Line -, ss-kb.syn */
  accept_text(&goto_msg,"");
}

static void ag_rp_3(void) {
/* Line -, ss-kb.syn */
  accept_text(&load_from_msg, file_name);
}

static void ag_rp_4(void) {
/* Line -, ss-kb.syn */
  accept_text(&nonexistent_msg, file_name);
}

static void ag_rp_5(void) {
/* Line -, ss-kb.syn */
  display_message(&file_exists_msg);
}

static void ag_rp_6(void) {
/* Line -, ss-kb.syn */
  display_message(&changes_msg);
}

static void ag_rp_7(void) {
/* Line -, ss-kb.syn */
  accept_text(&save_to_msg, file_name);
}

static void ag_rp_8(void) {
/* Line -, ss-kb.syn */
  accept_text(&print_to_msg, file_name);
}

static void ag_rp_9(void) {
/* Line -, ss-kb.syn */
  accept_text(&block_msg,"");
}

static void ag_rp_10(void) {
/* Line -, ss-kb.syn */
  accept_text(&decimals_msg, "");
}

static void ag_rp_11(void) {
/* Line -, ss-kb.syn */
  accept_text(&bad_decimals_msg,NULL);
}

static void ag_rp_12(void) {
/* Line -, ss-kb.syn */
  update_status();
}

static void ag_rp_13(void) {
/* Line -, ss-kb.syn */
  recalc();
}

static void ag_rp_14(void) {
/* Line -, ss-kb.syn */
  toggle_formula_display();
}

static void ag_rp_15(void) {
/* Line -, ss-kb.syn */
  autocalc_flag = !autocalc_flag;
}

static void ag_rp_16(void) {
/* Line -, ss-kb.syn */
  set_cell_text();
}

static void ag_rp_17(void) {
/* Line -, ss-kb.syn */
  delete_cell();
}

static void ag_rp_18(void) {
/* Line -, ss-kb.syn */
  page_up();
}

static void ag_rp_19(void) {
/* Line -, ss-kb.syn */
  page_down();
}

static void ag_rp_20(void) {
/* Line -, ss-kb.syn */
  scroll_left();
}

static void ag_rp_21(void) {
/* Line -, ss-kb.syn */
  scroll_right();
}

static void ag_rp_22(void) {
/* Line -, ss-kb.syn */
  home();
}

static void ag_rp_23(void) {
/* Line -, ss-kb.syn */
  end();
}

static void ag_rp_24(void) {
/* Line -, ss-kb.syn */
  cursor_up();
}

static void ag_rp_25(void) {
/* Line -, ss-kb.syn */
  cursor_down();
}

static void ag_rp_26(void) {
/* Line -, ss-kb.syn */
  cursor_left();
}

static void ag_rp_27(void) {
/* Line -, ss-kb.syn */
  cursor_right();
}

static void ag_rp_28(void) {
/* Line -, ss-kb.syn */
  quit();
}

static void ag_rp_29(void) {
/* Line -, ss-kb.syn */
  insert_column();
}

static void ag_rp_30(void) {
/* Line -, ss-kb.syn */
  delete_column();
}

static void ag_rp_31(void) {
/* Line -, ss-kb.syn */
  insert_row();
}

static void ag_rp_32(void) {
/* Line -, ss-kb.syn */
  delete_row();
}

static void ag_rp_33(void) {
/* Line -, ss-kb.syn */
  print();
}

static void ag_rp_34(void) {
/* Line -, ss-kb.syn */
  set_conversion(currency);
}

static void ag_rp_35(void) {
/* Line -, ss-kb.syn */
  set_conversion(general);
}

static void ag_rp_36(int n) {
/* Line -, ss-kb.syn */
  set_decimals(n);
}

static void ag_rp_37(int h) {
/* Line -, ss-kb.syn */
  set_alignment(h);
}

static int ag_rp_38(void) {
/* Line -, ss-kb.syn */
  return LEFT;
}

static int ag_rp_39(void) {
/* Line -, ss-kb.syn */
  return CENTER;
}

static int ag_rp_40(void) {
/* Line -, ss-kb.syn */
  return RIGHT;
}

static int ag_rp_41(void) {
/* Line -, ss-kb.syn */
  return check_digits();
}

static int ag_rp_42(void) {
/* Line -, ss-kb.syn */
  return check_digits();
}

static void ag_rp_43(void) {
/* Line -, ss-kb.syn */
  go();
}

static void ag_rp_44(void) {
/* Line -, ss-kb.syn */
  accept_text(&col_width_msg,"");
}

static void ag_rp_45(void) {
/* Line -, ss-kb.syn */
  set_column_width();
}

static void ag_rp_46(void) {
/* Line -, ss-kb.syn */
  parse_cell_name();
}

static void ag_rp_47(void) {
/* Line -, ss-kb.syn */
  parse_cell_name();
}

static void ag_rp_48(void) {
/* Line -, ss-kb.syn */
  ;
}

static void ag_rp_49(void) {
/* Line -, ss-kb.syn */
  ;
}

static void ag_rp_50(void) {
/* Line -, ss-kb.syn */
  parse_block();
}

static void ag_rp_51(void) {
/* Line -, ss-kb.syn */
  parse_block();
}

static void ag_rp_52(void) {
/* Line -, ss-kb.syn */
  ;
}

static void ag_rp_53(void) {
/* Line -, ss-kb.syn */
  ;
}

static void ag_rp_54(void) {
/* Line -, ss-kb.syn */
  STATUS(n_changes, changed);
}

static void ag_rp_55(void) {
/* Line -, ss-kb.syn */
  ;
}

static void ag_rp_56(void) {
/* Line -, ss-kb.syn */
  load_file();
}

static void ag_rp_57(void) {
/* Line -, ss-kb.syn */
  check_file_name();
}

static void ag_rp_58(void) {
/* Line -, ss-kb.syn */
  write_file();
}

static void ag_rp_59(void) {
/* Line -, ss-kb.syn */
  write_file();
}

static void ag_rp_60(void) {
/* Line -, ss-kb.syn */
  clear();
}

static void ag_rp_61(void) {
/* Line -, ss-kb.syn */
  display_message(&clear_spreadsheet);
}

static void ag_rp_62(void) {
/* Line -, ss-kb.syn */
  display_menu(&main_menu);
}

static void ag_rp_63(void) {
/* Line -, ss-kb.syn */
  display_menu(&spreadsheet_menu);
}

static void ag_rp_64(void) {
/* Line -, ss-kb.syn */
  display_menu(&column_menu);
}

static void ag_rp_65(void) {
/* Line -, ss-kb.syn */
  display_menu(&row_menu);
}

static void ag_rp_66(void) {
/* Line -, ss-kb.syn */
  display_menu(&utility_menu);
}

static void ag_rp_67(void) {
/* Line -, ss-kb.syn */
  display_menu(&format_menu);
}

static void ag_rp_68(void) {
/* Line -, ss-kb.syn */
  display_menu(&label_menu);
}

static void ag_rp_69(void) {
/* Line -, ss-kb.syn */
  pm_msg();
}

static void ag_rp_70(void) {
/* Line -, ss-kb.syn */
  print_wide = !print_wide, pm_msg();
}

static void ag_rp_71(void) {
/* Line -, ss-kb.syn */
  (print_border = !print_border),pm_msg();
}

static void ag_rp_72(void) {
/* Line -, ss-kb.syn */
  print_block=TRUE,print_from=first_cell,print_to=last_cell,pm_msg();
}

static void ag_rp_73(void) {
/* Line -, ss-kb.syn */
  init_cell_edit();
}

static void ag_rp_74(void) {
/* Line -, ss-kb.syn */
  init_cell_edit();
}

static void ag_rp_75(int c) {
/* Line -, ss-kb.syn */
  init_text_input(c);
}

static void ag_rp_76(void) {
/* Line -, ss-kb.syn */
  init_text_input('ä');
}

static void ag_rp_77(void) {
/* Line -, ss-kb.syn */
  init_text_input('ã');
}

static void ag_rp_78(int c) {
/* Line -, ss-kb.syn */
  insert_char(c);
}

static void ag_rp_79(void) {
/* Line -, ss-kb.syn */
  insert_char(228);
}

static void ag_rp_80(void) {
/* Line -, ss-kb.syn */
  insert_char(227);
}

static void ag_rp_81(int d) {
/* Line -, ss-kb.syn */
  insert_char(d);
}

static void ag_rp_82(void) {
/* Line -, ss-kb.syn */
  backspace_char();
}

static void ag_rp_83(void) {
/* Line -, ss-kb.syn */
  delete_char();
}

static void ag_rp_84(void) {
/* Line -, ss-kb.syn */
  text_cursor_left();
}

static void ag_rp_85(void) {
/* Line -, ss-kb.syn */
  text_cursor_right();
}

static void ag_rp_86(void) {
/* Line -, ss-kb.syn */
  text_cursor_home();
}

static void ag_rp_87(void) {
/* Line -, ss-kb.syn */
  text_cursor_end();
}

static void ag_rp_88(void) {
/* Line -, ss-kb.syn */
  beep();
}


#define READ_COUNTS 
#define WRITE_COUNTS 
#undef V
#define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i]))
#undef VS
#define VS(i) (PCB).vs[(PCB).ssx + i]

#ifndef GET_CONTEXT
#define GET_CONTEXT CONTEXT = (PCB).input_context
#endif

typedef enum {
  ag_action_1,
  ag_action_2,
  ag_action_3,
  ag_action_4,
  ag_action_5,
  ag_action_6,
  ag_action_7,
  ag_action_8,
  ag_action_9,
  ag_action_10,
  ag_action_11,
  ag_action_12
} ag_parser_action;


#ifndef NULL_VALUE_INITIALIZER
#define NULL_VALUE_INITIALIZER = 0
#endif

static int const ag_null_value NULL_VALUE_INITIALIZER;

static const unsigned char ag_rpx[] = {
    0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12,  0,  0,  0, 13, 14,
   15, 16,  0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,  0,  0,  0,  0,
   28,  0,  0, 29, 30,  0, 31, 32,  0, 33,  0,  0,  0,  0,  0, 34, 35, 36,
   37, 38, 39, 40, 41, 42,  0,  0,  0,  0, 43, 44, 45,  0, 46, 47, 48, 49,
   50, 51, 52, 53,  0,  0,  0,  0,  0,  0,  0,  0, 54, 55,  0,  0, 56,  0,
    0,  0,  0, 57, 58, 59,  0, 60,  0, 61, 62, 63, 64, 65, 66, 67, 68, 69,
   70, 71, 72, 73, 74, 75, 76, 77,  0, 78, 79, 80,  0,  0, 81,  0, 82, 83,
   84, 85, 86, 87, 88
};
#define AG_TCV(x) (((int)(x) >= 0 && (int)(x) <= 388) ? ag_tcv[(x)] : 0)

static const unsigned char ag_tcv[] = {
   16,104,104,104,104,104,104,104,103,104,104,104,104, 24,104,104, 99,104,
  104, 98,104,104,104,104,104,104,104, 25,104,104,104,104,105,105,105,105,
  105,105,105,105,105,105,105,105,105,105,105, 90,102,102,102,102,102,102,
  102,102,102,102,105,105,105,105,105,105,105, 21, 94, 55, 46, 96, 19, 57,
  105, 45,105,105, 61,105,106, 51, 92, 74, 62, 77,105, 91,105, 69,105, 82,
  105,105,105,105,105,105,105, 21, 94, 55, 46, 96, 19, 57,105, 45,105,105,
   61,105,106, 51, 92, 74, 62, 77,105, 91,105, 69,105, 82,105,105,105,105,
  105,105,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
  104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
  104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
  104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
  104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
  104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
  104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
  104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
  104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
  104,104,104,104,104,104,104,104,104,104,104,104,104, 75,104,104,104,104,
  104,104,104,104,104,104,104,104,104, 65, 95,104,104,104,104,104,104,104,
  104,104,104, 31, 33, 27,104, 35,104, 36,104, 32, 34, 28,104, 66,104,104,
  104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,
  104,104,104,104,104,104,104,104,104,104,104, 29, 30,104,104,104,104,104,
  104,104,104,104,104,104,104,104,104,104,104
};

#ifndef SYNTAX_ERROR
#define SYNTAX_ERROR fprintf(stderr,"%s\n", (PCB).error_message)
#endif

#ifndef PARSER_STACK_OVERFLOW
#define PARSER_STACK_OVERFLOW {fprintf(stderr, \
  "\nParser stack overflow\n");}
#endif

#ifndef REDUCTION_TOKEN_ERROR
#define REDUCTION_TOKEN_ERROR {fprintf(stderr, \
  "\nReduction token error\n");}
#endif


#ifndef GET_INPUT
#define GET_INPUT ((PCB).input_code = getchar())
#endif


static void ag_prot(void) {
  int ag_k;
  ag_k = 128 - ++(PCB).btsx;
  if (ag_k <= (PCB).ssx) {
    (PCB).exit_flag = AG_STACK_ERROR_CODE;
    PARSER_STACK_OVERFLOW;
    return;
  }
  (PCB).bts[(PCB).btsx] = (PCB).sn;
  (PCB).bts[ag_k] = (PCB).ssx;
  (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx];
  (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx];
}

static void ag_undo(void) {
  if ((PCB).drt == -1) return;
  while ((PCB).btsx) {
    int ag_k = 128 - (PCB).btsx;
    (PCB).sn = (PCB).bts[(PCB).btsx--];
    (PCB).ssx = (PCB).bts[ag_k];
    (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k];
    (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k];
  }
  (PCB).token_number = (ss-kb_token_type) (PCB).drt;
  (PCB).ssx = (PCB).dssx;
  (PCB).sn = (PCB).dsn;
  (PCB).drt = -1;
}



static const int ag_rtt[] = {
   58, 63,  0, 58, 63,  0, 47, 68,  0, 67, 70,  0, 67, 70,  0, 67, 70,  0,
   67, 70,  0, 56, 71,  0, 56, 71,  0, 56, 71,  0, 56, 71,  0, 80, 79,  0,
   86, 85,  0, 84, 87,  0, 84, 87,  0
};

static const unsigned char ag_tstt[] = {
106,105,102,99,98,96,95,94,92,91,90,82,77,75,74,69,66,65,62,61,57,55,51,46,
  45,42,36,35,34,33,32,31,30,29,28,27,21,19,0,12,13,14,15,17,18,20,22,26,
  37,38,39,40,41,43,44,47,48,49,50,53,54,59,68,72,89,
103,102,66,36,35,32,31,25,24,0,64,
106,105,104,103,102,99,98,96,95,94,92,91,90,82,77,75,74,69,66,65,62,61,57,
  55,51,46,45,36,35,34,33,32,31,30,29,28,27,25,24,21,19,16,0,73,79,80,83,
62,61,55,0,60,
61,57,55,19,0,
106,105,104,103,102,99,98,96,95,94,92,91,90,82,77,75,74,69,66,65,62,61,57,
  55,51,46,45,36,35,34,33,32,31,30,29,28,27,25,24,21,19,16,0,
92,77,61,55,0,
106,94,69,61,51,0,
25,0,
46,45,0,
69,46,45,0,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,25,24,21,19,0,23,
96,91,77,74,62,57,55,46,21,19,0,
62,19,0,
106,105,102,99,98,96,95,94,92,91,90,82,77,75,74,69,66,65,62,61,57,55,51,46,
  45,42,36,35,34,33,32,31,30,29,28,27,21,19,16,0,13,14,17,18,20,22,26,37,
  38,39,40,41,43,44,47,48,49,50,53,54,59,68,72,89,
103,102,66,42,36,35,32,31,25,24,0,101,
106,105,104,103,102,99,98,96,95,94,92,91,90,82,77,75,74,69,66,65,62,61,57,
  55,51,46,45,36,35,34,33,32,31,30,29,28,27,25,24,21,19,16,0,6,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,25,24,21,19,0,9,56,71,
103,102,66,36,35,32,31,24,0,10,58,63,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,25,24,21,19,0,9,56,71,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,25,24,21,19,0,9,56,71,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,24,21,19,0,7,78,
106,105,104,103,102,99,98,96,95,94,92,91,90,82,77,75,74,69,66,65,62,61,57,
  55,51,46,45,36,35,34,33,32,31,30,29,28,27,25,24,21,19,16,0,73,79,80,83,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,25,24,21,19,0,9,56,71,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,24,21,19,0,8,52,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,42,
  36,35,32,31,25,24,21,19,0,101,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,25,24,21,19,0,2,
106,105,104,103,102,99,98,96,95,94,92,91,90,82,77,75,74,69,66,65,62,61,57,
  55,51,46,45,36,35,34,33,32,31,30,29,28,27,25,24,21,19,16,0,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,25,24,21,19,0,23,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,25,24,21,19,0,23,
103,102,66,36,35,32,31,24,0,11,
103,102,66,36,35,32,31,24,0,64,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,25,24,21,19,0,9,56,71,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,24,21,19,0,23,84,85,86,87,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,24,21,19,0,3,76,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,24,21,19,0,23,85,86,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,25,24,21,19,0,23,67,70,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,24,21,19,0,7,78,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,42,
  36,35,32,31,25,24,21,19,0,101,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,42,
  36,35,32,31,25,24,21,19,0,101,
103,102,66,36,35,32,31,24,0,64,
103,102,66,42,36,35,32,31,24,0,101,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,42,
  36,35,32,31,24,21,19,0,101,
0,1,
106,105,104,103,102,99,98,96,95,94,92,91,90,82,77,75,74,69,66,65,62,61,57,
  55,51,46,45,36,35,34,33,32,31,30,29,28,27,25,24,21,19,16,0,5,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,24,21,19,0,23,85,86,
106,105,104,103,102,99,98,96,95,94,92,91,90,82,77,75,74,69,66,65,62,61,57,
  55,51,46,45,36,35,34,33,32,31,30,29,28,27,25,24,21,19,16,0,5,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,25,24,21,19,0,23,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,42,
  36,35,32,31,25,24,21,19,0,101,
103,102,66,42,36,35,32,31,24,0,101,
106,105,104,103,102,99,98,96,95,94,92,91,90,82,77,75,74,69,66,65,62,61,57,
  55,51,46,45,36,35,34,33,32,31,30,29,28,27,25,24,21,19,0,
106,105,104,103,102,99,98,96,95,94,92,91,90,82,77,75,74,69,66,65,62,61,57,
  55,51,46,45,36,35,34,33,32,31,30,29,28,27,25,24,21,19,16,0,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,24,21,19,0,4,
106,105,104,103,102,99,98,96,95,94,92,91,90,82,77,75,74,69,66,65,62,61,57,
  55,51,46,45,36,35,34,33,32,31,30,29,28,27,25,24,21,19,16,0,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,42,
  36,35,32,31,25,24,21,19,0,101,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,24,21,19,0,7,78,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,24,21,19,0,3,76,
106,105,103,102,99,98,96,94,92,91,90,82,77,74,69,66,62,61,57,55,51,46,45,36,
  35,32,31,24,21,19,0,8,52,

};


static unsigned const char ag_astt[1647] = {
  2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
  2,7,0,2,1,1,2,1,1,1,2,2,2,2,2,2,2,1,2,1,1,1,1,1,1,1,1,1,8,8,8,8,8,8,8,8,8,
  7,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
  4,4,4,4,4,4,4,7,3,3,1,2,2,2,2,7,1,2,1,1,1,7,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,
  3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,7,2,1,1,2,5,10,1,10,
  10,1,7,3,7,2,2,5,2,2,2,5,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
  8,8,8,8,8,8,7,1,2,2,2,3,2,1,2,3,2,2,5,3,2,5,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,
  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,7,2,3,2,1,1,1,2,2,2,2,2,2,
  2,1,2,1,1,1,1,1,1,1,1,1,2,10,2,2,2,2,2,2,3,2,7,3,4,4,4,4,4,4,4,4,4,4,4,4,4,
  4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,4,4,4,4,4,4,
  4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,2,1,4,4,4,4,4,4,4,4,
  7,1,1,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,
  2,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,2,1,
  4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,3,4,4,4,4,
  4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
  4,7,1,1,1,2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
  7,1,2,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,2,
  10,10,2,10,10,10,10,10,10,10,10,10,10,10,10,2,10,10,10,10,10,10,10,2,2,2,2,
  2,3,2,10,10,7,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
  4,4,7,1,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
  3,3,3,3,3,3,3,3,3,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
  8,8,8,8,7,1,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
  7,1,4,4,4,4,4,4,4,4,7,1,8,8,8,8,8,8,8,8,7,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
  4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,2,1,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
  8,8,8,8,8,8,8,8,8,8,8,8,8,7,1,3,1,2,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
  4,4,4,4,4,4,4,4,4,4,4,4,7,1,3,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
  8,8,8,8,8,8,8,8,7,1,1,3,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
  8,8,8,8,8,8,7,1,2,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
  4,4,4,7,1,3,10,10,2,10,10,10,10,10,10,10,10,10,10,10,10,2,10,10,10,10,10,
  10,10,2,2,2,2,2,2,2,10,10,7,3,10,10,2,10,10,10,10,10,10,10,10,10,10,10,10,
  2,10,10,10,10,10,10,10,2,2,2,2,2,2,2,10,10,7,3,8,8,8,8,8,8,8,8,7,1,2,10,2,
  2,2,2,2,2,2,7,3,10,10,2,10,10,10,10,10,10,10,10,10,10,10,10,2,10,10,10,10,
  10,10,10,2,2,2,2,2,2,10,10,7,3,7,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
  4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,8,8,8,8,8,8,8,8,8,8,8,8,8,
  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,1,2,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
  4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,8,8,8,8,8,8,8,8,8,
  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,1,10,10,2,10,10,10,10,10,10,
  10,10,10,10,10,10,2,10,10,10,10,10,10,10,2,2,2,2,2,2,2,10,10,7,3,2,10,2,2,
  2,2,2,2,2,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
  3,3,3,3,3,3,3,3,3,3,3,7,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
  4,4,4,4,4,4,4,4,4,4,4,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,10,10,2,10,10,10,10,10,10,10,10,10,
  10,10,10,2,10,10,10,10,10,10,10,2,2,2,2,2,2,2,10,10,7,3,4,4,4,4,4,4,4,4,4,
  4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,3,4,4,4,4,4,4,4,4,4,4,4,4,4,
  4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
  4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,3
};


static const unsigned char ag_pstt[] = {
113,113,113,115,114,113,111,113,113,113,100,113,113,2,113,113,21,16,113,113,
  113,113,113,113,113,12,31,30,29,28,27,26,25,24,23,22,113,113,0,0,12,14,
  14,16,13,12,11,21,12,12,12,12,36,12,10,12,9,8,7,6,4,3,1,2,5,
15,15,15,15,15,15,15,15,15,1,15,
84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
  84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,2,76,76,16,85,
57,55,56,3,17,
106,19,20,18,4,
98,98,98,98,98,98,98,98,98,98,98,98,98,97,98,98,98,98,98,98,98,98,98,98,98,
  98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,5,
107,21,22,99,47,
108,23,108,109,24,7,
44,8,
43,42,50,
65,40,39,49,
25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
  25,25,25,25,25,25,11,25,
112,104,101,77,103,26,102,63,18,105,46,
61,17,48,
113,113,113,115,114,113,111,113,113,113,100,113,113,2,113,113,21,16,113,113,
  113,113,113,113,113,12,31,30,29,28,27,26,25,24,23,22,113,113,15,14,12,
  14,16,13,12,11,21,12,12,12,12,36,12,10,12,9,8,7,6,4,3,1,2,5,
124,122,125,130,127,126,129,128,67,66,15,123,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
  6,6,6,6,16,27,
9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,17,29,54,28,
10,10,10,10,10,10,10,10,18,31,32,30,
9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,19,29,52,28,
9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,20,29,51,28,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,21,33,80,
84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
  84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,22,34,34,16,85,
9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,23,29,110,28,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,24,35,45,
117,117,124,117,119,118,117,117,117,117,117,117,117,117,117,125,117,117,117,
  117,117,117,117,130,127,126,129,128,20,19,117,117,25,120,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,26,36,
82,82,82,82,82,82,82,82,82,82,82,82,82,37,82,82,82,82,82,82,82,82,82,82,82,
  82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,27,
38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,
  38,38,38,38,38,38,28,38,
39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,
  39,39,39,39,39,39,29,39,
11,11,11,11,11,11,11,11,30,40,
41,41,41,41,41,41,41,41,31,41,
9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,32,29,53,28,
42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,
  42,42,42,42,42,33,42,86,44,94,43,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,34,45,79,
42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,
  42,42,42,42,42,35,42,46,90,
48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,
  48,48,48,48,48,48,36,48,64,47,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,37,33,83,
117,117,124,117,119,118,117,117,117,117,117,117,117,117,117,125,117,117,117,
  117,117,117,117,130,127,126,129,128,75,74,117,117,38,120,
117,117,124,117,119,118,117,117,117,117,117,117,117,117,117,125,117,117,117,
  117,117,117,117,130,127,126,129,128,73,72,117,117,39,120,
49,49,49,49,49,49,49,49,40,49,
124,122,125,130,127,126,129,128,58,41,123,
117,117,124,117,119,118,117,117,117,117,117,117,117,117,117,125,117,117,117,
  117,117,117,117,130,127,126,129,128,93,117,117,42,120,
43,50,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
  5,5,5,5,44,51,
42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,
  42,42,42,42,42,45,42,88,52,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
  5,5,5,5,46,53,
54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,
  54,54,54,54,54,54,47,54,
117,117,124,117,119,118,117,117,117,117,117,117,117,117,117,125,117,117,117,
  117,117,117,117,130,127,126,129,128,69,68,117,117,48,120,
124,122,125,130,127,126,129,128,59,49,123,
96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,
  96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,50,
55,55,55,55,55,55,55,55,55,55,55,55,55,95,55,55,55,55,55,55,55,55,55,55,55,
  55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,51,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,52,56,
57,57,57,57,57,57,57,57,57,57,57,57,57,91,57,57,57,57,57,57,57,57,57,57,57,
  57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,53,
117,117,124,117,119,118,117,117,117,117,117,117,117,117,117,125,117,117,117,
  117,117,117,117,130,127,126,129,128,71,70,117,117,54,120,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,55,33,87,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,56,45,89,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,57,35,92,

};


static const unsigned short ag_sbt[] = {
     0,  65,  76, 123, 128, 133, 176, 181, 187, 189, 192, 196, 229, 240,
   243, 307, 319, 363, 398, 410, 445, 480, 513, 560, 595, 628, 662, 695,
   738, 771, 804, 814, 824, 859, 895, 928, 962, 997,1030,1064,1098,1108,
  1119,1152,1154,1198,1232,1276,1309,1343,1354,1396,1439,1471,1514,1548,
  1581,1614,1647
};


static const unsigned short ag_sbe[] = {
    38,  74, 118, 126, 132, 175, 180, 186, 188, 191, 195, 227, 239, 242,
   282, 317, 361, 394, 406, 441, 476, 510, 555, 591, 625, 660, 693, 737,
   769, 802, 812, 822, 855, 889, 925, 958, 993,1027,1062,1096,1106,1117,
  1150,1152,1196,1228,1274,1307,1341,1352,1395,1438,1469,1513,1546,1578,
  1611,1644,1647
};


static const unsigned char ag_fl[] = {
  1,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,2,2,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,2,2,1,2,2,2,3,1,1,1,1,1,3,3,4,3,1,1,1,3,4,1,2,1,2,4,2,3,3,2,2,
  3,3,3,3,3,3,2,2,1,4,3,1,3,4,0,1,2,5,2,4,2,4,5,2,1,3,3,2,2,2,1,2,2,2,2,
  2,2,2,2,2,3,1,2,1,1,1,0,2,2,2,2,0,2,2,1,1,1,1,1,1,1
};

static const unsigned char ag_ptt[] = {
    0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 14, 15, 15, 12, 13, 13,
   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 49, 49, 49, 49, 49, 40, 40, 40,
   40, 60, 60, 60, 58, 58, 17, 17, 26, 26, 43, 68, 47, 47, 67, 67, 67, 67,
   56, 56, 56, 56, 41, 72, 72, 37, 38, 73, 73, 73, 83, 80, 78, 78, 76, 76,
   52, 52, 52, 86, 84, 84, 84, 39, 39, 89, 20, 53, 44, 48, 18, 54, 59, 50,
   50, 50, 50, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 64, 64, 64,101,101,
  101,101,101,101,101
};

static const unsigned char  *ag_valid(int ag_k) {
  const unsigned char  *ag_tp = &ag_tstt[ag_sbt[(PCB).sn+1]];
  while (*--ag_tp != (unsigned char) ag_k) if (*ag_tp == 0) return NULL;
  return ag_tp;
}

int ss-kb_change_reduction(ss-kb_token_type ag_k) {
  if (!ag_valid(ag_k)) return 0;
  (PCB).reduction_token = ag_k;
  return 1;
}

static void ag_default(const  int *ag_tp) {
  (PCB).ag_dsn = (PCB).sn;
  (PCB).ag_dtl = ag_tp;
  while (!ag_valid((ss-kb_token_type) *ag_tp)) ag_tp++;
  (PCB).reduction_token = (ss-kb_token_type) *ag_tp;
}


int ss-kb_reduction_choices(int *ag_tp) {
  int ag_k, ag_n;
  if ((PCB).ag_dsn != (PCB).sn) {
    *ag_tp = ag_ptt[(PCB).ag_ap];
    return 1;
  }
  for (ag_k = ag_n = 0; (PCB).ag_dtl[ag_k]; ag_k++) {
    if (!ag_valid((ss-kb_token_type) (PCB).ag_dtl[ag_k])) continue;
    ag_tp[ag_n++] = (PCB).ag_dtl[ag_k];
  }
  return ag_n;
}



static void ag_ra(void)
{
  switch(ag_rpx[(PCB).ag_ap]) {
    case 1: ag_rp_1(); break;
    case 2: ag_rp_2(); break;
    case 3: ag_rp_3(); break;
    case 4: ag_rp_4(); break;
    case 5: ag_rp_5(); break;
    case 6: ag_rp_6(); break;
    case 7: ag_rp_7(); break;
    case 8: ag_rp_8(); break;
    case 9: ag_rp_9(); break;
    case 10: ag_rp_10(); break;
    case 11: ag_rp_11(); break;
    case 12: ag_rp_12(); break;
    case 13: ag_rp_13(); break;
    case 14: ag_rp_14(); break;
    case 15: ag_rp_15(); break;
    case 16: ag_rp_16(); break;
    case 17: ag_rp_17(); break;
    case 18: ag_rp_18(); break;
    case 19: ag_rp_19(); break;
    case 20: ag_rp_20(); break;
    case 21: ag_rp_21(); break;
    case 22: ag_rp_22(); break;
    case 23: ag_rp_23(); break;
    case 24: ag_rp_24(); break;
    case 25: ag_rp_25(); break;
    case 26: ag_rp_26(); break;
    case 27: ag_rp_27(); break;
    case 28: ag_rp_28(); break;
    case 29: ag_rp_29(); break;
    case 30: ag_rp_30(); break;
    case 31: ag_rp_31(); break;
    case 32: ag_rp_32(); break;
    case 33: ag_rp_33(); break;
    case 34: ag_rp_34(); break;
    case 35: ag_rp_35(); break;
    case 36: ag_rp_36(VS(2)); break;
    case 37: ag_rp_37(VS(1)); break;
    case 38: VS(0) = ag_rp_38(); break;
    case 39: VS(0) = ag_rp_39(); break;
    case 40: VS(0) = ag_rp_40(); break;
    case 41: ag_default(&ag_rtt[0]); VS(0) = ag_rp_41(); break;
    case 42: ag_default(&ag_rtt[3]); VS(0) = ag_rp_42(); break;
    case 43: ag_rp_43(); break;
    case 44: ag_rp_44(); break;
    case 45: ag_default(&ag_rtt[6]); ag_rp_45(); break;
    case 46: ag_default(&ag_rtt[9]); ag_rp_46(); break;
    case 47: ag_default(&ag_rtt[12]); ag_rp_48(); break;
    case 48: ag_default(&ag_rtt[15]); ag_rp_47(); break;
    case 49: ag_default(&ag_rtt[18]); ag_rp_49(); break;
    case 50: ag_default(&ag_rtt[21]); ag_rp_50(); break;
    case 51: ag_default(&ag_rtt[24]); ag_rp_52(); break;
    case 52: ag_default(&ag_rtt[27]); ag_rp_51(); break;
    case 53: ag_default(&ag_rtt[30]); ag_rp_53(); break;
    case 54: ag_rp_54(); break;
    case 55: ag_default(&ag_rtt[33]); ag_rp_55(); break;
    case 56: ag_rp_56(); break;
    case 57: ag_default(&ag_rtt[36]); ag_rp_57(); break;
    case 58: ag_default(&ag_rtt[39]); ag_rp_58(); break;
    case 59: ag_default(&ag_rtt[42]); ag_rp_59(); break;
    case 60: ag_rp_60(); break;
    case 61: ag_rp_61(); break;
    case 62: ag_rp_62(); break;
    case 63: ag_rp_63(); break;
    case 64: ag_rp_64(); break;
    case 65: ag_rp_65(); break;
    case 66: ag_rp_66(); break;
    case 67: ag_rp_67(); break;
    case 68: ag_rp_68(); break;
    case 69: ag_rp_69(); break;
    case 70: ag_rp_70(); break;
    case 71: ag_rp_71(); break;
    case 72: ag_rp_72(); break;
    case 73: ag_rp_73(); break;
    case 74: ag_rp_74(); break;
    case 75: ag_rp_75(VS(0)); break;
    case 76: ag_rp_76(); break;
    case 77: ag_rp_77(); break;
    case 78: ag_rp_78(VS(1)); break;
    case 79: ag_rp_79(); break;
    case 80: ag_rp_80(); break;
    case 81: ag_rp_81(VS(1)); break;
    case 82: ag_rp_82(); break;
    case 83: ag_rp_83(); break;
    case 84: ag_rp_84(); break;
    case 85: ag_rp_85(); break;
    case 86: ag_rp_86(); break;
    case 87: ag_rp_87(); break;
    case 88: ag_rp_88(); break;
  }
}

static int ag_action_1_r_proc(void);
static int ag_action_2_r_proc(void);
static int ag_action_3_r_proc(void);
static int ag_action_4_r_proc(void);
static int ag_action_1_s_proc(void);
static int ag_action_3_s_proc(void);
static int ag_action_1_proc(void);
static int ag_action_2_proc(void);
static int ag_action_3_proc(void);
static int ag_action_4_proc(void);
static int ag_action_5_proc(void);
static int ag_action_6_proc(void);
static int ag_action_7_proc(void);
static int ag_action_8_proc(void);
static int ag_action_9_proc(void);
static int ag_action_10_proc(void);
static int ag_action_11_proc(void);
static int ag_action_8_proc(void);


static int (*const  ag_r_procs_scan[])(void) = {
  ag_action_1_r_proc,
  ag_action_2_r_proc,
  ag_action_3_r_proc,
  ag_action_4_r_proc
};

static int (*const  ag_s_procs_scan[])(void) = {
  ag_action_1_s_proc,
  ag_action_2_r_proc,
  ag_action_3_s_proc,
  ag_action_4_r_proc
};

static int (*const  ag_gt_procs_scan[])(void) = {
  ag_action_1_proc,
  ag_action_2_proc,
  ag_action_3_proc,
  ag_action_4_proc,
  ag_action_5_proc,
  ag_action_6_proc,
  ag_action_7_proc,
  ag_action_8_proc,
  ag_action_9_proc,
  ag_action_10_proc,
  ag_action_11_proc,
  ag_action_8_proc
};


static int ag_action_1_er_proc(void);
static int ag_action_2_er_proc(void);
static int ag_action_3_er_proc(void);
static int ag_action_4_er_proc(void);

static int (*const  ag_er_procs_scan[])(void) = {
  ag_action_1_er_proc,
  ag_action_2_er_proc,
  ag_action_3_er_proc,
  ag_action_4_er_proc
};


static void ag_error_resynch(void) {
  int ag_k;
  int ag_ssx = (PCB).ssx;

  SYNTAX_ERROR;
  if ((PCB).exit_flag != AG_RUNNING_CODE) return;
  while (1) {
    ag_k = ag_sbt[(PCB).sn];
    while (ag_tstt[ag_k] != 42 && ag_tstt[ag_k]) ag_k++;
    if (ag_tstt[ag_k] || (PCB).ssx == 0) break;
    (PCB).sn = (PCB).ss[--(PCB).ssx];
  }
  if (ag_tstt[ag_k] == 0) {
    (PCB).sn = PCB.ss[(PCB).ssx = ag_ssx];
    (PCB).exit_flag = AG_SYNTAX_ERROR_CODE;
    return;
  }
  ag_k = ag_sbt[(PCB).sn];
  while (ag_tstt[ag_k] != 42 && ag_tstt[ag_k]) ag_k++;
  (PCB).ag_ap = ag_pstt[ag_k];
  (ag_er_procs_scan[ag_astt[ag_k]])();
  while (1) {
    ag_k = ag_sbt[(PCB).sn];
    while (ag_tstt[ag_k] != (unsigned char) (PCB).token_number && ag_tstt[ag_k])
      ag_k++;
    if (ag_tstt[ag_k] && ag_astt[ag_k] != ag_action_10) break;
    if ((PCB).token_number == 16)
       {(PCB).exit_flag = AG_SYNTAX_ERROR_CODE; return;}
    {if ((PCB).read_flag == 0) (PCB).read_flag = 1;}
    if ((PCB).read_flag) {
      (PCB).read_flag = 0;
      GET_INPUT;
    };
    (PCB).token_number = (ss-kb_token_type) AG_TCV((PCB).input_code);
  }
}


static int ag_action_10_proc(void) {
  int ag_t = (PCB).token_number;
  (PCB).btsx = 0, (PCB).drt = -1;
  do {
    {if ((PCB).read_flag == 0) (PCB).read_flag = 1;}
    if ((PCB).read_flag) {
      (PCB).read_flag = 0;
      GET_INPUT;
    };
    (PCB).token_number = (ss-kb_token_type) AG_TCV((PCB).input_code);
  } while ((PCB).token_number == (ss-kb_token_type) ag_t);
  return 1;
}

static int ag_action_11_proc(void) {
  int ag_t = (PCB).token_number;

  (PCB).btsx = 0, (PCB).drt = -1;
  do {
    (PCB).vs[(PCB).ssx] = (PCB).input_code;
    (PCB).ssx--;
    {if ((PCB).read_flag == 0) (PCB).read_flag = 1;}
    ag_ra();
    if ((PCB).exit_flag != AG_RUNNING_CODE) return 0;
    (PCB).ssx++;
    if ((PCB).read_flag) {
      (PCB).read_flag = 0;
      GET_INPUT;
    };
    (PCB).token_number = (ss-kb_token_type) AG_TCV((PCB).input_code);
  }
  while ((PCB).token_number == (ss-kb_token_type) ag_t);
  return 1;
}

static int ag_action_3_r_proc(void) {
  int ag_sd = ag_fl[(PCB).ag_ap] - 1;
  if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
  (PCB).btsx = 0, (PCB).drt = -1;
  (PCB).reduction_token = (ss-kb_token_type) ag_ptt[(PCB).ag_ap];
  ag_ra();
  return (PCB).exit_flag == AG_RUNNING_CODE;
}

static int ag_action_3_s_proc(void) {
  int ag_sd = ag_fl[(PCB).ag_ap] - 1;
  if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
  (PCB).btsx = 0, (PCB).drt = -1;
  (PCB).reduction_token = (ss-kb_token_type) ag_ptt[(PCB).ag_ap];
  ag_ra();
  return (PCB).exit_flag == AG_RUNNING_CODE;
}

static int ag_action_4_r_proc(void) {
  int ag_sd = ag_fl[(PCB).ag_ap] - 1;
  if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
  (PCB).reduction_token = (ss-kb_token_type) ag_ptt[(PCB).ag_ap];
  return 1;
}

static int ag_action_2_proc(void) {
  (PCB).btsx = 0, (PCB).drt = -1;
  if ((PCB).ssx >= 128) {
    (PCB).exit_flag = AG_STACK_ERROR_CODE;
    PARSER_STACK_OVERFLOW;
  }
  (PCB).vs[(PCB).ssx] = (PCB).input_code;
  (PCB).ss[(PCB).ssx] = (PCB).sn;
  (PCB).ssx++;
  (PCB).sn = (PCB).ag_ap;
  {if ((PCB).read_flag == 0) (PCB).read_flag = 1;}
  return 0;
}

static int ag_action_9_proc(void) {
  if ((PCB).drt == -1) {
    (PCB).drt=(PCB).token_number;
    (PCB).dssx=(PCB).ssx;
    (PCB).dsn=(PCB).sn;
  }
  ag_prot();
  (PCB).vs[(PCB).ssx] = ag_null_value;
  (PCB).ss[(PCB).ssx] = (PCB).sn;
  (PCB).ssx++;
  (PCB).sn = (PCB).ag_ap;
  return (PCB).exit_flag == AG_RUNNING_CODE;
}

static int ag_action_2_r_proc(void) {
  (PCB).ssx++;
  (PCB).sn = (PCB).ag_ap;
  return 0;
}

static int ag_action_7_proc(void) {
  --(PCB).ssx;
  (PCB).exit_flag = AG_SUCCESS_CODE;
  return 0;
}

static int ag_action_1_proc(void) {
  {if ((PCB).read_flag == 0) (PCB).read_flag = 1;}
  (PCB).exit_flag = AG_SUCCESS_CODE;
  return 0;
}

static int ag_action_1_r_proc(void) {
  (PCB).exit_flag = AG_SUCCESS_CODE;
  return 0;
}

static int ag_action_1_s_proc(void) {
  (PCB).exit_flag = AG_SUCCESS_CODE;
  return 0;
}

static int ag_action_4_proc(void) {
  int ag_sd = ag_fl[(PCB).ag_ap] - 1;
  (PCB).reduction_token = (ss-kb_token_type) ag_ptt[(PCB).ag_ap];
  (PCB).btsx = 0, (PCB).drt = -1;
  (PCB).vs[(PCB).ssx] = (PCB).input_code;
  if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
  else (PCB).ss[(PCB).ssx] = (PCB).sn;
  {if ((PCB).read_flag == 0) (PCB).read_flag = 1;}
  while ((PCB).exit_flag == AG_RUNNING_CODE) {
    unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
    unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
    do {
      unsigned ag_tx = (ag_t1 + ag_t2)/2;
      if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
      else ag_t2 = ag_tx;
    } while (ag_t1 < ag_t2);
    if (ag_tstt[ag_t1] != (PCB).reduction_token) {
      (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; 
      REDUCTION_TOKEN_ERROR; break;}
      (PCB).ag_ap = ag_pstt[ag_t1];
    if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
  }
  return 0;
}

static int ag_action_3_proc(void) {
  int ag_sd = ag_fl[(PCB).ag_ap] - 1;
  (PCB).btsx = 0, (PCB).drt = -1;
  (PCB).vs[(PCB).ssx] = (PCB).input_code;
  if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
  else (PCB).ss[(PCB).ssx] = (PCB).sn;
  {if ((PCB).read_flag == 0) (PCB).read_flag = 1;}
  (PCB).reduction_token = (ss-kb_token_type) ag_ptt[(PCB).ag_ap];
  ag_ra();
  while ((PCB).exit_flag == AG_RUNNING_CODE) {
    unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
    unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
    do {
      unsigned ag_tx = (ag_t1 + ag_t2)/2;
      if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
      else ag_t2 = ag_tx;
    } while (ag_t1 < ag_t2);
    if (ag_tstt[ag_t1] != (PCB).reduction_token) {
      (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; 
      REDUCTION_TOKEN_ERROR; break;}
      (PCB).ag_ap = ag_pstt[ag_t1];
    if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
  }
  return 0;
}

static int ag_action_8_proc(void) {
  int ag_k = ag_sbt[(PCB).sn];
  while (ag_tstt[ag_k] != 42 && ag_tstt[ag_k]) ag_k++;
  if (ag_tstt[ag_k] == 0) ag_undo();
  ag_error_resynch();
  return (PCB).exit_flag == AG_RUNNING_CODE;
}

static int ag_action_5_proc(void) {
  int ag_sd = ag_fl[(PCB).ag_ap];
  (PCB).btsx = 0, (PCB).drt = -1;
  if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
  else {
    (PCB).ss[(PCB).ssx] = (PCB).sn;
  }
  (PCB).reduction_token = (ss-kb_token_type) ag_ptt[(PCB).ag_ap];
  ag_ra();
  while ((PCB).exit_flag == AG_RUNNING_CODE) {
    unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
    unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
    do {
      unsigned ag_tx = (ag_t1 + ag_t2)/2;
      if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
      else ag_t2 = ag_tx;
    } while (ag_t1 < ag_t2);
    if (ag_tstt[ag_t1] != (PCB).reduction_token) {
      (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; 
      REDUCTION_TOKEN_ERROR; break;}
      (PCB).ag_ap = ag_pstt[ag_t1];
    if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break;
  }
  return (PCB).exit_flag == AG_RUNNING_CODE;
}

static int ag_action_6_proc(void) {
  int ag_sd = ag_fl[(PCB).ag_ap];
  (PCB).reduction_token = (ss-kb_token_type) ag_ptt[(PCB).ag_ap];
  if ((PCB).drt == -1) {
    (PCB).drt=(PCB).token_number;
    (PCB).dssx=(PCB).ssx;
    (PCB).dsn=(PCB).sn;
  }
  if (ag_sd) {
    (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
  }
  else {
    ag_prot();
    (PCB).vs[(PCB).ssx] = ag_null_value;
    (PCB).ss[(PCB).ssx] = (PCB).sn;
  }
  while ((PCB).exit_flag == AG_RUNNING_CODE) {
    unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
    unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
    do {
      unsigned ag_tx = (ag_t1 + ag_t2)/2;
      if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
      else ag_t2 = ag_tx;
    } while (ag_t1 < ag_t2);
    if (ag_tstt[ag_t1] != (PCB).reduction_token) {
      (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; 
      REDUCTION_TOKEN_ERROR; break;}
      (PCB).ag_ap = ag_pstt[ag_t1];
    if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break;
  }
  return (PCB).exit_flag == AG_RUNNING_CODE;
}


static int ag_action_2_er_proc(void) {
  (PCB).btsx = 0, (PCB).drt = -1;
  (PCB).vs[(PCB).ssx] = (PCB).input_code;
  (PCB).ssx++;
  (PCB).sn = (PCB).ag_ap;
  return 0;
}

static int ag_action_1_er_proc(void) {
  (PCB).btsx = 0, (PCB).drt = -1;
  (PCB).exit_flag = AG_SUCCESS_CODE;
  return 0;
}

static int ag_action_4_er_proc(void) {
  int ag_sd = ag_fl[(PCB).ag_ap] - 1;
  (PCB).btsx = 0, (PCB).drt = -1;
  (PCB).reduction_token = (ss-kb_token_type) ag_ptt[(PCB).ag_ap];
  if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
  else (PCB).ss[(PCB).ssx] = (PCB).sn;
  while ((PCB).exit_flag == AG_RUNNING_CODE) {
    unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
    unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
    do {
      unsigned ag_tx = (ag_t1 + ag_t2)/2;
      if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
      else ag_t2 = ag_tx;
    } while (ag_t1 < ag_t2);
    if (ag_tstt[ag_t1] != (PCB).reduction_token) {
      (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; 
      REDUCTION_TOKEN_ERROR; break;}
      (PCB).ag_ap = ag_pstt[ag_t1];
    if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
  }
  return 0;
}

static int ag_action_3_er_proc(void) {
  int ag_sd = ag_fl[(PCB).ag_ap] - 1;
  (PCB).btsx = 0, (PCB).drt = -1;
  if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
  else (PCB).ss[(PCB).ssx] = (PCB).sn;
  (PCB).reduction_token = (ss-kb_token_type) ag_ptt[(PCB).ag_ap];
  ag_ra();
  while ((PCB).exit_flag == AG_RUNNING_CODE) {
    unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
    unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
    do {
      unsigned ag_tx = (ag_t1 + ag_t2)/2;
      if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
      else ag_t2 = ag_tx;
    } while (ag_t1 < ag_t2);
    if (ag_tstt[ag_t1] != (PCB).reduction_token) {
      (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; 
      REDUCTION_TOKEN_ERROR; break;}
      (PCB).ag_ap = ag_pstt[ag_t1];
    if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
  }
  return 0;
}


void init_ss-kb(void) {
  (PCB).read_flag = 1;
  (PCB).error_message = "Syntax Error";
  (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0;
  (PCB).exit_flag = AG_RUNNING_CODE;
  (PCB).btsx = 0, (PCB).drt = -1;
}

void ss-kb(void) {
  init_ss-kb();
  (PCB).exit_flag = AG_RUNNING_CODE;
  while ((PCB).exit_flag == AG_RUNNING_CODE) {
    unsigned ag_t1 = ag_sbt[(PCB).sn];
    if (ag_tstt[ag_t1]) {
      unsigned ag_t2 = ag_sbe[(PCB).sn] - 1;
      if ((PCB).read_flag) {
        (PCB).read_flag = 0;
        GET_INPUT;
      };
      (PCB).token_number = (ss-kb_token_type) AG_TCV((PCB).input_code);
      do {
        unsigned ag_tx = (ag_t1 + ag_t2)/2;
        if (ag_tstt[ag_tx] > (unsigned char)(PCB).token_number)
          ag_t1 = ag_tx + 1;
        else ag_t2 = ag_tx;
      } while (ag_t1 < ag_t2);
      if (ag_tstt[ag_t1] != (unsigned char)(PCB).token_number)
        ag_t1 = ag_sbe[(PCB).sn];
    }
    (PCB).ag_ap = ag_pstt[ag_t1];
    (ag_gt_procs_scan[ag_astt[ag_t1]])();
  }
}