view tests/agcl/examples/good/krc.cpp @ 9:60b08b68c750

Switch to static inline as an expedient build fix. Should probably set this up with working C99 inline but for the moment I don't have the energy.
author David A. Holland
date Mon, 30 May 2022 23:56:45 -0400
parents 13d2b8934445
children
line wrap: on
line source

/*
 * AnaGram, a System for Syntax Directed Programming
 * C Macro preprocessor
 * Sample C Grammar
 * Compatible with Kernighan and Ritchie, 2nd. Edition.
 *
 * Copyright 1993-2000 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.
 */

#include "mpp.h"

stack<unsigned> id_stack(100,20);


/*
 * 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 KRC_H
#include "krc.h"
#endif

#ifndef KRC_H
#error Mismatched header file
#endif

#include <ctype.h>
#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])



cc_pcb_type cc_pcb;
#define PCB cc_pcb
#define CHANGE_REDUCTION(x) cc_change_reduction(cc_##x##_token)
int cc_change_reduction(cc_token_type);

#define INPUT_VALUE(type) *(type *) &(PCB).input_value

#line - "krc.syn"
                                           // Embedded C
#include <stack.h>


// Macro Definitions

#define INPUT_CODE(T) (T).id
#define SYNTAX_ERROR  syntax_error(PCB.error_message)


// Variable definitions

static int use_count = 0;
symbol_type_enum symbol_table[N_SYMBOLS];


/*
  mark_typedef() gets a non_zero argument for typedef statements, a zero
  argument otherwise. If the argument is non-zero it marks all stacked
  identifiers as typedef_names. It then resets the id stack.
*/

static void mark_typedef(int mask) {
  unsigned x;
  if (mask) {
    while (size(id_stack)) {
      id_stack >> x;
      symbol_table[x] = typedef_name;
    }
    return;
  }
  reset(id_stack);
}

/*
  check_typedef() resolves a semantically determined productin by determining
  whether a token is a typedef_name or not.  If so it changes the reduction
  token appropriately.
*/

static token check_typedef(token t) {
  if (symbol_table[t.handle] == typedef_name)
    CHANGE_REDUCTION(typedef_name);
  return t;
}


// Member Functions for Class c_parser

// Constructor

/*
  This parser has no provisions for multiple simultaneous parses or for
  recursion. The purpose of use_count is to make sure that there is only one
  copy of the parser active at any time.
*/


c_parser::c_parser() {
  assert(use_count == 0);
  use_count++;
  reset(id_stack);
  memset(symbol_table, 0, sizeof(symbol_table));
  init_cc();                                // init parse
}


// Destructor

c_parser::~c_parser() {
  use_count--;                              // Makes parser available
}


// Reset Parser

c_parser &reset(c_parser &c) {
  reset(id_stack);
  memset(symbol_table, 0, sizeof(symbol_table));
  init_cc();                                // init parse
  return c;
}


// Transmit token to c_parser

/*
  The overloaded operator "<<" is used to transmit data to a parser.
  Newline tokens are filtered out, since they are passed along by the
  token scanner only in case text output of the preprocessor is
  required.

  If the parser has encountered an error, there is no point in giving
  it any further input.

  Otherwise, the input_code and input_value fields of the pcb are set
  up and cc() is called to deal with the token.
*/

token_sink &c_parser::operator << (token c) {
  if (PCB.exit_flag != AG_RUNNING_CODE || (int) c.id == '\n') return *this;
  PCB.input_code = c.id;
  PCB.input_value = c;
  cc();
  return *this;
}

token_sink &c_parser::operator << (token *s) {
  while (s->id != END_OF_FILE && PCB.exit_flag == AG_RUNNING_CODE) {
    if ((int) s->id == 10) continue;
    PCB.input_code = s->id;
    PCB.input_value = *s++;
    cc();
  }
  return *this;
}

#line - "krc.cpp"

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

static void ag_rp_1(int m) {
#line - "krc.syn"
  mark_typedef(m);
#line - "krc.cpp"
}

static int ag_rp_2(void) {
#line - "krc.syn"
  return 0;
#line - "krc.cpp"
}

static int ag_rp_3(void) {
#line - "krc.syn"
  return 0;
#line - "krc.cpp"
}

static int ag_rp_4(int m, int v) {
#line - "krc.syn"
  return m | v;
#line - "krc.cpp"
}

static int ag_rp_5(void) {
#line - "krc.syn"
  return 0;
#line - "krc.cpp"
}

static int ag_rp_6(void) {
#line - "krc.syn"
  return 0;
#line - "krc.cpp"
}

static int ag_rp_7(void) {
#line - "krc.syn"
  return 0;
#line - "krc.cpp"
}

static int ag_rp_8(void) {
#line - "krc.syn"
  return 0;
#line - "krc.cpp"
}

static int ag_rp_9(void) {
#line - "krc.syn"
  return 1;
#line - "krc.cpp"
}

static void ag_rp_10(void) {
#line - "krc.syn"
  ++id_stack;
#line - "krc.cpp"
}

static void ag_rp_11(void) {
#line - "krc.syn"
  --id_stack;
#line - "krc.cpp"
}

static void ag_rp_12(token n) {
#line - "krc.syn"
  id_stack << n.handle;
#line - "krc.cpp"
}

static token ag_rp_13(token n) {
#line - "krc.syn"
  return check_typedef(n);
#line - "krc.cpp"
}


#ifndef AG_TRACE_FILE_NAME
#define AG_TRACE_FILE_NAME "krc.etr"
#endif

static void ag_trace_error(void) {
  FILE *ag_file = fopen(AG_TRACE_FILE_NAME, "w");
  int i;
  if (ag_file == NULL) return;
  fprintf(ag_file, "%d\n", (PCB).ssx);
  for (i = 0; i < (PCB).ssx; i++) fprintf(ag_file, "%d\n", (PCB).ss[i]);
  fprintf(ag_file, "%d\n", (PCB).sn);
  fprintf(ag_file, "%d\n", (PCB).token_number);
  fclose(ag_file);
}


#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 cc_vs_type const ag_null_value NULL_VALUE_INITIALIZER;

static const unsigned char ag_rpx[] = {
    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  2,  3,
    4,  0,  0,  5,  6,  7,  8,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0,  0,  0, 10, 11,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0,  0, 13
};

#define AG_TCV(x) ag_tcv[(x)]

static const unsigned char ag_tcv[] = {
    4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,153,  0,  0,
    0,146,129,  0, 62, 63, 70,142, 48,143,157,145,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0, 55, 14,134, 49,135,119,  0,123,115,158,  0,149,109, 74,
  131,117,137,148,136,139,113,110,112,108,132,116,121,111,140,114,165,160,
    0, 64,  0, 66,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 41,125, 43,
  152,  0,  0,161,162,163,164, 83, 18,103, 89, 24, 35,102, 90, 99, 29, 96,
   57, 21, 28,100,101, 95, 26, 27, 19,104, 25, 30,151, 20, 44, 97, 22, 45,
   31, 23, 36, 98,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0
};

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

#ifndef FIRST_LINE
#define FIRST_LINE 1
#endif

#ifndef FIRST_COLUMN
#define FIRST_COLUMN 1
#endif

#ifndef PARSER_STACK_OVERFLOW
#define PARSER_STACK_OVERFLOW {fprintf(stderr, \
   "\nParser stack overflow, line %d, column %d\n",\
   (PCB).line, (PCB).column);}
#endif

#ifndef REDUCTION_TOKEN_ERROR
#define REDUCTION_TOKEN_ERROR {fprintf(stderr, \
    "\nReduction token error, line %d, column %d\n", \
    (PCB).line, (PCB).column);}
#endif


#ifndef AG_NEWLINE
#define AG_NEWLINE 10
#endif

#ifndef AG_RETURN
#define AG_RETURN 13
#endif

#ifndef AG_FORMFEED
#define AG_FORMFEED 12
#endif

#ifndef AG_TABCHAR
#define AG_TABCHAR 9
#endif

static void ag_track(void) {
  switch ((PCB).input_code) {
  case AG_NEWLINE:
    (PCB).column = 1, (PCB).line++;
  case AG_RETURN:
  case AG_FORMFEED:
    break;
  case AG_TABCHAR:
    (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING);
    break;
  default:
    (PCB).column++;
  }
  (PCB).read_flag = 1;
}


static void ag_prot(void) {
  int ag_k;
  ag_k = 128 - ++(PCB).btsx;
  if (ag_k <= (PCB).ssx) {
    ag_trace_error();
    (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 = (cc_token_type) (PCB).drt;
  (PCB).ssx = (PCB).dssx;
  (PCB).sn = (PCB).dsn;
  (PCB).drt = -1;
}



static const int ag_rtt[] = {
   38, 34,  0
};

static const unsigned char ag_tstt[] = {
83,70,62,57,45,44,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,0,1,3,5,6,
  7,8,11,15,16,17,32,33,34,37,38,60,61,
83,41,0,38,39,
83,41,0,38,39,
83,70,64,63,62,48,36,35,0,17,71,72,
83,70,62,0,8,38,60,61,
83,62,0,38,60,
64,62,0,
83,70,62,57,45,44,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,14,0,8,12,
  13,15,16,17,32,33,34,37,38,47,60,61,
83,57,45,44,41,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,0,7,9,10,11,
  15,16,17,32,33,34,37,
83,70,62,57,45,44,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,4,0,5,6,7,
  8,11,15,16,17,32,33,34,37,38,60,61,
83,70,64,63,62,57,55,48,45,44,41,36,35,31,30,29,28,27,26,25,24,23,22,21,20,
  19,18,14,0,
41,0,
83,70,64,63,62,57,55,48,45,44,41,36,35,31,30,29,28,27,26,25,24,23,22,21,20,
  19,18,14,0,
41,0,40,
36,35,0,17,
70,0,61,
63,0,
64,62,0,
83,63,57,45,44,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,0,11,15,16,
  17,32,33,34,37,38,67,68,69,73,75,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,66,62,0,38,56,
  65,105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
48,0,
14,0,
83,57,49,45,44,41,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,0,7,9,10,
  11,15,16,17,32,33,34,37,
83,70,62,57,45,44,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,14,0,8,12,
  13,15,16,17,32,33,34,37,38,47,60,61,
83,57,45,44,41,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,0,7,9,11,15,
  16,17,32,33,34,37,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,104,103,102,101,100,
  99,98,97,95,90,89,83,70,63,62,57,45,44,43,41,36,35,31,30,29,28,27,26,25,
  24,23,22,21,20,19,18,14,0,2,7,9,10,11,15,16,17,32,33,34,37,38,78,84,85,
  86,87,88,91,92,93,94,105,106,118,120,122,124,126,128,130,133,138,141,
  144,147,150,154,159,
83,0,38,58,59,
41,0,
48,0,
63,0,
83,70,64,63,62,57,48,45,44,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,
  0,8,15,16,17,32,33,34,37,38,60,61,76,77,81,
48,0,
63,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  147,150,154,159,
158,157,149,148,64,62,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,57,45,44,
  36,35,31,30,29,28,27,26,25,24,23,0,16,17,32,33,34,37,38,51,78,80,91,105,
  106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
146,145,70,0,
143,142,0,
140,139,0,
137,136,135,134,0,
132,131,0,
129,0,
127,0,
125,0,
123,0,
121,119,0,
66,0,
83,70,62,0,8,38,47,60,61,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,41,0,38,50,
  78,105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
83,57,45,44,41,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,0,7,9,11,15,
  16,17,32,33,34,37,
49,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,104,103,102,101,100,
  99,98,97,95,90,89,83,70,63,62,57,45,44,43,41,36,35,31,30,29,28,27,26,25,
  24,23,22,21,20,19,18,14,0,2,7,9,11,15,16,17,32,33,34,37,38,78,84,85,86,
  87,88,91,92,93,94,105,106,118,120,122,124,126,128,130,133,138,141,144,
  147,150,154,159,
117,116,115,114,113,112,111,110,109,108,49,0,107,
48,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,14,0,38,78,
  91,92,105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,
  159,
14,0,
14,0,
83,0,38,
62,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,104,103,102,101,100,
  99,98,97,95,90,89,83,70,62,41,14,0,2,9,38,78,84,85,86,87,88,91,92,105,
  106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
62,0,
62,0,
62,0,
14,0,
55,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,56,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
55,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,104,103,102,101,100,
  99,98,97,95,90,89,83,70,63,62,43,41,14,0,2,9,38,78,84,85,86,87,88,91,92,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
43,0,
49,0,
48,43,0,
83,57,45,44,36,35,31,30,29,28,27,26,25,24,23,0,16,17,32,33,34,37,42,46,51,
83,0,38,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,66,62,0,38,56,
  65,105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
64,62,0,
83,70,64,63,62,57,45,44,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,0,8,
  11,15,16,17,32,33,34,37,38,60,61,67,73,75,76,81,82,
83,64,62,0,38,60,81,
83,74,57,45,44,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,0,11,15,16,
  17,32,33,34,37,75,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,57,45,44,
  36,35,31,30,29,28,27,26,25,24,23,0,16,17,32,33,34,37,38,51,78,80,91,105,
  106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,78,91,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
83,0,38,
83,0,38,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,63,62,0,38,78,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,155,156,
  159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,78,91,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
63,48,0,
83,70,64,63,62,57,45,44,36,35,31,30,29,28,27,26,25,24,23,0,16,17,32,33,34,
  37,61,76,77,81,
63,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,78,91,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,41,0,38,50,
  78,79,105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,
  159,
43,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,78,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,78,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
14,0,
14,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,14,0,38,78,
  91,92,105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,
  159,
98,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,78,91,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,78,91,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,78,91,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,104,103,102,101,100,
  99,98,97,95,90,89,83,70,62,41,14,0,2,9,38,78,84,85,86,87,88,91,92,105,
  106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
55,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,104,103,102,101,100,
  99,98,97,95,90,89,83,70,62,41,14,0,2,9,38,78,84,85,86,87,88,91,92,105,
  106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,56,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
83,0,38,59,
83,70,62,57,55,45,44,36,35,31,30,29,28,27,26,25,24,23,0,8,16,17,32,33,34,37,
  38,52,53,54,60,61,
83,57,45,44,43,36,35,31,30,29,28,27,26,25,24,23,0,16,17,32,33,34,37,46,51,
66,0,
83,63,57,45,44,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,0,11,15,16,
  17,32,33,34,37,67,73,75,82,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,66,62,0,38,56,
  65,105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
63,0,
63,0,
64,62,0,
63,0,
48,0,
63,0,
66,48,0,
83,70,64,63,62,57,45,44,36,35,31,30,29,28,27,26,25,24,23,22,21,20,19,18,0,
  11,15,16,17,32,33,34,37,61,67,73,75,76,81,82,
64,62,0,81,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,106,
  144,147,150,154,159,
146,145,70,0,
146,145,70,0,
143,142,0,
143,142,0,
140,139,0,
140,139,0,
140,139,0,
140,139,0,
137,136,135,134,0,
137,136,135,134,0,
132,131,0,
129,0,
127,0,
125,0,
123,0,
55,48,0,
48,43,0,
14,0,
62,0,
63,48,0,
63,48,0,
63,48,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,104,103,102,101,100,
  99,98,97,95,90,89,83,70,62,41,14,0,2,9,38,78,84,85,86,87,88,91,92,105,
  106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
55,0,
55,48,14,0,
48,14,0,
63,0,
66,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,78,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,105,
  106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,43,41,0,38,
  50,78,105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,
  159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,14,0,38,78,
  91,92,105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,
  159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,78,91,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,104,103,102,101,100,
  99,98,97,95,90,89,83,70,62,41,14,0,2,9,38,78,84,85,86,87,88,91,92,105,
  106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,104,103,102,101,100,
  99,98,97,95,90,89,83,70,62,41,14,0,2,9,38,78,84,85,86,87,88,91,92,105,
  106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,104,103,102,101,100,
  99,98,97,95,90,89,83,70,62,41,14,0,2,9,38,78,84,85,86,87,88,91,92,105,
  106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,62,0,38,56,
  105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
83,70,62,55,0,8,38,53,54,60,61,
14,0,
63,48,0,
96,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,83,70,63,62,0,38,78,
  91,92,105,106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,
  159,
14,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,104,103,102,101,100,
  99,98,97,95,90,89,83,70,62,41,14,0,2,9,38,78,84,85,86,87,88,91,92,105,
  106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,159,
63,0,
165,164,163,162,161,160,153,152,151,149,148,143,142,129,104,103,102,101,100,
  99,98,97,95,90,89,83,70,62,41,14,0,2,9,38,78,84,85,86,87,88,91,92,105,
  106,118,120,122,124,126,128,130,133,138,141,144,147,150,154,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1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,11
};


static const unsigned char ag_pstt[] = {
113,3,4,1,2,2,17,17,16,16,16,16,16,16,16,16,16,25,24,23,22,21,0,0,9,9,9,9,8,
  7,7,16,17,16,16,16,2,72,6,5,
113,11,1,10,11,
113,40,2,12,13,
81,15,81,81,81,81,14,14,3,14,14,15,
113,3,4,4,16,72,6,5,
113,4,5,72,17,
19,18,70,
113,3,4,1,2,2,20,20,19,19,19,19,19,19,19,19,19,25,24,23,22,21,21,7,22,20,21,
  18,19,20,19,19,19,2,72,20,6,5,
113,1,2,2,25,17,17,16,16,16,16,16,16,16,16,16,25,24,23,22,21,8,24,6,24,23,
  23,16,17,16,16,16,2,
113,3,4,1,2,2,17,17,16,16,16,16,16,16,16,16,16,25,24,23,22,21,1,9,3,3,3,8,7,
  7,16,17,16,16,16,2,72,6,5,
65,65,65,65,65,65,65,65,65,65,41,65,65,65,65,65,65,65,65,65,65,65,65,65,65,
  65,65,65,10,
26,11,
44,44,44,44,44,44,44,44,44,44,41,44,44,44,44,44,44,44,44,44,44,44,44,44,44,
  44,44,44,12,
42,13,27,
86,86,82,86,
3,83,84,
73,16,
19,18,71,
113,29,1,2,2,17,17,16,16,16,16,16,16,16,16,16,25,24,23,22,21,18,30,30,16,17,
  16,16,16,2,28,32,28,29,31,31,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,49,38,19,37,49,49,49,39,48,
  47,46,45,44,43,42,41,40,39,39,37,34,37,37,
50,11,
12,21,
113,1,51,2,2,25,17,17,16,16,16,16,16,16,16,16,16,25,24,23,22,21,51,52,8,52,
  23,23,16,17,16,16,16,2,
113,3,4,1,2,2,20,20,19,19,19,19,19,19,19,19,19,25,24,23,22,21,21,23,53,20,
  21,18,19,20,19,19,19,2,72,20,6,5,
113,1,2,2,25,17,17,16,16,16,16,16,16,16,16,16,25,24,23,22,21,24,14,7,23,23,
  16,17,16,16,16,2,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,57,58,59,60,61,62,63,64,65,67,68,
  113,34,123,38,1,2,2,71,25,17,17,16,16,16,16,16,16,16,16,16,25,24,23,22,
  21,66,25,70,54,70,54,23,23,16,17,16,16,16,2,69,56,70,70,70,70,70,56,66,
  70,71,56,55,48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
113,26,72,73,73,
74,27,
75,79,
80,29,
113,3,76,92,78,1,92,2,2,20,20,19,19,19,19,19,19,19,19,19,25,24,23,22,21,30,
  91,18,19,20,19,19,19,2,72,6,79,94,94,77,
80,87,
77,32,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,81,33,37,194,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,34,37,193,193,37,34,37,
  37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,82,35,37,192,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,82,36,37,191,37,34,37,37,
83,84,210,209,86,85,190,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,1,2,2,88,88,88,88,88,88,
  88,88,88,88,88,38,88,88,88,88,88,2,37,88,87,89,87,87,55,48,47,46,45,44,
  43,42,41,40,39,39,37,34,37,37,
90,91,92,181,
93,94,178,
95,96,173,
97,98,99,100,170,
101,102,168,
103,166,
104,164,
105,162,
106,160,
107,108,157,
76,49,
113,3,4,50,53,72,50,6,5,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,109,51,37,52,52,52,55,
  48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
113,1,2,2,25,17,17,16,16,16,16,16,16,16,16,16,25,24,23,22,21,52,14,9,23,23,
  16,17,16,16,16,2,
51,51,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,57,58,59,60,61,62,63,64,65,67,68,
  113,34,123,38,1,2,2,110,25,17,17,16,16,16,16,16,16,16,16,16,25,24,23,22,
  21,66,54,70,14,70,23,23,16,17,16,16,16,2,69,56,70,70,70,70,70,56,66,70,
  110,56,55,48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
111,111,111,111,111,111,111,111,111,111,111,188,111,
112,124,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,113,57,37,56,56,113,56,
  55,48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
140,58,
139,59,
113,60,114,
115,61,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,57,58,59,60,61,62,63,64,65,67,68,
  113,34,38,25,66,62,116,116,69,56,116,116,116,116,116,56,66,56,55,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
117,63,
118,64,
119,65,
125,66,
120,67,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,68,37,121,121,39,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
122,211,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,57,58,59,60,61,62,63,64,65,67,68,
  113,34,123,38,127,25,66,70,131,131,69,56,131,131,131,131,131,56,66,56,
  55,48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
128,71,
123,68,
124,64,73,
113,1,2,2,125,125,125,125,125,125,125,125,125,125,125,74,125,125,125,125,
  125,2,126,126,125,
113,75,96,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,127,38,76,37,127,127,127,
  39,48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
129,128,104,
113,3,76,130,78,1,2,2,17,17,16,16,16,16,16,16,16,16,16,25,24,23,22,21,78,16,
  30,30,16,17,16,16,16,2,72,6,79,130,31,31,131,77,130,
113,76,78,103,72,17,132,
113,88,1,2,2,17,17,16,16,16,16,16,16,16,16,16,25,24,23,22,21,80,30,30,16,17,
  16,16,16,2,90,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,1,2,2,88,88,88,88,88,88,
  88,88,88,88,88,81,88,88,88,88,88,2,37,88,87,133,87,87,55,48,47,46,45,44,
  43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,82,37,87,87,87,55,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
113,83,208,
113,84,207,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,135,38,85,37,134,134,55,48,
  47,46,45,44,43,42,41,40,39,39,37,34,37,134,135,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,86,37,136,136,136,55,48,
  47,46,45,44,43,42,41,40,39,39,37,34,37,37,
214,112,87,
113,3,76,92,137,1,2,2,57,57,56,56,56,56,56,56,56,56,56,88,56,57,56,56,56,2,
  138,102,102,77,
139,89,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,90,37,187,187,37,34,37,
  37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,91,37,186,186,37,34,37,
  37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,92,37,185,185,37,34,37,
  37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,93,37,140,140,140,37,34,
  37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,94,37,141,141,141,37,34,
  37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,95,37,39,142,39,39,37,
  34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,96,37,39,143,39,39,37,
  34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,97,37,39,144,40,39,39,
  37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,98,37,39,145,40,39,39,
  37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,99,37,39,146,40,39,39,
  37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,100,37,39,147,40,39,39,
  37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,101,37,39,148,41,40,39,
  39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,102,37,39,149,41,40,39,
  39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,103,37,39,150,42,41,40,
  39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,104,37,39,151,43,42,41,
  40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,105,37,39,152,44,43,42,
  41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,106,37,39,153,45,44,43,
  42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,107,37,39,154,46,45,44,
  43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,108,37,155,155,155,55,
  48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,109,109,37,156,156,156,
  156,55,48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
129,110,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,111,37,145,145,55,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,112,37,143,143,55,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
141,113,
138,114,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,157,115,37,56,56,157,56,
  55,48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
158,116,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,117,37,159,159,159,55,
  48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,118,37,160,160,160,55,
  48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,119,37,161,161,161,55,
  48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,57,58,59,60,61,62,63,64,65,67,68,
  113,34,38,25,66,120,122,122,69,56,122,122,122,122,122,56,66,56,55,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
162,121,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,57,58,59,60,61,62,63,64,65,67,68,
  113,34,38,25,66,122,120,120,69,56,120,120,120,120,120,56,66,56,55,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,123,37,69,69,39,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
113,124,72,67,
113,3,4,1,163,2,2,57,57,56,56,56,56,56,56,56,56,56,125,164,56,57,56,56,56,2,
  72,165,165,163,6,5,
113,1,2,2,43,125,125,125,125,125,125,125,125,125,125,125,126,125,125,125,
  125,125,2,48,125,
107,127,
113,166,1,2,2,17,17,16,16,16,16,16,16,16,16,16,25,24,23,22,21,128,30,30,16,
  17,16,16,16,2,166,31,31,166,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,167,38,129,37,167,167,167,
  39,48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
111,130,
106,131,
129,128,105,
195,133,
168,205,
206,135,
203,112,136,
113,3,76,130,137,1,2,2,17,17,16,16,16,16,16,16,16,16,16,25,24,23,22,21,137,
  30,30,16,17,16,16,16,2,138,130,31,31,131,77,130,
76,137,103,132,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,139,37,189,189,37,34,37,
  37,
90,91,92,183,
90,91,92,182,
93,94,180,
93,94,179,
95,96,177,
95,96,176,
95,96,175,
95,96,174,
97,98,99,100,172,
97,98,99,100,171,
101,102,169,
103,167,
104,165,
105,163,
106,161,
169,112,155,
170,98,156,
171,157,
172,158,
173,112,159,
174,112,160,
175,112,161,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,57,58,59,60,61,62,63,64,65,67,68,
  113,34,38,25,66,162,121,121,69,56,121,121,121,121,121,56,66,56,55,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
176,163,
62,60,60,164,
177,53,165,
112,166,
108,167,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,168,37,216,216,55,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,169,37,158,39,48,47,46,
  45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,99,109,170,37,101,101,
  101,55,48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,178,171,37,56,56,178,56,
  55,48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,172,37,179,179,179,55,
  48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,57,58,59,60,61,62,63,64,65,67,68,
  113,34,38,25,66,173,135,135,69,56,135,135,135,135,135,56,66,56,55,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,57,58,59,60,61,62,63,64,65,67,68,
  113,34,38,25,66,174,134,134,69,56,134,134,134,134,134,56,66,56,55,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,57,58,59,60,61,62,63,64,65,67,68,
  113,34,38,25,66,175,180,180,69,56,180,180,180,180,180,56,66,56,55,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,38,176,37,63,63,39,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
113,3,4,163,177,164,72,59,163,6,5,
181,178,
182,112,179,
183,132,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,113,34,184,38,181,37,56,56,184,56,
  55,48,47,46,45,44,43,42,41,40,39,39,37,34,37,37,
136,182,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,57,58,59,60,61,62,63,64,65,67,68,
  113,34,38,25,66,183,133,133,69,56,133,133,133,133,133,56,66,56,55,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
185,184,
37,37,37,37,37,37,34,34,33,35,36,34,34,34,57,58,59,60,61,62,63,64,65,67,68,
  113,34,38,25,66,185,137,137,69,56,137,137,137,137,137,56,66,56,55,48,47,
  46,45,44,43,42,41,40,39,39,37,34,37,37,
  0
};


static const unsigned short ag_sbt[] = {
     0,  40,  45,  50,  62,  70,  75,  78, 116, 149, 188, 217, 219, 248,
   251, 255, 258, 260, 263, 299, 338, 340, 342, 376, 414, 446, 538, 543,
   545, 547, 549, 589, 591, 593, 617, 642, 666, 690, 697, 757, 761, 764,
   767, 772, 775, 777, 779, 781, 783, 786, 788, 797, 836, 868, 870, 961,
   974, 976,1016,1018,1020,1023,1025,1084,1086,1088,1090,1092,1094,1131,
  1133,1194,1196,1198,1201,1226,1229,1268,1271,1314,1321,1352,1412,1450,
  1453,1456,1496,1534,1537,1567,1569,1594,1619,1644,1670,1696,1723,1750,
  1778,1806,1834,1862,1891,1920,1950,1981,2013,2046,2080,2118,2158,2160,
  2197,2234,2236,2238,2278,2280,2318,2356,2394,2453,2455,2514,2551,2555,
  2587,2612,2614,2648,2687,2689,2691,2694,2696,2698,2700,2703,2743,2747,
  2772,2776,2780,2783,2786,2789,2792,2795,2798,2803,2808,2811,2813,2815,
  2817,2819,2822,2825,2827,2829,2832,2835,2838,2897,2899,2903,2906,2908,
  2910,2947,2983,3023,3063,3101,3160,3219,3278,3315,3326,3328,3331,3333,
  3373,3375,3434,3436,3495
};


static const unsigned short ag_sbe[] = {
    22,  42,  47,  58,  65,  72,  77, 101, 137, 172, 216, 218, 247, 249,
   253, 256, 259, 262, 284, 317, 339, 341, 364, 399, 435, 497, 539, 544,
   546, 548, 574, 590, 592, 610, 634, 659, 683, 696, 728, 760, 763, 766,
   771, 774, 776, 778, 780, 782, 785, 787, 791, 815, 857, 869, 921, 972,
   975, 994,1017,1019,1021,1024,1055,1085,1087,1089,1091,1093,1111,1132,
  1165,1195,1197,1200,1216,1227,1247,1270,1295,1317,1342,1383,1429,1451,
  1454,1474,1513,1536,1556,1568,1586,1611,1636,1661,1687,1713,1740,1767,
  1795,1823,1851,1879,1908,1937,1967,1998,2030,2063,2097,2136,2159,2177,
  2214,2235,2237,2256,2279,2297,2335,2373,2424,2454,2485,2531,2552,2573,
  2603,2613,2635,2666,2688,2690,2693,2695,2697,2699,2702,2727,2745,2764,
  2775,2779,2782,2785,2788,2791,2794,2797,2802,2807,2810,2812,2814,2816,
  2818,2821,2824,2826,2828,2831,2834,2837,2868,2898,2902,2905,2907,2909,
  2927,2964,3002,3041,3080,3131,3190,3249,3295,3319,3327,3330,3332,3351,
  3374,3405,3435,3466,3495
};


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

static const unsigned char ag_ptt[] = {
    0,  1,  3,  3,  5,  5,  6,  6,  6,  6, 13, 13,  7, 10, 10, 11, 11, 11,
   11, 11, 11, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
   16, 16, 17, 17, 39, 39, 40, 32, 32, 37, 37, 42, 42, 12, 12, 47, 47, 46,
   51, 51, 51, 51, 52, 52, 53, 54, 54, 53, 33, 33, 58, 58, 59, 59,  8,  8,
   60, 60, 65, 65, 60, 60, 69, 69, 60, 72, 72, 61, 61, 71, 71, 67, 67, 73,
   73, 75, 77, 77, 75, 68, 68, 50, 50, 50, 79, 79, 80, 76, 76, 76, 81, 81,
   81, 82, 82, 81, 81, 38,  2,  2,  2,  2,  2,  2, 84, 84, 84, 92, 92, 85,
   94, 94,  9,  9, 93, 93, 86, 86, 86, 87, 87, 87, 88, 88, 88, 88, 91, 91,
   78, 78,107,107,107,107,107,107,107,107,107,107,107,105,105, 56,118,118,
  120,120,122,122,124,124,126,126,128,128,128,130,130,130,130,130,133,133,
  133,138,138,138,141,141,141,141,144,144,106,106,106,106,106,106,150,150,
  150,150,150,150,147,147,156,156,147,147,147,147,147,154,154,154,154,155,
  155,159,159,159,159,159
};

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 cc_change_reduction(cc_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((cc_token_type) *ag_tp)) ag_tp++;
  (PCB).reduction_token = (cc_token_type) *ag_tp;
}



static void ag_ra(void)
{
  switch(ag_rpx[(PCB).ag_ap]) {
    case 1: ag_rp_1(V(0,(int *))); break;
    case 2: V(0,(int *)) = ag_rp_2(); break;
    case 3: V(0,(int *)) = ag_rp_3(); break;
    case 4: V(0,(int *)) = ag_rp_4(V(0,(int *)), V(1,(int *))); break;
    case 5: V(0,(int *)) = ag_rp_5(); break;
    case 6: V(0,(int *)) = ag_rp_6(); break;
    case 7: V(0,(int *)) = ag_rp_7(); break;
    case 8: V(0,(int *)) = ag_rp_8(); break;
    case 9: V(0,(int *)) = ag_rp_9(); break;
    case 10: ag_rp_10(); break;
    case 11: ag_rp_11(); break;
    case 12: ag_rp_12(V(0,(token *))); break;
    case 13: ag_default(&ag_rtt[0]); V(0,(token *)) = ag_rp_13(V(0,(token *))); break;
  }
}

#define TOKEN_NAMES cc_token_names
const char *const cc_token_names[166] = {
  "program",
  "program",
  "statement",
  "translation unit",
  "eof",
  "external declaration",
  "function definition",
  "declaration",
  "declarator",
  "compound statement",
  "declaration list",
  "declaration specifiers",
  "init declarator list",
  "",
  "';'",
  "storage class specifier",
  "type specifier",
  "type qualifier",
  "AUTO",
  "REGISTER",
  "STATIC",
  "EXTERN",
  "TYPEDEF",
  "VOIDkey",
  "CHAR",
  "SHORT",
  "INT",
  "LONG",
  "FLOAT",
  "DOUBLE",
  "SIGNED",
  "UNSIGNED",
  "struct or union specifier",
  "enum specifier",
  "typedef name",
  "CONSTANT",
  "VOLATILE",
  "struct or union",
  "identifier",
  "",
  "",
  "'{'",
  "struct declaration list",
  "'}'",
  "STRUCT",
  "UNION",
  "struct declaration",
  "init declarator",
  "','",
  "'='",
  "initializer",
  "specifier qualifier list",
  "struct declarator list",
  "struct declarator",
  "",
  "':'",
  "constant expression",
  "ENUM",
  "enumerator list",
  "enumerator",
  "direct declarator",
  "pointer",
  "'('",
  "')'",
  "'['",
  "",
  "']'",
  "parameter type list",
  "identifier list",
  "",
  "'*'",
  "type qualifier list",
  "",
  "parameter list",
  "ELLIPSIS",
  "parameter declaration",
  "abstract declarator",
  "",
  "assignment expression",
  "initializer list",
  "type name",
  "direct abstract declarator",
  "",
  "NAME",
  "labeled statement",
  "expression statement",
  "selection statement",
  "iteration statement",
  "jump statement",
  "CASE",
  "DEFAULT",
  "expression",
  "",
  "statement list",
  "",
  "IF",
  "ELSE",
  "SWITCH",
  "WHILE",
  "DO",
  "FOR",
  "GOTO",
  "CONTINUE",
  "BREAK",
  "RETURN",
  "conditional expression",
  "unary expression",
  "assignment operator",
  "MULTassign",
  "DIVassign",
  "MODassign",
  "PLUSassign",
  "MINUSassign",
  "LSassign",
  "RSassign",
  "ANDassign",
  "ORassign",
  "ERassign",
  "logical or expression",
  "'\\?'",
  "logical and expression",
  "OROR",
  "inclusive or expression",
  "ANDAND",
  "exclusive or expression",
  "'|'",
  "and expression",
  "'^'",
  "equality expression",
  "'&'",
  "relational expression",
  "EQ",
  "NE",
  "shift expression",
  "'<'",
  "'>'",
  "LE",
  "GE",
  "additive expression",
  "LS",
  "RS",
  "multiplicative expression",
  "'+'",
  "'-'",
  "cast expression",
  "'/'",
  "'%'",
  "postfix expression",
  "ICR",
  "DECR",
  "unary operator",
  "SIZEOF",
  "'~'",
  "'!'",
  "primary expression",
  "argument expression list",
  "",
  "'.'",
  "ARROW",
  "constant",
  "STRINGliteral",
  "HEXconstant",
  "OCTconstant",
  "DECconstant",
  "FLOATconstant",
  "CHARACTERconstant",

};

#ifndef MISSING_FORMAT
#define MISSING_FORMAT "Missing %s"
#endif
#ifndef UNEXPECTED_FORMAT
#define UNEXPECTED_FORMAT "Unexpected %s"
#endif
#ifndef UNNAMED_TOKEN
#define UNNAMED_TOKEN "input"
#endif


static void ag_diagnose(void) {
  int ag_snd = (PCB).sn;
  int ag_k = ag_sbt[ag_snd];

  if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) {
    sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]);
  }
  else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8
          && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1
          && *TOKEN_NAMES[ag_tstt[ag_k]]) {
    sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]);
  }
  else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) {
    sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]);
  }
  else if (isprint(((PCB).input_code)) && ((PCB).input_code) != '\\') {
    char buf[20];
    sprintf(buf, "\'%c\'", (char) ((PCB).input_code));
    sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf);
  }
  else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN);
  (PCB).error_message = (PCB).ag_msg;


}
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_10_proc(void) {
  (PCB).btsx = 0, (PCB).drt = -1;
  ag_track();
  return 0;
}

static int ag_action_11_proc(void) {
  (PCB).btsx = 0, (PCB).drt = -1;
  (*(token *) &(PCB).vs[(PCB).ssx]) = (PCB).input_value;
  (PCB).ssx--;
  ag_ra();
  (PCB).ssx++;
  ag_track();
  return 0;
}

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 = (cc_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 = (cc_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 = (cc_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) {
    ag_trace_error();
    (PCB).exit_flag = AG_STACK_ERROR_CODE;
    PARSER_STACK_OVERFLOW;
  }
  (*(token *) &(PCB).vs[(PCB).ssx]) = (PCB).input_value;
  (PCB).ss[(PCB).ssx] = (PCB).sn;
  (PCB).ssx++;
  (PCB).sn = (PCB).ag_ap;
  ag_track();
  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).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) {
  (PCB).exit_flag = AG_SUCCESS_CODE;
  ag_track();
  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 = (cc_token_type) ag_ptt[(PCB).ag_ap];
  (PCB).btsx = 0, (PCB).drt = -1;
  (*(token *) &(PCB).vs[(PCB).ssx]) = (PCB).input_value;
  if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
  else (PCB).ss[(PCB).ssx] = (PCB).sn;
  ag_track();
  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; ag_trace_error();
      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;
  (*(token *) &(PCB).vs[(PCB).ssx]) = (PCB).input_value;
  if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
  else (PCB).ss[(PCB).ssx] = (PCB).sn;
  ag_track();
  (PCB).reduction_token = (cc_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; ag_trace_error();
      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) {
  ag_undo();
  ag_trace_error();
  (PCB).exit_flag = AG_SYNTAX_ERROR_CODE;
  ag_diagnose();
  SYNTAX_ERROR;
  ag_track();
  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 = (cc_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; ag_trace_error();
      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 = (cc_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; ag_trace_error();
      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;
}


void init_cc(void) {
  unsigned ag_t1;
  ag_t1 = 0;
  (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0;
  (PCB).exit_flag = AG_RUNNING_CODE;
  (PCB).line = FIRST_LINE;
  (PCB).column = FIRST_COLUMN;
  (PCB).btsx = 0, (PCB).drt = -1;
  while (ag_tstt[ag_t1] == 0) {
    (PCB).ag_ap = ag_pstt[ag_t1];
    (ag_gt_procs_scan[ag_astt[ag_t1]])();
    ag_t1 = ag_sbt[(PCB).sn];
  }
}

void cc(void) {
  (PCB).token_number = (cc_token_type) AG_TCV((PCB).input_code);
  while (1) {
    unsigned ag_t1 = ag_sbt[(PCB).sn];
    unsigned ag_t2 = ag_sbe[(PCB).sn] - 1;
    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];
    if ((ag_gt_procs_scan[ag_astt[ag_t1]])() == 0) break;
  }
}