/*
   dci.syn -- Direct Compilation of Bytecode
 Copyright (c) 2002 Parsifal Software. All Rights Reserved.

 Modified to support structures and instances.

 The grammar contained in this file describes the same language as the
 grammar in pll.syn. The differences can be categorized as follows:
   . Rules rewritten to make computation easier. In pll.syn all of the
     arithmetic operators have been factored out. Here the arithmetic
     operators have been substituted back into the rules for expressions to
     make computation more straightforward.
   . Rules rewritten to handle looping. The rules for loop constructs have
     been rewritten to handle repetitive parsing of loops.
   . Semantically determined rules (true, false) added to support parse time
     implementation of loops and if-else statements.

 The actual parser modules, dci.h and dci.cpp are created from
 dci.syn by the AnaGram parser generator using the Build Parser command.

 To build a demonstration program for this parser, compile and link as a
 single project:
   demo.cpp                // Demo program
   comdefs.cpp             // Common script definitions
   bcidefs.cpp             // Bytecode interpreter definitions
   dci.cpp                 // Direct execution parser
   agclib1.lib             // Supporting class library
 Include files describing the class library are in agclib1\include

 This grammar describes a language that is somewhat similar to Pascal.

 The language consists of Pascal like statements and expressions. The
 language also implements Fortran-style exponentiation and simple dump and
 print statements. The syntax below uses "open" and "closed" statements to
 eliminate the traditional "dangling else" or "if-else" ambiguity problem.
 See http://www.parsifalsoft.com/ifelse.html or doc/ifelse.htm for a more
 detailed discussion.

 Statement types supported are:
   assignment statements
   compound statements
   if/else statements
   while statements
   repeat/until statements
   for statements
   dump and print statements

 There are no declarations. Scalar values may be explicitly cast to (long) or
 (double). Both integer and floating point values are stored as doubles.

 Scripts may contain any number of statements. White space may be used
 freely, including both C and C++ style comments.

 For further information about this program or the AnaGram
 parser generator, please contact:
   Parsifal Software
   http://www.parsifalsoft.com
   info@parsifalsoft.com
   +1-800-879-2577, Voice/Fax +1-508-358-2564
   P.O. Box 219
   Wayland, Massachusetts 01778
   USA
*/

#include "comdefs.h"                // Contains definitions of support classes
#include <math.h>
#include <ctype.h>
#include "bcidefs.h"                       // Bytecode interpreter definitions


/*
AnaGram, A System for Syntax Directed Programming
Copyright (c) 1993-2002, Parsifal Software.
All Rights Reserved.

Version 2.01.08a   Feb 26 2002

Serial number 2P17253
Registered to:
  Parsifal Software
  AnaGram 2.01.08a Master
*/

#ifndef DCI_H_1027348744
#include "dci.h"
#endif

#ifndef DCI_H_1027348744
#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])


#ifndef PCB_TYPE
#define PCB_TYPE dci_pcb_type
#endif


#define PCB (*pcb_pointer)
#define PCB_DECL PCB_TYPE *pcb_pointer
#define PCB_POINTER pcb_pointer

CodeFragment dci_value(PCB_DECL);

static void ag_delete_wrappers(PCB_DECL);
#ifndef DELETE_WRAPPERS
#define DELETE_WRAPPERS ag_delete_wrappers(PCB_POINTER)
#endif

/*  Line 478, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
 // Begin embedded C++

// Don't use default error handling.
#define SYNTAX_ERROR PCB.reportError()

// implement context tracking
#define GET_CONTEXT CONTEXT = FileLocation(PCB.pointer, PCB.line, PCB.column)

void dci_pcb_struct::reportError() {
  ag_delete_wrappers(this);
  char buf[100];
  sprintf(buf, "Error(%d,%d): %s", line, column, error_message);
  throw ErrorDiagnostic(buf);
}

void dci_pcb_struct::reportError(const char *msg) {
  ag_delete_wrappers(this);
  char buf[100];
  FileLocation &context = PCONTEXT(*this);
  sprintf(buf, "Error(%d,%d): %s", context.line, context.column, msg);
  throw ErrorDiagnostic(buf);
}

// Constructor for parser control block
// Initializes dictionary, input pointer, and loopDepth

dci_pcb_struct::dci_pcb_struct(AgDictionary<AgString> &d, const char *text)
  : pointer((unsigned char *) text),
    dictionary(d)
{
  // Nothing else to do
}

int dci_pcb_struct::idName(const AgString &name) {
  return dictionary.intern(name);
}

CodeFragment dci_pcb_struct::code(Opcode op, const AgString &name) {
  return CodeFragment().append(op,dictionary.intern(name));
}

CodeFragment dci_pcb_struct::codeMember(const AgString &name) {
  return CodeFragment().append(MEMBER,fieldNames.intern(name));
}

CodeFragment dci_pcb_struct::code(Opcode op, const Constant &x) {
  int n = constants.intern(x);
  return CodeFragment().append(op,n);
}

CodeFragment dci_pcb_struct::codeCall(
    const AgString &name,
    AgStack<CodeFragment> &argStack)
{
  int argCount = argStack.size();
  CodeFragment argCode;
  for (int i = 0; i < argCount; i++) argCode.concat(argStack[i]);
  argCode.append(CALL, idFunction(name, argCount));
  return argCode;
}

CodeFragment dci_pcb_struct::codeStructDecl(
    const AgString &name,
    const AgStack<AgString> &fields,
    const AgStack<AgString> &instances)
{
  int nid = dictionary.intern(name);
  AgDictionary<AgString> fieldDictionary(fields.contents());
  Constant constant(fieldDictionary);
  int sid = constants.intern(constant);

  CodeFragment structDef;
  structDef.append(LOCATE, nid)
           .append(PUSHC, sid)
           .append(SAP);
  for (int i = 0; i < instances.size(); i++) {
    structDef.append(LOCATE, dictionary.intern(instances[i]))
             .append(PUSHC, sid)
             .append(INSTANCE)
             .append(SAP);
  }
  return structDef;
}

CodeFragment dci_pcb_struct::codeStructDecl(
    const AgString &name,
    const AgStack<AgString> &fields)
{
  int nid = dictionary.intern(name);
  AgDictionary<AgString> fieldDictionary(fields.contents());
  Constant constant(fieldDictionary);
  int sid = constants.intern(constant);

  CodeFragment structDef;
  structDef.append(LOCATE, nid)
           .append(PUSHC, sid)
           .append(SAP);
  return structDef;
}

CodeFragment dci_pcb_struct::codeInstanceDecl(
    const AgStack<AgString> &fields,
    const AgStack<AgString> &instances)
{
  AgDictionary<AgString> fieldDictionary(fields.contents());
  Constant constant(fieldDictionary);
  int sid = constants.intern(constant);
  CodeFragment instanceDef;
  for (int i = 0; i < instances.size(); i++) {
    instanceDef.append(LOCATE, dictionary.intern(instances[i]))
               .append(PUSHC, sid)
               .append(INSTANCE)
               .append(SAP);
  }
  return instanceDef;
}

CodeFragment dci_pcb_struct::codeInstanceDecl(
    const AgString &name,
    const AgStack<AgString> &instances)
{
  CodeFragment instanceDef;
  int n = dictionary.intern(name);
  for (int i = 0; i < instances.size(); i++) {
    instanceDef.append(LOCATE, dictionary.intern(instances[i]))
               .append(LOCATE, n)
               .append(FETCH)
               .append(INSTANCE)
               .append(SAP);
  }
  return instanceDef;
}

ScriptMethod::ScriptMethod(const char *text, AgDictionary<AgString> &d)
: dictionary(d),
  bytecode(),
  constantList(),
  fieldNames()
{
  // Create a parser using the dictionary specified by the dataset
  dci_pcb_type pcb(dictionary, text);

  // run the parser
  try {
    dci(&pcb);
  }
  catch(ErrorMessage e) {
    pcb.reportError(e.message());
  }

  //Use dci_value() to retrieve the generated code
  bytecode = dci_value(&pcb).getBytecode();

  constantList = pcb.constants.contents();
  fieldNames = pcb.fieldNames.contents();
}

// Apply script to a dataset
Value interpret(const char *text, Dataset &d) {
  ScriptMethod method(text, d.dictionary);

  // List the generated code
  //method.list(cout);

  // Execute the generated code
  return method.apply(d);
}


#ifndef CONVERT_CASE

static const char agCaseTable[31] = {
  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,    0,
  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
};

static int agConvertCase(int c) {
  if (c >= 'a' && c <= 'z') return c ^= 0x20;
  if (c >= 0xe0 && c < 0xff) c ^= agCaseTable[c-0xe0];
  return c;
}

#define CONVERT_CASE(c) agConvertCase(c)

#endif


#ifndef TAB_SPACING
#define TAB_SPACING 8
#endif
CodeFragment dci_value(PCB_DECL) {
  CodeFragment returnValue;
  returnValue = (*(AgObjectWrapper< CodeFragment > *) &(PCB).vs[(PCB).ssx]);
  return returnValue;
}

static inline CodeFragment ag_rp_1(PCB_DECL, CodeFragment &x) {
/* Line 141, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x.append(HLT);
}

static inline CodeFragment ag_rp_2(PCB_DECL) {
/* Line 145, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return CodeFragment();
}

static inline CodeFragment ag_rp_3(PCB_DECL, CodeFragment &x, CodeFragment &y) {
/* Line 146, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x.concat(y);
}

static inline CodeFragment ag_rp_4(PCB_DECL, CodeFragment &x, CodeFragment &s) {
/* Line 164, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return CodeFragment::ifStatement(x, s);
}

static inline CodeFragment ag_rp_5(PCB_DECL, CodeFragment &x, CodeFragment &s1, CodeFragment &s2) {
/* Line 166, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return CodeFragment::ifElse(x,s1,s2);
}

static inline CodeFragment ag_rp_6(PCB_DECL, CodeFragment &x, CodeFragment &s) {
/* Line 167, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return CodeFragment::whileLoop(x,s);
}

static inline CodeFragment ag_rp_7(PCB_DECL, CodeFragment &lv, CodeFragment &b, CodeFragment &i, CodeFragment &e, CodeFragment &s) {
/* Line 170, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return CodeFragment::simpleForLoop(lv,b,i,e,s);
}

static inline CodeFragment ag_rp_8(PCB_DECL, CodeFragment &x, CodeFragment &s1, CodeFragment &s2) {
/* Line 174, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return CodeFragment::ifElse(x,s1,s2);
}

static inline CodeFragment ag_rp_9(PCB_DECL, CodeFragment &x, CodeFragment &s) {
/* Line 176, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return CodeFragment::whileLoop(x,s);
}

static inline CodeFragment ag_rp_10(PCB_DECL, CodeFragment &lv, CodeFragment &b, CodeFragment &i, CodeFragment &e, CodeFragment &s) {
/* Line 179, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return CodeFragment::simpleForLoop(lv,b,i,e,s);
}

static inline CodeFragment ag_rp_11(PCB_DECL, CodeFragment &x) {
/* Line 180, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x;
}

static inline CodeFragment ag_rp_12(PCB_DECL) {
/* Line 183, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return PCB.code(PUSHC, Value(1));
}

static inline CodeFragment ag_rp_13(PCB_DECL, CodeFragment &x) {
/* Line 184, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x;
}

static inline CodeFragment ag_rp_14(PCB_DECL, CodeFragment &s, CodeFragment &x) {
/* Line 197, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return CodeFragment::repeatLoop(s,x);
}

static inline CodeFragment ag_rp_15(PCB_DECL, CodeFragment &lv, CodeFragment &x) {
/* Line 198, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return lv.concat(x).append(SAP);
}

static inline CodeFragment ag_rp_16(PCB_DECL) {
/* Line 199, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return CodeFragment();
}

static inline CodeFragment ag_rp_17(PCB_DECL) {
/* Line 201, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return CodeFragment().append(HLT);
}

static inline CodeFragment ag_rp_18(PCB_DECL, CodeFragment &x) {
/* Line 202, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x.append(RETURN);
}

static inline CodeFragment ag_rp_19(PCB_DECL, CodeFragment &x) {
/* Line 217, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x;
}

static inline CodeFragment ag_rp_20(PCB_DECL, CodeFragment &s) {
/* Line 220, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return s;
}

static inline CodeFragment ag_rp_21(PCB_DECL, AgString &n) {
/* Line 224, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return PCB.code(DUMP,n);
}

static inline CodeFragment ag_rp_22(PCB_DECL, CodeFragment &code, AgString &n) {
/* Line 225, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return code.append(DUMP, PCB.idName(n));
}

static inline CodeFragment ag_rp_23(PCB_DECL, CodeFragment &code) {
/* Line 229, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return code.append(PRINT);
}

static inline CodeFragment ag_rp_24(PCB_DECL, CodeFragment &code, CodeFragment &x) {
/* Line 230, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return code.concat(x).append(PRINT);
}

static inline CodeFragment ag_rp_25(PCB_DECL, AgString &n, AgStack<AgString> &fl, AgStack<AgString> &il) {
/* Line 234, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return PCB.codeStructDecl(n, fl, il);
}

static inline CodeFragment ag_rp_26(PCB_DECL, AgString &n, AgStack<AgString> &fl) {
/* Line 235, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return PCB.codeStructDecl(n, fl);
}

static inline CodeFragment ag_rp_27(PCB_DECL, AgStack<AgString> &fl, AgStack<AgString> &nl) {
/* Line 237, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return PCB.codeInstanceDecl(fl, nl);
}

static inline CodeFragment ag_rp_28(PCB_DECL, AgString &n, AgStack<AgString> &nl) {
/* Line 238, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return PCB.codeInstanceDecl(n, nl);
}

static inline AgStack<AgString> ag_rp_29(PCB_DECL, AgString &n) {
/* Line 241, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return AgStack<AgString>().push(n);
}

static inline AgStack<AgString> ag_rp_30(PCB_DECL, AgStack<AgString> &stack, AgString &n) {
/* Line 242, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return stack.push(n);
}

static inline CodeFragment ag_rp_31(PCB_DECL, CodeFragment &x, Opcode op, CodeFragment &y) {
/* Line 248, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x.concat(y).append(op);
}

static inline CodeFragment ag_rp_32(PCB_DECL, CodeFragment &x, Opcode op, CodeFragment &y) {
/* Line 252, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x.concat(y).append(op);
}

static inline CodeFragment ag_rp_33(PCB_DECL, CodeFragment &x, Opcode op, CodeFragment &y) {
/* Line 256, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x.concat(y).append(op);
}

static inline CodeFragment ag_rp_34(PCB_DECL, CodeFragment &x) {
/* Line 261, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x;
}

static inline CodeFragment ag_rp_35(PCB_DECL, Opcode op, CodeFragment &x) {
/* Line 262, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x.append(op);
}

static inline CodeFragment ag_rp_36(PCB_DECL, CodeFragment &x, CodeFragment &y) {
/* Line 270, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x.concat(y).append(POW);
}

static inline CodeFragment ag_rp_37(PCB_DECL, CodeFragment &x) {
/* Line 278, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x;
}

static inline CodeFragment ag_rp_38(PCB_DECL, Constant &x) {
/* Line 279, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return PCB.code(PUSHC, x);
}

static inline CodeFragment ag_rp_39(PCB_DECL, CodeFragment &x) {
/* Line 280, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x.append(FETCH);
}

static inline CodeFragment ag_rp_40(PCB_DECL, CodeFragment &x) {
/* Line 282, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x.append(CAST_LONG);
}

static inline CodeFragment ag_rp_41(PCB_DECL, CodeFragment &x) {
/* Line 283, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x.append(CAST_DOUBLE);
}

static inline CodeFragment ag_rp_42(PCB_DECL, AgString &n) {
/* Line 286, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return PCB.code(LOCATE, n);
}

static inline CodeFragment ag_rp_43(PCB_DECL, CodeFragment &lv, AgString &n) {
/* Line 287, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return lv.concat(PCB.codeMember(n));
}

static inline CodeFragment ag_rp_44(PCB_DECL, AgString &n, AgStack<CodeFragment> &args) {
/* Line 290, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return PCB.codeCall(n, args);
}

static inline AgStack<CodeFragment> ag_rp_45(PCB_DECL) {
/* Line 293, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return AgStack<CodeFragment>();
}

static inline AgStack<CodeFragment> ag_rp_46(PCB_DECL, CodeFragment &code) {
/* Line 297, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return AgStack<CodeFragment>().push(code);
}

static inline AgStack<CodeFragment> ag_rp_47(PCB_DECL, AgStack<CodeFragment> &stack, CodeFragment &x) {
/* Line 298, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return stack.push(x);
}

static inline Constant ag_rp_48(PCB_DECL, long x) {
/* Line 301, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return Constant(x);
}

static inline Constant ag_rp_49(PCB_DECL, double x) {
/* Line 302, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return Constant(x);
}

static inline Constant ag_rp_50(PCB_DECL, int x) {
/* Line 304, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return Constant(x);
}

static inline Opcode ag_rp_51(PCB_DECL) {
/* Line 308, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return EQ;
}

static inline Opcode ag_rp_52(PCB_DECL) {
/* Line 309, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return NE;
}

static inline Opcode ag_rp_53(PCB_DECL) {
/* Line 310, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return LT;
}

static inline Opcode ag_rp_54(PCB_DECL) {
/* Line 311, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return LE;
}

static inline Opcode ag_rp_55(PCB_DECL) {
/* Line 312, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return GT;
}

static inline Opcode ag_rp_56(PCB_DECL) {
/* Line 313, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return GE;
}

static inline Opcode ag_rp_57(PCB_DECL) {
/* Line 316, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return ADD;
}

static inline Opcode ag_rp_58(PCB_DECL) {
/* Line 317, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return SUB;
}

static inline Opcode ag_rp_59(PCB_DECL) {
/* Line 318, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return IOR;
}

static inline Opcode ag_rp_60(PCB_DECL) {
/* Line 319, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return XOR;
}

static inline Opcode ag_rp_61(PCB_DECL) {
/* Line 322, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return MUL;
}

static inline Opcode ag_rp_62(PCB_DECL) {
/* Line 323, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return RDIV;
}

static inline Opcode ag_rp_63(PCB_DECL) {
/* Line 324, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return IDIV;
}

static inline Opcode ag_rp_64(PCB_DECL) {
/* Line 325, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return MOD;
}

static inline Opcode ag_rp_65(PCB_DECL) {
/* Line 326, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return AND;
}

static inline Opcode ag_rp_66(PCB_DECL) {
/* Line 327, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return LS;
}

static inline Opcode ag_rp_67(PCB_DECL) {
/* Line 328, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return RS;
}

static inline Opcode ag_rp_68(PCB_DECL) {
/* Line 331, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return NEG;
}

static inline Opcode ag_rp_69(PCB_DECL) {
/* Line 332, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return NOT;
}

static inline AgString ag_rp_70(PCB_DECL, int c) {
/* Line 350, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return AgString().append(tolower(c));
}

static inline AgString ag_rp_71(PCB_DECL, AgString &ns, int c) {
/* Line 351, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return ns.append(tolower(c));
}

static inline double ag_rp_72(PCB_DECL, double x, long e) {
/* Line 357, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x*pow(10,e);
}

static inline double ag_rp_73(PCB_DECL, double x, long e) {
/* Line 358, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x*pow(10,e);
}

static inline double ag_rp_74(PCB_DECL, double i, double f) {
/* Line 361, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return i+f;
}

static inline double ag_rp_75(PCB_DECL, double i) {
/* Line 362, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return i;
}

static inline double ag_rp_76(PCB_DECL, double f) {
/* Line 363, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return f;
}

static inline double ag_rp_77(PCB_DECL, long x) {
/* Line 366, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x;
}

static inline double ag_rp_78(PCB_DECL, long x) {
/* Line 367, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x;
}

static inline double ag_rp_79(PCB_DECL, long x) {
/* Line 368, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return makeDecimal(x);
}

static inline long ag_rp_80(PCB_DECL, long x) {
/* Line 371, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return (long)x;
}

static inline long ag_rp_81(PCB_DECL, long x) {
/* Line 372, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return -(long)x;
}

static inline double ag_rp_82(PCB_DECL, int d) {
/* Line 375, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return (d-'0')/10.0;
}

static inline double ag_rp_83(PCB_DECL, int d, double f) {
/* Line 376, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return (d-'0' + f)/10.0;
}

static inline long ag_rp_84(PCB_DECL, int d) {
/* Line 384, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return d-'0';
}

static inline long ag_rp_85(PCB_DECL, long x, int d) {
/* Line 385, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return 10*x + d-'0';
}

static inline long ag_rp_86(PCB_DECL, int d) {
/* Line 388, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return d-'0';
}

static inline long ag_rp_87(PCB_DECL, long x, int d) {
/* Line 389, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return 10*x + d-'0';
}

static inline long ag_rp_88(PCB_DECL, long x, int d) {
/* Line 392, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return 10*makeDecimal(x) + d - '0';
}

static inline long ag_rp_89(PCB_DECL, long x, int d) {
/* Line 393, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return 10*x + d-'0';
}

static inline long ag_rp_90(PCB_DECL) {
/* Line 396, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return 0;
}

static inline long ag_rp_91(PCB_DECL, long n, int d) {
/* Line 397, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return 8*n + d - '0';
}

static inline long ag_rp_92(PCB_DECL) {
/* Line 400, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return 0;
}

static inline long ag_rp_93(PCB_DECL, long n, int d) {
/* Line 401, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return 16*n + d;
}

static inline int ag_rp_94(PCB_DECL, int x) {
/* Line 404, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return x - '0';
}

static inline int ag_rp_95(PCB_DECL, int d) {
/* Line 405, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return (d & 7) + 9;
}

static inline Constant ag_rp_96(PCB_DECL, Value &s) {
/* Line 410, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return Constant(s);
}

static inline Constant ag_rp_97(PCB_DECL, Constant &s, Value &e) {
/* Line 411, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return Constant(s+=e);
}

static inline Value ag_rp_98(PCB_DECL, AgString &b) {
/* Line 414, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return Value(b);
}

static inline AgString ag_rp_99(PCB_DECL) {
/* Line 418, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return AgString();
}

static inline AgString ag_rp_100(PCB_DECL, AgString &s, int c) {
/* Line 419, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return s.append(c);
}

static inline int ag_rp_101(PCB_DECL) {
/* Line 431, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return '\'';
}

static inline int ag_rp_102(PCB_DECL) {
/* Line 432, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return '"';
}

static inline int ag_rp_103(PCB_DECL) {
/* Line 433, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return '\?';
}

static inline int ag_rp_104(PCB_DECL) {
/* Line 434, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return '\\';
}

static inline int ag_rp_105(PCB_DECL) {
/* Line 435, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return '\a';
}

static inline int ag_rp_106(PCB_DECL) {
/* Line 436, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return '\b';
}

static inline int ag_rp_107(PCB_DECL) {
/* Line 437, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return '\f';
}

static inline int ag_rp_108(PCB_DECL) {
/* Line 438, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return '\n';
}

static inline int ag_rp_109(PCB_DECL) {
/* Line 439, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return '\r';
}

static inline int ag_rp_110(PCB_DECL) {
/* Line 440, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return '\t';
}

static inline int ag_rp_111(PCB_DECL) {
/* Line 441, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return '\v';
}

static inline int ag_rp_112(PCB_DECL, int d) {
/* Line 447, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return d-'0';
}

static inline int ag_rp_113(PCB_DECL, int n, int d) {
/* Line 450, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return 8*n + d-'0';
}

static inline int ag_rp_114(PCB_DECL, int n, int d) {
/* Line 453, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return 8*n + d-'0';
}

static inline int ag_rp_115(PCB_DECL, int d) {
/* Line 456, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return d;
}

static inline int ag_rp_116(PCB_DECL, int n, int d) {
/* Line 457, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return 16*n + d;
}

static inline int ag_rp_117(PCB_DECL, int d) {
/* Line 460, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return d-'0';
}

static inline int ag_rp_118(PCB_DECL, int d) {
/* Line 461, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return 9 + (d & 7);
}

static inline int ag_rp_119(PCB_DECL, int c) {
/* Line 470, W:/agdev/agex/packages/xidek/pll/struct/dci.syn */
  return c;
}


#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 const char ag_wdf[] = {
  0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  6, 6, 6, 0, 6, 0, 0, 0, 0, 6, 0, 0, 4, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0,
  0, 0, 0, 4, 8, 0, 0, 0, 6, 0, 0, 6, 0, 0, 6, 6, 6, 0, 0, 0, 6, 0, 0,
  0, 0, 6, 6, 6, 6, 6, 9, 9, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 7, 7, 0, 0, 0, 6,
  6, 6, 6, 9, 0, 0, 0, 0, 0, 0, 6, 9, 0, 0, 6, 0
};

#undef  VW
#define VW(i,t) *(t) (&(PCB).vs[(PCB).ssx + (i)])
#undef  VNO
#define VNO new(&(PCB).vs[(PCB).ssx])
#undef  VRO
#define VRO(to,v) ag_replace_object((to) &(PCB).vs[(PCB).ssx], v)
#undef  VWD
#define VWD(i,t) ag_delete_object((t) &(PCB).vs[(PCB).ssx + (i)]);
#undef  VDO
#define VDO(to, v) ag_delete_object((to) &(PCB).vs[(PCB).ssx], v)

template <class NewObject, class OldObject>
static inline void ag_replace_object(AgObjectWrapper<OldObject> *p, const NewObject &o) {
  delete p;
  new(p) AgObjectWrapper<NewObject >(o);
}

template <class Object>
static inline void ag_delete_object(AgObjectWrapper<Object> *p) {
  delete p;
}

template <class NewObject, class OldObject>
static inline const NewObject &ag_delete_object(AgObjectWrapper<OldObject> *p, const NewObject &o) {
  delete p;
  return o;
}


#undef AG_WRAP_4
#define AG_WRAP_4 AgObjectWrapper<AgString >
#undef AG_WRAP_5
#define AG_WRAP_5 AgObjectWrapper<Value >
#undef AG_WRAP_6
#define AG_WRAP_6 AgObjectWrapper<CodeFragment >
#undef AG_WRAP_7
#define AG_WRAP_7 AgObjectWrapper<AgStack<CodeFragment> >
#undef AG_WRAP_8
#define AG_WRAP_8 AgObjectWrapper<Constant >
#undef AG_WRAP_9
#define AG_WRAP_9 AgObjectWrapper<AgStack<AgString> >

static void ag_delete_wrappers(PCB_DECL) {
  int sn = (PCB).sn;
  int sx = (PCB).ssx;
  while (sx--) {
    switch (ag_wdf[sn]) {
      case 4: ag_delete_object((AG_WRAP_4 *) &(PCB).vs[sx]); break;
      case 5: ag_delete_object((AG_WRAP_5 *) &(PCB).vs[sx]); break;
      case 6: ag_delete_object((AG_WRAP_6 *) &(PCB).vs[sx]); break;
      case 7: ag_delete_object((AG_WRAP_7 *) &(PCB).vs[sx]); break;
      case 8: ag_delete_object((AG_WRAP_8 *) &(PCB).vs[sx]); break;
      case 9: ag_delete_object((AG_WRAP_9 *) &(PCB).vs[sx]); break;
      default: break;
    }
    sn = (PCB).ss[sx];
  }
}

static dci_vs_type const ag_null_value NULL_VALUE_INITIALIZER;

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

static const unsigned char ag_key_itt[] = {
 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, 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, 0, 0, 0, 0, 0,
 0, 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, 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, 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
};

static const unsigned short ag_key_pt[] = {
  0,153,  0,154,  0,155,  0,157,  0,159,  0,160,  0,161,  0,162,
  0,163,  0,165,  0,164,  0,167,  0,166,  0,169,  0,171,  0,174,
  0,179,  0,180,  0,192,  0,193,  0,196,  0,197,  0,198,  0,199,
  0,200,  0,201,0
};

static const unsigned char ag_key_ch[] = {
    0, 42, 47,255, 80, 84,255, 69,255, 47, 66, 68, 70, 73, 80, 82, 83, 87,
  255, 42,255, 42, 47,255, 61, 62,255, 69, 89,255, 85,255, 73, 79, 85,255,
   76, 78,255, 80, 84,255, 69,255, 76, 82,255, 72, 84,255, 72, 79,255, 42,
   47, 48, 58, 60, 62, 65, 66, 68, 69, 70, 73, 76, 77, 78, 79, 80, 82, 83,
   84, 85, 87, 88,255, 80, 84,255, 69,255, 66, 68, 70, 73, 80, 82, 83, 87,
  255, 42, 47,255, 47,255, 42, 47,255, 47, 48, 78,255, 42, 47,255, 80, 84,
  255, 69,255, 47, 66, 68, 69, 70, 73, 80, 82, 83, 87,255, 42, 47,255, 61,
   62,255, 42, 47, 58, 60, 62,255, 42, 47,255, 80, 84,255, 69,255, 47, 66,
   68, 70, 73, 80, 82, 83, 85, 87,255, 48, 78,255, 80, 84,255, 69,255, 66,
   68, 69, 70, 73, 80, 82, 83, 87,255, 42, 47,255, 76, 78,255, 80, 84,255,
   69,255, 47, 66, 68, 69, 70, 73, 80, 82, 83, 85, 87,255, 58,255, 80, 84,
  255, 69,255, 66, 68, 70, 73, 80, 82, 83, 85, 87,255, 34, 39, 63, 65, 66,
   70, 78, 82, 84, 86, 88, 92,255, 92,255, 42, 47,255, 61, 62,255, 73, 79,
  255, 76, 82,255, 72,255, 72, 79,255, 42, 47, 60, 62, 65, 66, 68, 77, 79,
   83, 84, 88,255, 42, 47,255, 61, 62,255, 76, 82,255, 72,255, 72, 79,255,
   42, 47, 60, 62, 77, 79, 83, 84, 88,255, 61, 62,255, 73, 79,255, 76, 82,
  255, 72,255, 72, 79,255, 42, 60, 62, 65, 66, 68, 77, 79, 83, 84, 88,255,
   42, 47,255, 47, 48, 68, 76, 78,255, 48, 68, 76, 78,255, 61, 62,255, 73,
   79,255, 76, 82,255, 72,255, 72, 79,255, 60, 62, 65, 66, 68, 77, 79, 83,
   84, 88,255, 61, 62,255, 72, 79,255, 60, 62, 66, 68, 79, 84, 88,255, 84,
  255, 68,255, 76, 78,255, 80, 84,255, 69,255, 66, 68, 69, 70, 73, 80, 82,
   83, 85, 87,255, 42, 47,255, 61, 62,255, 73, 79,255, 76, 82,255, 72,255,
   72, 79,255, 42, 47, 48, 60, 62, 65, 66, 68, 77, 79, 83, 84, 88,255, 48,
  255, 72, 79,255, 66, 68, 79, 84, 88,255, 66, 84,255, 84,255
};

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

static const unsigned char ag_key_parm[] = {
    0, 86, 91,  0, 12, 10,  0,  0,  0,  0, 22, 26, 16, 18, 28,  0, 30, 14,
    0, 90,  0, 86, 91,  0,188,186,  0, 22,  6,  0, 34,  0, 40,  2, 26,  0,
    0, 24,  0, 12, 10,  0,  0,  0, 46, 48,  0,  0, 30,  0, 20,  4,  0,176,
    0,115,156,  0,190, 44,  0,  0,  0, 16, 18, 32, 42, 50, 36, 28,  0,  0,
    0,  8, 14, 38,  0, 12, 10,  0,  0,  0, 22, 26, 16, 18, 28,  0, 30, 14,
    0, 86, 91,  0,  0,  0, 86, 91,  0,  0,115, 50,  0, 86, 91,  0, 12, 10,
    0,  0,  0,  0, 22, 26, 24, 16, 18, 28,  0, 30, 14,  0, 86, 91,  0,188,
  186,  0,176,  0,156,  0,190,  0, 86, 91,  0, 12, 10,  0,  0,  0,  0, 22,
   26, 16, 18, 28,  0, 30,  8, 14,  0,115, 50,  0, 12, 10,  0,  0,  0, 22,
   26, 24, 16, 18, 28,  0, 30, 14,  0, 86, 91,  0,  0, 24,  0, 12, 10,  0,
    0,  0,  0, 22, 26,  0, 16, 18, 28,  0, 30,  8, 14,  0,156,  0, 12, 10,
    0,  0,  0, 22, 26, 16, 18, 28,  0, 30,  8, 14,  0,127,126,128,130,131,
  132,133,134,135,136,141,129,  0,  0,  0, 86, 91,  0,188,186,  0, 40,  2,
    0, 46, 48,  0,  0,  0, 20,  4,  0,176,  0,  0,190, 44,  6,  0, 42, 36,
    0,  0, 38,  0, 86, 91,  0,188,186,  0, 46, 48,  0,  0,  0, 20,  4,  0,
  176,  0,  0,190, 42, 36,  0,  0, 38,  0,188,186,  0, 40,  2,  0, 46, 48,
    0,  0,  0, 20,  4,  0,176,  0,190, 44,  6,  0, 42, 36,  0,  0, 38,  0,
   86, 91,  0,  0,115, 34, 32, 50,  0,115, 34, 32, 50,  0,188,186,  0, 40,
    2,  0, 46, 48,  0,  0,  0, 20,  4,  0,  0,190, 44,  6,  0, 42, 36,  0,
    0, 38,  0,188,186,  0, 20,  4,  0,  0,190,  6,  2, 36,  0, 38,  0, 20,
    0,  2,  0,  0, 24,  0, 12, 10,  0,  0,  0, 22, 26,  0, 16, 18, 28,  0,
   30,  8, 14,  0, 86, 91,  0,188,186,  0, 40,  2,  0, 46, 48,  0,  0,  0,
   20,  4,  0,176,  0,115,  0,190, 44,  6,  0, 42, 36,  0,  0, 38,  0,115,
    0, 20,  4,  0,  6,  2, 36,  0, 38,  0,  6,  4,  0,  4,  0
};

static const unsigned short ag_key_jmp[] = {
    0,  0,  0,  0, 19, 23,  0,  4,  0,  1,  0,  5,  9, 12, 14,  7, 27, 33,
    0, 38,  0,  0,  0,  0,  0,  0,  0, 51,  0,  0, 57,  0, 55, 30, 61,  0,
   64, 67,  0, 91, 95,  0, 39,  0,  0,  0,  0, 44, 99,  0,104,  0,  0, 40,
   21, 42, 44, 24, 46, 48, 27, 32, 36, 69, 72, 74, 78, 81, 84, 86, 42, 47,
   50,107,112,117,  0,139,143,  0, 77,  0,120,125,129,132,134, 80,147,153,
    0,  0,  0,  0, 91,  0,  0,  0,  0, 96,158,160,  0,  0,  0,  0,185,189,
    0,106,  0,103,163,168,172,175,178,180,109,193,199,  0,  0,  0,  0,  0,
    0,  0,204,122,206,125,208,  0,  0,  0,  0,229,233,  0,137,  0,134,210,
  215,219,222,224,140,237,243,248,  0,253,255,  0,280,284,  0,156,  0,258,
  263,267,270,273,275,159,288,294,  0,  0,  0,  0,308,311,  0,323,327,  0,
  177,  0,171,299,304,174,313,316,318,180,331,337,342,  0,347,  0,368,372,
    0,196,  0,349,354,358,361,363,199,376,382,387,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0,  0,  0,  0,  0,211,  0,  0,  0,  0,  0,  0,  0,401,  0,
    0,  0,  0,  0,235,  0,408,  0,  0,392,226,229,394,396,399,232,403,406,
  238,240,411,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,262,  0,423,  0,  0,
  414,256,259,416,418,421,265,267,426,  0,  0,  0,  0,438,  0,  0,  0,  0,
    0,286,  0,445,  0,  0,429,280,431,433,436,283,440,443,289,291,448,  0,
    0,  0,  0,306,451,453,459,463,  0,466,468,474,478,  0,  0,  0,  0,488,
    0,  0,  0,  0,  0,326,  0,495,  0,  0,320,481,483,486,323,490,493,329,
  331,498,  0,  0,  0,  0,509,  0,  0,345,501,503,505,507,348,512,  0,515,
    0,519,  0,530,533,  0,545,549,  0,366,  0,521,526,363,535,538,540,369,
  553,559,564,  0,  0,  0,  0,  0,  0,  0,580,  0,  0,  0,  0,  0,391,  0,
  587,  0,  0,569,382,571,385,573,575,578,388,582,585,394,396,590,  0,593,
    0,601,  0,  0,595,597,599,415,604,  0,607,609,  0,611,  0
};

static const unsigned short ag_key_index[] = {
    9,  0, 19, 53, 82,  0,  0, 19, 19, 82, 94, 99, 94,111,128,142,  0,153,
    0, 99,161,182, 94, 99, 99,  0,  0,  0,153,194,201,153,  0,153, 82, 94,
    0,  0,224,  0,  0,224,243,  0,243,270,243,243,243,243,243,294,294,309,
   99, 99,294,315, 99,294,153,153,334,351,161, 99,153,  0,  0, 94,  0, 99,
  153,201,359,194,361,371,  0,  0,  0,224,243,  0,  0,224,224,224,  0,243,
    0,  0,153, 94,  0, 94,  0,  0, 99,153, 99, 99, 99, 99, 99, 99, 99,153,
   99, 99,153, 99, 99, 99, 99, 99, 99,153,182,  0, 99,153,  9,153,  9, 82,
    9, 82,  0, 94,  0,  0,  0,  0,  0,  0,399,413,413,334,418,  0,424,  0,
    0,243,243,153, 99,153,427,  0, 99,153,361, 82
};

static const unsigned char ag_key_ends[] = {
69,71,73,78,0, 85,77,80,0, 79,82,0, 70,0, 82,73,78,84,0, 
69,65,84,0, 85,82,78,0, 84,82,85,67,84,0, 72,73,76,69,0, 47,0, 
42,0, 88,0, 61,0, 61,0, 78,68,0, 71,73,78,0, 86,0, 66,76,69,0, 
77,80,0, 83,69,0, 68,0, 79,82,0, 70,0, 79,78,71,0, 79,68,0, 
79,84,0, 82,0, 82,73,78,84,0, 69,65,84,0, 85,82,78,0, 
82,85,67,84,0, 69,78,0, 78,84,73,76,0, 72,73,76,69,0, 79,82,0, 
69,71,73,78,0, 85,77,80,0, 79,82,0, 70,0, 82,73,78,84,0, 
69,65,84,0, 85,82,78,0, 84,82,85,67,84,0, 72,73,76,69,0, 88,0, 
79,84,0, 69,71,73,78,0, 85,77,80,0, 78,68,0, 79,82,0, 70,0, 
82,73,78,84,0, 69,65,84,0, 85,82,78,0, 84,82,85,67,84,0, 
72,73,76,69,0, 42,0, 61,0, 61,0, 69,71,73,78,0, 85,77,80,0, 
79,82,0, 70,0, 82,73,78,84,0, 69,65,84,0, 85,82,78,0, 
84,82,85,67,84,0, 78,84,73,76,0, 72,73,76,69,0, 88,0, 79,84,0, 
69,71,73,78,0, 85,77,80,0, 78,68,0, 79,82,0, 70,0, 
82,73,78,84,0, 69,65,84,0, 85,82,78,0, 84,82,85,67,84,0, 
72,73,76,69,0, 69,71,73,78,0, 85,77,80,0, 83,69,0, 68,0, 
79,82,0, 70,0, 82,73,78,84,0, 69,65,84,0, 85,82,78,0, 
84,82,85,67,84,0, 78,84,73,76,0, 72,73,76,69,0, 61,0, 
69,71,73,78,0, 85,77,80,0, 79,82,0, 70,0, 82,73,78,84,0, 
69,65,84,0, 85,82,78,0, 84,82,85,67,84,0, 78,84,73,76,0, 
72,73,76,69,0, 42,0, 61,0, 78,68,0, 89,0, 86,0, 79,68,0, 82,0, 
69,78,0, 79,82,0, 42,0, 61,0, 79,68,0, 82,0, 69,78,0, 79,82,0, 
42,0, 61,0, 78,68,0, 89,0, 86,0, 79,68,0, 82,0, 69,78,0, 
79,82,0, 88,0, 79,85,66,76,69,0, 79,78,71,0, 79,84,0, 88,0, 
79,85,66,76,69,0, 79,78,71,0, 79,84,0, 61,0, 78,68,0, 89,0, 
86,0, 79,68,0, 82,0, 69,78,0, 79,82,0, 61,0, 89,0, 79,0, 
82,0, 69,78,0, 79,82,0, 72,69,78,0, 79,0, 69,71,73,78,0, 
85,77,80,0, 83,69,0, 68,0, 79,82,0, 70,0, 82,73,78,84,0, 
69,65,84,0, 85,82,78,0, 84,82,85,67,84,0, 78,84,73,76,0, 
72,73,76,69,0, 42,0, 88,0, 61,0, 78,68,0, 89,0, 86,0, 79,68,0, 
82,0, 69,78,0, 79,82,0, 88,0, 89,0, 79,0, 82,0, 69,78,0, 
79,82,0, 89,0, 79,0, 79,0, 
};

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

static const unsigned char ag_tcv[] = {
    9,147,147,147,147,147,147,147,147,146, 95,146,146,146,147,147,147,147,
  147,147,147,147,147,147,147,147,147,147,147,147,147,147,146,147,118,147,
  147,147,147,143,178,177,194,175,170,191,181,195,113,148,148,148,148,148,
  148,148,112,112,147,158,187,185,189,147,147,149,149,149,149, 99,149,150,
  150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,
  150,147,140,147,147,150,147,149,149,149,149, 99,149,150,150,150,150,150,
  150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,173,147,172,
  147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
  147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
  147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
  147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
  147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
  147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
  147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,
  147,147,147,147
};

#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 INPUT_CODE
#define INPUT_CODE(T) (T)
#endif

typedef enum
  {ag_accept_key, ag_set_key, ag_jmp_key, ag_end_key, ag_no_match_key,
   ag_cf_accept_key, ag_cf_set_key, ag_cf_end_key} key_words;

static void ag_get_key_word(PCB_DECL, int ag_k) {
  int ag_save = (int) ((PCB).la_ptr - (PCB).pointer);
  const  unsigned char *ag_p;
  int ag_ch;
  while (1) {
    switch (ag_key_act[ag_k]) {
    case ag_cf_end_key: {
      const  unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k];
      do {
        if ((ag_ch = *sp++) == 0) {
          int ag_k1 = ag_key_parm[ag_k];
          int ag_k2 = ag_key_pt[ag_k1];
          if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) goto ag_fail;
          (PCB).token_number = (dci_token_type) ag_key_pt[ag_k1 + 1];
          return;
        }
      } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch);
      goto ag_fail;
    }
    case ag_end_key: {
      const  unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k];
      do {
        if ((ag_ch = *sp++) == 0) {
          (PCB).token_number = (dci_token_type) ag_key_parm[ag_k];
          return;
        }
      } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch);
    }
    case ag_no_match_key:
ag_fail:
      (PCB).la_ptr = (PCB).pointer + ag_save;
      return;
    case ag_cf_set_key: {
      int ag_k1 = ag_key_parm[ag_k];
      int ag_k2 = ag_key_pt[ag_k1];
      ag_k = ag_key_jmp[ag_k];
      if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) break;
      ag_save = (int) ((PCB).la_ptr - (PCB).pointer);
      (PCB).token_number = (dci_token_type) ag_key_pt[ag_k1+1];
      break;
    }
    case ag_set_key:
      ag_save = (int) ((PCB).la_ptr - (PCB).pointer);
      (PCB).token_number = (dci_token_type) ag_key_parm[ag_k];
    case ag_jmp_key:
      ag_k = ag_key_jmp[ag_k];
      break;
    case ag_accept_key:
      (PCB).token_number = (dci_token_type) ag_key_parm[ag_k];
      return;
    case ag_cf_accept_key: {
      int ag_k1 = ag_key_parm[ag_k];
      int ag_k2 = ag_key_pt[ag_k1];
      if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)])
        (PCB).la_ptr = (PCB).pointer + ag_save;
      else (PCB).token_number = (dci_token_type) ag_key_pt[ag_k1+1];
      return;
    }
    }
    ag_ch = CONVERT_CASE(*(PCB).la_ptr++);
    ag_p = &ag_key_ch[ag_k];
    if (ag_ch <= 255) while (*ag_p < ag_ch) ag_p++;
    if (ag_ch > 255 || *ag_p != ag_ch) {
      (PCB).la_ptr = (PCB).pointer + ag_save;
      return;
    }
    ag_k = (int) (ag_p - ag_key_ch);
  }
}


#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(PCB_DECL) {
  int ag_k = (int) ((PCB).la_ptr - (PCB).pointer);
  while (ag_k--) {
    switch (*(PCB).pointer++) {
    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++;
    }
  }
}


static void ag_prot(PCB_DECL) {
  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];
  (PCB).cs[ag_k] = (PCB).cs[(PCB).ssx];
}

static void ag_undo(PCB_DECL) {
  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).cs[(PCB).ssx] = (PCB).cs[ag_k];
  }
  (PCB).token_number = (dci_token_type) (PCB).drt;
  (PCB).ssx = (PCB).dssx;
  (PCB).sn = (PCB).dsn;
  (PCB).drt = -1;
}


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

};


static unsigned const char ag_astt[3036] = {
  8,8,8,8,8,8,8,8,8,8,8,8,1,8,1,1,1,8,7,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,8,7,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,8,7,1,1,9,9,1,1,5,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,0,1,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,5,3,7,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,5,3,7,1,1,1,1,1,1,1,1,1,1,2,2,2,2,7,2,2,2,2,1,1,1,1,2,
  1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,1,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,1,
  5,5,5,5,5,5,1,1,1,7,1,1,3,5,5,1,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,5,5,5,5,5,
  1,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,10,10,10,1,10,10,
  10,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,5,5,5,5,5,1,5,1,1,1,7,1,1,3,1,2,2,2,7,1,1,
  1,1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,2,1,1,1,1,1,1,1,1,1,2,1,1,2,2,1,
  1,1,1,1,1,1,1,1,1,1,2,2,2,7,2,1,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,
  1,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,5,1,1,
  1,5,7,1,1,3,5,5,1,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,
  1,3,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,1,7,3,1,1,7,3,1,1,1,7,3,1,
  1,1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,1,1,2,1,1,1,1,1,1,1,1,2,1,1,2,2,
  1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,1,1,1,1,1,
  2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,1,1,1,1,1,1,1,1,1,1,2,1,1,2,2,1,1,1,1,1,1,1,
  1,1,1,1,2,2,2,7,2,1,1,1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,1,1,1,1,1,1,
  1,1,1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,7,2,2,2,
  1,1,1,1,1,2,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,1,5,1,1,1,7,1,1,3,2,2,2,7,
  2,1,1,1,2,2,2,7,2,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,4,4,4,4,4,4,7,1,10,10,10,4,2,1,1,1,7,2,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,7,1,1,1,1,1,1,1,1,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,1,5,1,1,1,7,1,1,3,1,1,7,1,5,2,
  2,2,2,2,5,2,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,5,5,5,5,5,5,5,5,5,10,5,10,2,
  4,5,5,5,7,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,5,5,5,5,5,5,5,5,5,10,5,10,10,4,
  5,5,5,7,2,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,1,1,1,1,7,1,1,
  3,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,1,1,1,1,7,1,1,3,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,1,1,1,1,7,1,1,3,1,4,1,1,5,2,1,
  5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,1,5,5,5,
  5,5,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,1,4,1,1,1,
  1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,2,2,
  1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,1,5,1,1,
  1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,1,2,2,1,1,1,1,2,1,1,2,2,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,1,2,2,1,1,1,1,2,1,1,2,2,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,
  5,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,2,2,2,7,2,2,2,2,1,1,1,1,2,
  1,2,2,1,1,1,1,1,1,1,1,1,2,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,
  1,3,1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,2,1,1,1,1,1,1,1,1,1,2,1,1,2,2,
  1,1,1,1,1,1,1,1,1,1,1,2,2,2,7,2,1,1,7,2,5,5,1,5,1,1,1,7,1,1,3,2,2,2,7,2,1,
  5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,
  2,2,1,2,2,1,1,1,1,1,1,1,1,1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,2,2,2,7,2,2,2,2,1,1,1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,
  2,1,1,7,1,1,1,7,1,1,5,1,1,1,7,1,1,1,4,1,2,2,2,7,2,1,1,10,10,10,10,10,10,10,
  10,10,10,10,10,10,10,10,10,10,10,10,10,1,1,2,2,2,2,2,2,2,2,2,2,2,2,10,10,
  10,7,2,2,2,2,1,1,1,2,1,1,1,4,2,1,2,2,7,2,2,2,2,2,7,2,2,2,5,2,2,5,2,2,2,2,2,
  5,2,2,7,1,1,1,4,2,1,1,1,8,8,8,7,2,1,1,1,8,8,8,7,2,1,1,1,1,1,4,1,2,2,2,1,1,
  2,2,2,2,7,2,2,1,2,2,2,1,1,1,1,1,1,1,1,1,2,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,
  1,5,1,1,1,1,7,1,1,3,1,7,1,5,1,1,1,1,7,1,1,3,1,7,1,1,7,2,5,5,5,5,5,5,5,5,1,
  5,5,5,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,1,2,2,1,
  1,1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,
  7,1,1,3,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,1,5,5,
  5,5,5,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,5,5,5,5,
  5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,
  1,1,3,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,2,2,2,1,1,2,2,
  2,2,7,2,2,1,2,2,1,2,2,1,1,1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,
  5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,
  3,1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,1,1,1,1,1,1,1,1,2,1,1,2,2,1,1,1,
  1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,
  5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,
  5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,
  1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,2,2,2,
  1,1,2,2,2,2,7,2,2,1,2,2,1,1,1,1,1,1,1,1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,
  5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,5,1,1,1,5,7,1,1,3,1,7,2,5,5,5,5,5,5,5,5,1,
  5,5,5,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,1,1,1,1,
  1,1,1,1,1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,5,5,5,5,1,5,1,
  1,1,7,1,1,3,1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,1,1,1,1,1,1,1,1,1,1,2,
  1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,5,5,5,5,1,5,1,1,1,7,1,1,3,1,
  1,1,1,1,1,1,1,1,1,2,2,2,7,2,2,2,1,1,1,1,2,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,
  5,5,5,5,5,5,5,5,5,5,5,5,1,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,1,1,1,2,2,2,7,2,2,
  2,1,1,1,1,2,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,7,2,1,5,5,5,1,5,1,1,1,7,
  1,1,3,2,2,2,7,2,1,1,1,1,7,1,1,2,2,2,7,1,2,2,2,7,1,1,5,1,1,7,2,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,1,5,5,5,5,5,5,1,1,1,7,1,1,
  3,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,1,2,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,1,2,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,4,1,2,2,2,2,2,2,2,1,1,1,1,4,1,2,2,2,2,1,7,2,1,4,7,1,1,1,4,1,2,2,2,4,2,
  1,1,10,10,10,4,2,10,10,10,4,2,1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,2,1,
  1,1,1,1,1,1,1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,5,
  5,5,1,1,1,7,1,1,3,1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,2,1,1,1,1,1,1,1,
  1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,4,1,5,5,5,5,5,5,5,5,1,5,5,5,5,
  5,5,1,1,1,7,1,1,3,1,1,1,1,1,2,2,2,1,1,2,2,2,2,7,2,2,1,2,2,1,1,1,1,1,1,1,1,
  1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,1,1,1,1,1,1,1,1,1,2,2,2,7,2,2,
  2,1,1,1,1,2,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1
};


static const unsigned short ag_pstt[] = {
4,4,4,4,4,4,4,4,4,4,4,4,3,4,3,1,2,4,0,3,3,4,
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,6,1,5,6,
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,8,2,7,8,
283,283,1,2,285,283,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,0,9,
94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,
  96,
97,6,
89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,
  89,91,
92,8,
10,11,12,13,24,22,23,15,19,21,98,98,98,1,9,57,3,3,3,34,33,32,29,13,30,18,13,
  28,27,26,25,30,33,32,31,20,18,17,16,14,
284,284,284,3,284,3,1,2,10,3,3,307,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,11,3,3,304,
284,284,3,284,3,1,2,12,3,3,302,
284,284,284,284,284,284,284,284,284,284,284,284,284,3,284,3,1,2,13,3,3,300,
284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,
  99,99,99,3,99,99,99,3,1,2,14,3,3,301,
284,284,284,284,284,284,284,284,284,284,284,284,284,3,284,3,1,2,15,3,3,294,
35,98,98,98,16,37,36,14,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,17,64,65,51,130,67,32,56,63,
  62,62,62,61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
98,98,98,18,30,14,
284,284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,19,3,3,
  293,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,20,64,
284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,3,284,3,1,2,284,
  21,3,3,291,
284,284,3,284,3,1,2,22,3,3,296,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,23,3,3,295,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,24,3,3,298,
21,25,24,
65,21,26,23,66,
65,21,27,22,67,
54,55,40,53,58,21,98,98,118,41,38,126,124,118,98,28,64,65,51,130,67,68,56,
  20,63,62,62,62,61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,
  42,
69,71,29,72,70,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,30,73,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,31,64,65,51,130,67,74,56,63,
  62,62,62,61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
98,98,98,32,57,75,14,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,33,64,65,51,130,67,76,56,63,
  62,62,62,61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
10,11,12,13,24,22,23,15,19,21,98,98,98,34,57,6,6,77,34,33,32,29,13,30,18,13,
  28,27,26,25,30,33,32,31,20,18,17,16,14,
284,284,3,284,3,1,2,35,3,3,306,
98,98,98,36,38,78,14,
35,98,98,98,37,38,80,79,14,
133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
  133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,
  38,81,
123,123,123,107,123,
82,82,82,40,105,82,
88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,84,83,150,149,148,
  147,146,145,144,143,142,141,140,88,88,88,88,41,88,88,88,87,86,85,88,88,
284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,
  284,284,284,284,284,284,3,284,3,1,2,42,3,3,335,
89,90,43,
91,100,
129,128,128,128,129,117,127,
116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,108,116,116,
  116,116,116,116,116,116,116,125,116,125,122,108,116,116,116,46,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,106,115,115,
  115,115,115,115,115,115,115,119,115,119,119,106,115,115,115,47,119,
284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,
  284,284,284,284,284,284,3,3,1,2,48,3,3,317,
284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,
  284,284,284,284,284,284,3,3,1,2,49,3,3,316,
284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,
  284,284,284,284,284,284,3,3,1,2,50,3,3,315,
53,57,92,
38,66,131,42,
284,284,284,284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,
  53,3,3,311,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,54,3,3,334,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,55,3,3,324,
69,53,70,
54,55,40,93,95,53,58,98,98,118,41,38,126,124,118,98,57,64,65,51,130,67,97,
  56,63,62,62,62,61,60,59,57,52,59,96,94,52,85,86,44,43,47,39,46,45,14,50,
  49,48,42,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,58,3,3,308,
98,49,99,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,60,64,65,51,130,67,56,48,48,
  61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,61,64,65,51,130,67,56,47,47,
  61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
100,101,102,103,104,105,106,42,107,78,79,80,81,82,83,84,
108,109,55,111,112,113,114,115,116,58,40,117,110,74,68,69,70,71,72,73,75,76,
  77,
10,11,12,13,118,24,22,23,15,19,21,98,98,98,64,57,3,3,3,34,33,32,29,13,30,18,
  13,28,27,26,25,30,33,32,31,20,29,18,17,16,14,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,65,3,3,303,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,66,64,65,51,130,67,33,56,63,
  62,62,62,61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
98,98,98,67,31,14,
21,68,21,
284,284,3,284,3,1,2,69,3,3,314,
98,98,98,70,58,14,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,71,3,3,289,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,72,64,65,51,130,67,119,56,63,
  62,62,62,61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
10,11,12,13,24,22,23,15,19,120,21,98,98,98,73,57,3,3,3,34,33,32,29,13,30,
  121,18,13,28,27,26,25,30,33,32,31,20,18,17,16,14,
122,74,28,
69,71,75,123,70,
124,76,125,
126,5,127,
129,65,78,128,130,
65,37,128,
98,98,98,80,38,131,14,
134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,
  134,84,83,150,149,148,147,146,145,144,143,142,141,140,132,134,134,134,
  81,134,134,134,134,87,86,85,134,
82,82,82,113,114,82,
154,154,83,
160,159,159,159,160,84,157,
156,156,152,
155,155,151,
160,159,159,159,160,139,158,
161,88,
82,82,82,104,103,82,
132,133,133,133,133,90,102,133,
132,133,133,133,133,91,101,133,
54,55,40,53,60,58,98,98,118,41,38,126,124,118,98,92,64,65,51,130,67,62,56,
  63,62,62,62,61,60,59,57,52,59,135,134,52,85,86,44,43,47,39,46,45,14,50,
  49,48,42,
284,3,3,1,2,93,3,3,313,
136,94,137,
284,3,3,1,2,95,3,3,312,
136,96,138,
136,97,51,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,98,3,3,309,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,99,64,65,51,130,67,56,50,50,
  61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,100,3,3,333,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,101,3,3,332,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,102,3,3,331,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,103,3,3,330,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,104,3,3,329,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,105,3,3,328,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,106,3,3,327,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,107,64,65,51,130,67,56,45,45,
  61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,108,3,3,326,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,109,3,3,325,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,110,64,65,51,130,67,56,139,
  139,139,61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,111,3,3,323,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,112,3,3,322,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,113,3,3,321,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,114,3,3,320,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,115,3,3,319,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,116,3,3,318,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,117,64,65,51,130,67,56,140,62,
  62,62,61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,3,284,3,1,2,284,
  118,3,3,299,
21,119,17,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,120,3,3,292,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,121,64,65,51,130,67,141,56,63,
  62,62,62,61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
284,284,284,284,284,284,284,284,284,284,284,284,3,284,3,1,2,122,3,3,297,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,123,64,65,51,130,67,142,56,63,
  62,62,62,61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
284,284,284,284,284,284,284,284,284,284,284,284,3,284,3,1,2,124,3,3,287,
10,11,12,13,24,22,23,15,19,21,98,98,98,125,57,8,11,34,33,32,29,13,30,18,13,
  28,27,26,25,30,33,32,31,20,18,17,16,14,
284,284,284,284,284,284,284,284,284,284,284,284,3,284,3,1,2,126,3,3,286,
10,11,12,13,24,22,23,15,19,21,98,98,98,127,57,7,10,34,33,32,29,13,30,18,13,
  28,27,26,25,30,33,32,31,20,18,17,16,14,
98,98,98,128,39,14,
284,284,284,3,284,3,1,2,129,3,3,305,
98,98,98,130,38,143,14,
129,65,131,128,144,
120,120,120,132,145,
120,120,120,133,146,
65,61,147,
136,135,59,
284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,
  284,284,284,284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,
  1,2,136,3,3,310,
40,53,98,98,118,41,38,126,124,118,98,137,64,65,51,130,67,56,56,57,52,56,52,
  44,43,47,39,46,45,14,50,49,48,42,
40,53,98,98,118,41,38,126,124,118,98,138,64,65,51,130,67,56,55,57,52,55,52,
  44,43,47,39,46,45,14,50,49,48,42,
100,101,102,103,104,105,106,43,107,78,79,80,81,82,83,84,
108,109,55,58,41,110,74,75,76,77,
21,141,16,
148,14,142,150,149,
65,36,128,
98,98,98,35,38,151,14,
121,121,121,112,121,
121,121,121,111,121,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,147,64,65,51,130,67,63,56,63,
  62,62,62,61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,148,3,3,290,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,149,64,65,51,130,67,15,56,63,
  62,62,62,61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
152,150,153,
65,34,128,
284,284,284,284,284,284,284,284,3,284,284,284,284,284,284,3,1,2,152,3,3,288,
54,55,40,53,58,98,98,118,41,38,126,124,118,98,153,64,65,51,130,67,154,56,63,
  62,62,62,61,60,59,57,52,59,52,85,86,44,43,47,39,46,45,14,50,49,48,42,
124,154,155,
10,11,12,13,24,22,23,15,19,21,98,98,98,155,57,9,12,34,33,32,29,13,30,18,13,
  28,27,26,25,30,33,32,31,20,18,17,16,14,

};


static const unsigned short ag_sbt[] = {
     0,  22,  51,  81,  87, 104, 130, 132, 159, 161, 201, 213, 235, 246,
   268, 301, 323, 331, 377, 383, 406, 422, 447, 458, 480, 502, 505, 510,
   515, 563, 568, 584, 630, 637, 683, 722, 733, 740, 749, 788, 793, 799,
   844, 878, 881, 883, 890, 925, 961, 994,1027,1060,1063,1067,1092,1114,
  1136,1139,1189,1211,1214,1257,1300,1316,1339,1380,1402,1448,1454,1457,
  1468,1474,1496,1542,1583,1586,1591,1594,1597,1602,1605,1612,1658,1664,
  1667,1674,1677,1680,1687,1689,1695,1703,1711,1760,1769,1772,1781,1784,
  1787,1809,1852,1874,1896,1918,1940,1962,1984,2006,2049,2071,2093,2137,
  2159,2181,2203,2225,2247,2269,2314,2339,2342,2364,2410,2431,2477,2498,
  2536,2557,2595,2601,2613,2620,2625,2630,2635,2638,2641,2685,2719,2753,
  2769,2779,2782,2787,2790,2797,2802,2807,2853,2875,2921,2924,2927,2949,
  2995,2998,3036
};


static const unsigned short ag_sbe[] = {
    18,  48,  78,  85, 101, 129, 131, 158, 160, 175, 209, 231, 242, 264,
   297, 319, 327, 345, 380, 402, 420, 443, 454, 476, 498, 503, 507, 512,
   530, 565, 582, 598, 633, 651, 696, 729, 736, 744, 786, 791, 796, 835,
   874, 880, 882, 888, 924, 959, 990,1023,1056,1061,1064,1088,1110,1132,
  1137,1155,1207,1212,1228,1271,1307,1326,1353,1398,1416,1451,1455,1464,
  1471,1492,1510,1556,1584,1588,1592,1595,1599,1603,1608,1649,1661,1666,
  1672,1676,1679,1685,1688,1692,1700,1708,1726,1765,1770,1777,1782,1785,
  1805,1823,1870,1892,1914,1936,1958,1980,2002,2020,2067,2089,2107,2155,
  2177,2199,2221,2243,2265,2283,2335,2340,2360,2378,2427,2445,2494,2511,
  2553,2570,2598,2609,2616,2622,2628,2633,2636,2639,2681,2696,2730,2760,
  2773,2780,2784,2788,2793,2800,2805,2821,2871,2889,2922,2925,2945,2963,
  2996,3011,3036
};


static const unsigned char ag_fl[] = {
  2,2,0,2,1,1,2,4,4,9,4,4,9,1,0,2,5,4,1,1,2,3,2,2,2,1,1,1,3,3,2,3,2,3,6,
  5,5,3,1,3,1,3,1,3,1,3,1,2,2,1,3,3,1,1,1,4,4,1,3,4,0,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,2,0,1,3,1,2,0,1,3,1,2,1,3,3,3,2,
  2,1,1,1,0,1,2,2,1,2,1,1,1,1,2,1,2,2,2,1,2,1,2,1,1,1,2,3,0,2,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,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,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,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,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,1,1,1,1,1,1,
  1,1,1,2,0,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,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
};

static const unsigned char ag_ptt[] = {
    0,  7,  8,  8, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 21, 21, 23, 23,
   23, 23, 23, 23, 23, 23, 23, 25, 15, 18, 13, 28, 30, 30, 31, 31, 32, 32,
   32, 32, 45, 45, 16, 16, 47, 47, 49, 49, 51, 51, 51, 53, 53, 56, 56, 56,
   56, 56, 56, 19, 19, 61, 65, 65, 66, 66, 60, 60, 60, 60, 48, 48, 48, 48,
   48, 48, 50, 50, 50, 50, 52, 52, 52, 52, 52, 52, 52, 55, 55,  1, 88, 88,
   89, 89,  1, 93, 93, 94, 94,  1,168,168,183,183,183, 98, 98, 98,101,101,
  101,106,106,100,100,102,102,182,182,182,103,103,107,107,104,104,105,105,
  109,109,116,116, 67, 67,202,119,119,120,120,122,122,122,123,123,123,123,
  123,123,123,123,123,123,123,124,124,124,137,138,139,125,125,142,142,184,
  144,144,108, 85, 85, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
   87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 92, 92, 92, 92, 92,
   92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
   92, 92, 96, 96, 96, 97, 97, 97, 97, 97, 97,110,110,111,111,111,114,114,
  117,117,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,
  121,121,121,121,121,121,121,145,145,145,145,145,145,145,145,145,145,145,
  145,145,145,145,145,145,145,145,145,145,145,145,151,151,152,152, 14, 17,
   22, 20, 24, 27, 26, 29, 33, 34, 35, 37, 36, 39, 38,  4, 40, 41, 42, 46,
   44, 43, 54, 57, 59, 58, 62, 63, 64,  2,  3,  6, 68, 69, 70, 71, 72, 73,
   74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,  5
};


static void ag_ra(PCB_DECL)
{
  switch(ag_rpx[(PCB).ag_ap]) {
    case 1: VRO(AG_WRAP_6 *, ag_rp_1(PCB_POINTER, VW(0, AG_WRAP_6 *))); break;
    case 2: VNO AG_WRAP_6(ag_rp_2(PCB_POINTER)); break;
    case 3: VRO(AG_WRAP_6 *, ag_rp_3(PCB_POINTER, VW(0, AG_WRAP_6 *), VW(1, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); break;
    case 4: VRO(AG_WRAP_6 *, ag_rp_4(PCB_POINTER, VW(0, AG_WRAP_6 *), VW(1, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); break;
    case 5: VRO(AG_WRAP_6 *, ag_rp_5(PCB_POINTER, VW(0, AG_WRAP_6 *), VW(1, AG_WRAP_6 *), VW(3, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); VWD(3, AG_WRAP_6 *); break;
    case 6: VNO AG_WRAP_6(ag_rp_6(PCB_POINTER, VW(1, AG_WRAP_6 *), VW(3, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); VWD(3, AG_WRAP_6 *); break;
    case 7: VNO AG_WRAP_6(ag_rp_7(PCB_POINTER, VW(1, AG_WRAP_6 *), VW(3, AG_WRAP_6 *), VW(4, AG_WRAP_6 *), VW(6, AG_WRAP_6 *), VW(8, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); VWD(3, AG_WRAP_6 *); VWD(4, AG_WRAP_6 *); VWD(6, AG_WRAP_6 *); VWD(8, AG_WRAP_6 *); break;
    case 8: VRO(AG_WRAP_6 *, ag_rp_8(PCB_POINTER, VW(0, AG_WRAP_6 *), VW(1, AG_WRAP_6 *), VW(3, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); VWD(3, AG_WRAP_6 *); break;
    case 9: VNO AG_WRAP_6(ag_rp_9(PCB_POINTER, VW(1, AG_WRAP_6 *), VW(3, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); VWD(3, AG_WRAP_6 *); break;
    case 10: VNO AG_WRAP_6(ag_rp_10(PCB_POINTER, VW(1, AG_WRAP_6 *), VW(3, AG_WRAP_6 *), VW(4, AG_WRAP_6 *), VW(6, AG_WRAP_6 *), VW(8, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); VWD(3, AG_WRAP_6 *); VWD(4, AG_WRAP_6 *); VWD(6, AG_WRAP_6 *); VWD(8, AG_WRAP_6 *); break;
    case 11: VRO(AG_WRAP_6 *, ag_rp_11(PCB_POINTER, VW(0, AG_WRAP_6 *))); break;
    case 12: VNO AG_WRAP_6(ag_rp_12(PCB_POINTER)); break;
    case 13: VNO AG_WRAP_6(ag_rp_13(PCB_POINTER, VW(1, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); break;
    case 14: VNO AG_WRAP_6(ag_rp_14(PCB_POINTER, VW(1, AG_WRAP_6 *), VW(3, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); VWD(3, AG_WRAP_6 *); break;
    case 15: VRO(AG_WRAP_6 *, ag_rp_15(PCB_POINTER, VW(0, AG_WRAP_6 *), VW(2, AG_WRAP_6 *))); 
            VWD(2, AG_WRAP_6 *); break;
    case 16: VNO AG_WRAP_6(ag_rp_16(PCB_POINTER)); break;
    case 17: VNO AG_WRAP_6(ag_rp_17(PCB_POINTER)); break;
    case 18: VNO AG_WRAP_6(ag_rp_18(PCB_POINTER, VW(1, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); break;
    case 19: VNO AG_WRAP_6(ag_rp_19(PCB_POINTER, VW(1, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); break;
    case 20: VNO AG_WRAP_6(ag_rp_20(PCB_POINTER, VW(1, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); break;
    case 21: VNO AG_WRAP_6(ag_rp_21(PCB_POINTER, VW(1, AG_WRAP_4 *))); 
            VWD(1, AG_WRAP_4 *); break;
    case 22: VRO(AG_WRAP_6 *, ag_rp_22(PCB_POINTER, VW(0, AG_WRAP_6 *), VW(2, AG_WRAP_4 *))); 
            VWD(2, AG_WRAP_4 *); break;
    case 23: VNO AG_WRAP_6(ag_rp_23(PCB_POINTER, VW(1, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); break;
    case 24: VRO(AG_WRAP_6 *, ag_rp_24(PCB_POINTER, VW(0, AG_WRAP_6 *), VW(2, AG_WRAP_6 *))); 
            VWD(2, AG_WRAP_6 *); break;
    case 25: VNO AG_WRAP_6(ag_rp_25(PCB_POINTER, VW(1, AG_WRAP_4 *), VW(3, AG_WRAP_9 *), VW(5, AG_WRAP_9 *))); 
            VWD(1, AG_WRAP_4 *); VWD(3, AG_WRAP_9 *); VWD(5, AG_WRAP_9 *); break;
    case 26: VNO AG_WRAP_6(ag_rp_26(PCB_POINTER, VW(1, AG_WRAP_4 *), VW(3, AG_WRAP_9 *))); 
            VWD(1, AG_WRAP_4 *); VWD(3, AG_WRAP_9 *); break;
    case 27: VNO AG_WRAP_6(ag_rp_27(PCB_POINTER, VW(2, AG_WRAP_9 *), VW(4, AG_WRAP_9 *))); 
            VWD(2, AG_WRAP_9 *); VWD(4, AG_WRAP_9 *); break;
    case 28: VNO AG_WRAP_6(ag_rp_28(PCB_POINTER, VW(1, AG_WRAP_4 *), VW(2, AG_WRAP_9 *))); 
            VWD(1, AG_WRAP_4 *); VWD(2, AG_WRAP_9 *); break;
    case 29: VRO(AG_WRAP_4 *, ag_rp_29(PCB_POINTER, VW(0, AG_WRAP_4 *))); break;
    case 30: VRO(AG_WRAP_9 *, ag_rp_30(PCB_POINTER, VW(0, AG_WRAP_9 *), VW(2, AG_WRAP_4 *))); 
            VWD(2, AG_WRAP_4 *); break;
    case 31: VRO(AG_WRAP_6 *, ag_rp_31(PCB_POINTER, VW(0, AG_WRAP_6 *), V(1,(Opcode *)), VW(2, AG_WRAP_6 *))); 
            VWD(2, AG_WRAP_6 *); break;
    case 32: VRO(AG_WRAP_6 *, ag_rp_32(PCB_POINTER, VW(0, AG_WRAP_6 *), V(1,(Opcode *)), VW(2, AG_WRAP_6 *))); 
            VWD(2, AG_WRAP_6 *); break;
    case 33: VRO(AG_WRAP_6 *, ag_rp_33(PCB_POINTER, VW(0, AG_WRAP_6 *), V(1,(Opcode *)), VW(2, AG_WRAP_6 *))); 
            VWD(2, AG_WRAP_6 *); break;
    case 34: VNO AG_WRAP_6(ag_rp_34(PCB_POINTER, VW(1, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); break;
    case 35: VNO AG_WRAP_6(ag_rp_35(PCB_POINTER, V(0,(Opcode *)), VW(1, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); break;
    case 36: VRO(AG_WRAP_6 *, ag_rp_36(PCB_POINTER, VW(0, AG_WRAP_6 *), VW(2, AG_WRAP_6 *))); 
            VWD(2, AG_WRAP_6 *); break;
    case 37: VNO AG_WRAP_6(ag_rp_37(PCB_POINTER, VW(1, AG_WRAP_6 *))); 
            VWD(1, AG_WRAP_6 *); break;
    case 38: VRO(AG_WRAP_8 *, ag_rp_38(PCB_POINTER, VW(0, AG_WRAP_8 *))); break;
    case 39: VRO(AG_WRAP_6 *, ag_rp_39(PCB_POINTER, VW(0, AG_WRAP_6 *))); break;
    case 40: VNO AG_WRAP_6(ag_rp_40(PCB_POINTER, VW(3, AG_WRAP_6 *))); 
            VWD(3, AG_WRAP_6 *); break;
    case 41: VNO AG_WRAP_6(ag_rp_41(PCB_POINTER, VW(3, AG_WRAP_6 *))); 
            VWD(3, AG_WRAP_6 *); break;
    case 42: VRO(AG_WRAP_4 *, ag_rp_42(PCB_POINTER, VW(0, AG_WRAP_4 *))); break;
    case 43: VRO(AG_WRAP_6 *, ag_rp_43(PCB_POINTER, VW(0, AG_WRAP_6 *), VW(2, AG_WRAP_4 *))); 
            VWD(2, AG_WRAP_4 *); break;
    case 44: VRO(AG_WRAP_4 *, ag_rp_44(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_7 *))); 
            VWD(2, AG_WRAP_7 *); break;
    case 45: VNO AG_WRAP_7(ag_rp_45(PCB_POINTER)); break;
    case 46: VRO(AG_WRAP_6 *, ag_rp_46(PCB_POINTER, VW(0, AG_WRAP_6 *))); break;
    case 47: VRO(AG_WRAP_7 *, ag_rp_47(PCB_POINTER, VW(0, AG_WRAP_7 *), VW(2, AG_WRAP_6 *))); 
            VWD(2, AG_WRAP_6 *); break;
    case 48: VNO AG_WRAP_8(ag_rp_48(PCB_POINTER, V(0,(long *)))); break;
    case 49: VNO AG_WRAP_8(ag_rp_49(PCB_POINTER, V(0,(double *)))); break;
    case 50: VNO AG_WRAP_8(ag_rp_50(PCB_POINTER, V(0,(int *)))); break;
    case 51: V(0,(Opcode *)) = ag_rp_51(PCB_POINTER); break;
    case 52: V(0,(Opcode *)) = ag_rp_52(PCB_POINTER); break;
    case 53: V(0,(Opcode *)) = ag_rp_53(PCB_POINTER); break;
    case 54: V(0,(Opcode *)) = ag_rp_54(PCB_POINTER); break;
    case 55: V(0,(Opcode *)) = ag_rp_55(PCB_POINTER); break;
    case 56: V(0,(Opcode *)) = ag_rp_56(PCB_POINTER); break;
    case 57: V(0,(Opcode *)) = ag_rp_57(PCB_POINTER); break;
    case 58: V(0,(Opcode *)) = ag_rp_58(PCB_POINTER); break;
    case 59: V(0,(Opcode *)) = ag_rp_59(PCB_POINTER); break;
    case 60: V(0,(Opcode *)) = ag_rp_60(PCB_POINTER); break;
    case 61: V(0,(Opcode *)) = ag_rp_61(PCB_POINTER); break;
    case 62: V(0,(Opcode *)) = ag_rp_62(PCB_POINTER); break;
    case 63: V(0,(Opcode *)) = ag_rp_63(PCB_POINTER); break;
    case 64: V(0,(Opcode *)) = ag_rp_64(PCB_POINTER); break;
    case 65: V(0,(Opcode *)) = ag_rp_65(PCB_POINTER); break;
    case 66: V(0,(Opcode *)) = ag_rp_66(PCB_POINTER); break;
    case 67: V(0,(Opcode *)) = ag_rp_67(PCB_POINTER); break;
    case 68: V(0,(Opcode *)) = ag_rp_68(PCB_POINTER); break;
    case 69: V(0,(Opcode *)) = ag_rp_69(PCB_POINTER); break;
    case 70: VNO AG_WRAP_4(ag_rp_70(PCB_POINTER, V(0,(int *)))); break;
    case 71: VRO(AG_WRAP_4 *, ag_rp_71(PCB_POINTER, VW(0, AG_WRAP_4 *), V(1,(int *)))); break;
    case 72: V(0,(double *)) = ag_rp_72(PCB_POINTER, V(0,(double *)), V(2,(long *))); break;
    case 73: V(0,(double *)) = ag_rp_73(PCB_POINTER, V(0,(double *)), V(2,(long *))); break;
    case 74: V(0,(double *)) = ag_rp_74(PCB_POINTER, V(0,(double *)), V(2,(double *))); break;
    case 75: V(0,(double *)) = ag_rp_75(PCB_POINTER, V(0,(double *))); break;
    case 76: V(0,(double *)) = ag_rp_76(PCB_POINTER, V(1,(double *))); break;
    case 77: V(0,(double *)) = ag_rp_77(PCB_POINTER, V(0,(long *))); break;
    case 78: V(0,(double *)) = ag_rp_78(PCB_POINTER, V(0,(long *))); break;
    case 79: V(0,(double *)) = ag_rp_79(PCB_POINTER, V(0,(long *))); break;
    case 80: V(0,(long *)) = ag_rp_80(PCB_POINTER, V(1,(long *))); break;
    case 81: V(0,(long *)) = ag_rp_81(PCB_POINTER, V(1,(long *))); break;
    case 82: V(0,(double *)) = ag_rp_82(PCB_POINTER, V(0,(int *))); break;
    case 83: V(0,(double *)) = ag_rp_83(PCB_POINTER, V(0,(int *)), V(1,(double *))); break;
    case 84: V(0,(long *)) = ag_rp_84(PCB_POINTER, V(0,(int *))); break;
    case 85: V(0,(long *)) = ag_rp_85(PCB_POINTER, V(0,(long *)), V(1,(int *))); break;
    case 86: V(0,(long *)) = ag_rp_86(PCB_POINTER, V(0,(int *))); break;
    case 87: V(0,(long *)) = ag_rp_87(PCB_POINTER, V(0,(long *)), V(1,(int *))); break;
    case 88: V(0,(long *)) = ag_rp_88(PCB_POINTER, V(0,(long *)), V(1,(int *))); break;
    case 89: V(0,(long *)) = ag_rp_89(PCB_POINTER, V(0,(long *)), V(1,(int *))); break;
    case 90: V(0,(long *)) = ag_rp_90(PCB_POINTER); break;
    case 91: V(0,(long *)) = ag_rp_91(PCB_POINTER, V(0,(long *)), V(1,(int *))); break;
    case 92: V(0,(long *)) = ag_rp_92(PCB_POINTER); break;
    case 93: V(0,(long *)) = ag_rp_93(PCB_POINTER, V(0,(long *)), V(1,(int *))); break;
    case 94: V(0,(int *)) = ag_rp_94(PCB_POINTER, V(0,(int *))); break;
    case 95: V(0,(int *)) = ag_rp_95(PCB_POINTER, V(0,(int *))); break;
    case 96: VRO(AG_WRAP_5 *, ag_rp_96(PCB_POINTER, VW(0, AG_WRAP_5 *))); break;
    case 97: VRO(AG_WRAP_8 *, ag_rp_97(PCB_POINTER, VW(0, AG_WRAP_8 *), VW(1, AG_WRAP_5 *))); 
            VWD(1, AG_WRAP_5 *); break;
    case 98: VNO AG_WRAP_5(ag_rp_98(PCB_POINTER, VW(1, AG_WRAP_4 *))); 
            VWD(1, AG_WRAP_4 *); break;
    case 99: VNO AG_WRAP_4(ag_rp_99(PCB_POINTER)); break;
    case 100: VRO(AG_WRAP_4 *, ag_rp_100(PCB_POINTER, VW(0, AG_WRAP_4 *), V(1,(int *)))); break;
    case 101: V(0,(int *)) = ag_rp_101(PCB_POINTER); break;
    case 102: V(0,(int *)) = ag_rp_102(PCB_POINTER); break;
    case 103: V(0,(int *)) = ag_rp_103(PCB_POINTER); break;
    case 104: V(0,(int *)) = ag_rp_104(PCB_POINTER); break;
    case 105: V(0,(int *)) = ag_rp_105(PCB_POINTER); break;
    case 106: V(0,(int *)) = ag_rp_106(PCB_POINTER); break;
    case 107: V(0,(int *)) = ag_rp_107(PCB_POINTER); break;
    case 108: V(0,(int *)) = ag_rp_108(PCB_POINTER); break;
    case 109: V(0,(int *)) = ag_rp_109(PCB_POINTER); break;
    case 110: V(0,(int *)) = ag_rp_110(PCB_POINTER); break;
    case 111: V(0,(int *)) = ag_rp_111(PCB_POINTER); break;
    case 112: V(0,(int *)) = ag_rp_112(PCB_POINTER, V(1,(int *))); break;
    case 113: V(0,(int *)) = ag_rp_113(PCB_POINTER, V(0,(int *)), V(1,(int *))); break;
    case 114: V(0,(int *)) = ag_rp_114(PCB_POINTER, V(0,(int *)), V(1,(int *))); break;
    case 115: V(0,(int *)) = ag_rp_115(PCB_POINTER, V(1,(int *))); break;
    case 116: V(0,(int *)) = ag_rp_116(PCB_POINTER, V(0,(int *)), V(1,(int *))); break;
    case 117: V(0,(int *)) = ag_rp_117(PCB_POINTER, V(0,(int *))); break;
    case 118: V(0,(int *)) = ag_rp_118(PCB_POINTER, V(0,(int *))); break;
    case 119: V(0,(int *)) = ag_rp_119(PCB_POINTER, V(1,(int *))); break;
  }
  (PCB).la_ptr = (PCB).pointer;
}

#define TOKEN_NAMES dci_token_names
const char *const dci_token_names[203] = {
  "script",
  "white space",
  "integer",
  "real",
  "name",
  "string element",
  "character constant",
  "script",
  "statement list",
  "eof",
  "statement",
  "open statement",
  "closed statement",
  "if condition",
  "\"ELSE\"",
  "WHILE",
  "expression",
  "\"DO\"",
  "FOR",
  "lvalue",
  "\":=\"",
  "for increment",
  "\"TO\"",
  "simple statement",
  "\"BY\"",
  "REPEAT",
  "\"UNTIL\"",
  "';'",
  "compound statement",
  "\"RETURN\"",
  "dump statement",
  "print statement",
  "structure declaration",
  "\"REPEAT\"",
  "\"WHILE\"",
  "\"FOR\"",
  "\"IF\"",
  "\"THEN\"",
  "\"BEGIN\"",
  "\"END\"",
  "\"DUMP\"",
  "','",
  "\"PRINT\"",
  "\"STRUCT\"",
  "'{'",
  "name list",
  "'}'",
  "simple expression",
  "relational op",
  "term",
  "additive op",
  "unary expression",
  "multiplicative op",
  "factor",
  "'+'",
  "unary op",
  "primary",
  "\"**\"",
  "'('",
  "')'",
  "constant",
  "function call",
  "\"LONG\"",
  "\"DOUBLE\"",
  "'.'",
  "optional arg list",
  "arg list",
  "string",
  "'='",
  "\"<>\"",
  "'<'",
  "\"<=\"",
  "'>'",
  "\">=\"",
  "'-'",
  "\"OR\"",
  "\"XOR\"",
  "'*'",
  "'/'",
  "\"DIV\"",
  "\"MOD\"",
  "\"AND\"",
  "\"SHL\"",
  "\"SHR\"",
  "\"NOT\"",
  "space",
  "\"/*\"",
  "",
  "",
  "",
  "\"*/\"",
  "\"//\"",
  "",
  "",
  "",
  "'\\n'",
  "letter",
  "",
  "simple real",
  "",
  "signed exponent",
  "integer part",
  "fraction part",
  "decimal integer",
  "hybrid integer",
  "octal integer",
  "",
  "exponent",
  "digit",
  "hex integer",
  "",
  "",
  "",
  "'0'",
  "",
  "\"0X\"",
  "hex digit",
  "",
  "'\\\"'",
  "s char sequence",
  "s char",
  "",
  "escape sequence",
  "simple escape sequence",
  "octal escape sequence",
  "hexadecimal escape sequence",
  "\"\\\\\\'\"",
  "\"\\\\\\\"\"",
  "\"\\\\?\"",
  "\"\\\\\\\\\"",
  "\"\\\\A\"",
  "\"\\\\B\"",
  "\"\\\\F\"",
  "\"\\\\N\"",
  "\"\\\\R\"",
  "\"\\\\T\"",
  "\"\\\\V\"",
  "one octal",
  "two octal",
  "three octal",
  "'\\\\'",
  "\"\\\\X\"",
  "hexadecimal digit",
  "'\\''",
  "c char",
  "",
  "",
  "",
  "",
  "",
  "",
  "",
  "",
  "\"ELSE\"",
  "\"DO\"",
  "\"TO\"",
  "\":=\"",
  "\"BY\"",
  "';'",
  "\"UNTIL\"",
  "\"RETURN\"",
  "\"REPEAT\"",
  "\"WHILE\"",
  "\"FOR\"",
  "\"THEN\"",
  "\"IF\"",
  "\"END\"",
  "\"BEGIN\"",
  "name",
  "\"DUMP\"",
  "','",
  "\"PRINT\"",
  "'}'",
  "'{'",
  "\"STRUCT\"",
  "'+'",
  "\"**\"",
  "')'",
  "'('",
  "\"LONG\"",
  "\"DOUBLE\"",
  "'.'",
  "integer",
  "real",
  "character constant",
  "'='",
  "\"<>\"",
  "'<'",
  "\"<=\"",
  "'>'",
  "\">=\"",
  "'-'",
  "\"OR\"",
  "\"XOR\"",
  "'*'",
  "'/'",
  "\"DIV\"",
  "\"MOD\"",
  "\"AND\"",
  "\"SHL\"",
  "\"SHR\"",
  "\"NOT\"",
  "string element",

};

#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(PCB_DECL) {
  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(INPUT_CODE((*(PCB).pointer))) && INPUT_CODE((*(PCB).pointer)) != '\\') {
    char buf[20];
    sprintf(buf, "\'%c\'", (char) INPUT_CODE((*(PCB).pointer)));
    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(PCB_DECL);
static int ag_action_2_r_proc(PCB_DECL);
static int ag_action_3_r_proc(PCB_DECL);
static int ag_action_4_r_proc(PCB_DECL);
static int ag_action_1_s_proc(PCB_DECL);
static int ag_action_3_s_proc(PCB_DECL);
static int ag_action_1_proc(PCB_DECL);
static int ag_action_2_proc(PCB_DECL);
static int ag_action_3_proc(PCB_DECL);
static int ag_action_4_proc(PCB_DECL);
static int ag_action_5_proc(PCB_DECL);
static int ag_action_6_proc(PCB_DECL);
static int ag_action_7_proc(PCB_DECL);
static int ag_action_8_proc(PCB_DECL);
static int ag_action_9_proc(PCB_DECL);
static int ag_action_10_proc(PCB_DECL);
static int ag_action_11_proc(PCB_DECL);
static int ag_action_8_proc(PCB_DECL);


static int (*const  ag_r_procs_scan[])(PCB_DECL) = {
  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[])(PCB_DECL) = {
  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[])(PCB_DECL) = {
  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(PCB_DECL) {
  int ag_t = (PCB).token_number;
  (PCB).btsx = 0, (PCB).drt = -1;
  do {
    ag_track(PCB_POINTER);
    (PCB).token_number = (dci_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr));
    (PCB).la_ptr++;
    if (ag_key_index[(PCB).sn]) {
      unsigned ag_k = ag_key_index[(PCB).sn];
      int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer));
      if (ag_ch <= 255) {
        while (ag_key_ch[ag_k] < ag_ch) ag_k++;
        if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k);
      }
    }
  } while ((PCB).token_number == (dci_token_type) ag_t);
  (PCB).la_ptr =  (PCB).pointer;
  return 1;
}

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

  (PCB).btsx = 0, (PCB).drt = -1;
  do {
    (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer;
    (PCB).ssx--;
    ag_track(PCB_POINTER);
    ag_ra(PCB_POINTER);
    if ((PCB).exit_flag != AG_RUNNING_CODE) return 0;
    (PCB).ssx++;
    (PCB).token_number = (dci_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr));
    (PCB).la_ptr++;
    if (ag_key_index[(PCB).sn]) {
      unsigned ag_k = ag_key_index[(PCB).sn];
      int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer));
      if (ag_ch <= 255) {
        while (ag_key_ch[ag_k] < ag_ch) ag_k++;
        if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k);
      }
    }
  }
  while ((PCB).token_number == (dci_token_type) ag_t);
  (PCB).la_ptr =  (PCB).pointer;
  return 1;
}

static int ag_action_3_r_proc(PCB_DECL) {
  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 = (dci_token_type) ag_ptt[(PCB).ag_ap];
  ag_ra(PCB_POINTER);
  return (PCB).exit_flag == AG_RUNNING_CODE;
}

static int ag_action_3_s_proc(PCB_DECL) {
  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 = (dci_token_type) ag_ptt[(PCB).ag_ap];
  ag_ra(PCB_POINTER);
  return (PCB).exit_flag == AG_RUNNING_CODE;;
}

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

static int ag_action_2_proc(PCB_DECL) {
  (PCB).btsx = 0, (PCB).drt = -1;
  if ((PCB).ssx >= 128) {
    (PCB).exit_flag = AG_STACK_ERROR_CODE;
    PARSER_STACK_OVERFLOW;
  }
  (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer;
  GET_CONTEXT;
  (PCB).ss[(PCB).ssx] = (PCB).sn;
  (PCB).ssx++;
  (PCB).sn = (PCB).ag_ap;
  ag_track(PCB_POINTER);
  return 0;
}

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

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

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

static int ag_action_1_proc(PCB_DECL) {
  ag_track(PCB_POINTER);
  (PCB).exit_flag = AG_SUCCESS_CODE;
  return 0;
}

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

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

static int ag_action_4_proc(PCB_DECL) {
  int ag_sd = ag_fl[(PCB).ag_ap] - 1;
  (PCB).reduction_token = (dci_token_type) ag_ptt[(PCB).ag_ap];
  (PCB).btsx = 0, (PCB).drt = -1;
  (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer;
  if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
  else GET_CONTEXT;
  (PCB).ss[(PCB).ssx] = (PCB).sn;
  ag_track(PCB_POINTER);
  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);
    (PCB).ag_ap = ag_pstt[ag_t1];
    if ((ag_s_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break;
  }
  return 0;
}

static int ag_action_3_proc(PCB_DECL) {
  int ag_sd = ag_fl[(PCB).ag_ap] - 1;
  (PCB).btsx = 0, (PCB).drt = -1;
  (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer;
  if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
  else GET_CONTEXT;
  (PCB).ss[(PCB).ssx] = (PCB).sn;
  ag_track(PCB_POINTER);
  (PCB).reduction_token = (dci_token_type) ag_ptt[(PCB).ag_ap];
  ag_ra(PCB_POINTER);
  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);
    (PCB).ag_ap = ag_pstt[ag_t1];
    if ((ag_s_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break;
  }
  return 0;
}

static int ag_action_8_proc(PCB_DECL) {
  ag_undo(PCB_POINTER);
  (PCB).la_ptr =  (PCB).pointer;
  (PCB).exit_flag = AG_SYNTAX_ERROR_CODE;
  ag_diagnose(PCB_POINTER);
  SYNTAX_ERROR;
  {(PCB).la_ptr = (PCB).pointer + 1; ag_track(PCB_POINTER);}
  return (PCB).exit_flag == AG_RUNNING_CODE;
}

static int ag_action_5_proc(PCB_DECL) {
  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 {
    GET_CONTEXT;
    (PCB).ss[(PCB).ssx] = (PCB).sn;
  }
  (PCB).la_ptr =  (PCB).pointer;
  (PCB).reduction_token = (dci_token_type) ag_ptt[(PCB).ag_ap];
  ag_ra(PCB_POINTER);
  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);
    (PCB).ag_ap = ag_pstt[ag_t1];
    if ((ag_r_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break;
  }
  return (PCB).exit_flag == AG_RUNNING_CODE;
}

static int ag_action_6_proc(PCB_DECL) {
  int ag_sd = ag_fl[(PCB).ag_ap];
  (PCB).reduction_token = (dci_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_POINTER);
    (PCB).vs[(PCB).ssx] = ag_null_value;
    GET_CONTEXT;
    (PCB).ss[(PCB).ssx] = (PCB).sn;
  }
  (PCB).la_ptr =  (PCB).pointer;
  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);
    (PCB).ag_ap = ag_pstt[ag_t1];
    if ((ag_r_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break;
  }
  return (PCB).exit_flag == AG_RUNNING_CODE;
}


void init_dci(dci_pcb_type *PCB_POINTER) {
  (PCB).la_ptr = (PCB).pointer;
  (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;
}

void dci(dci_pcb_type *PCB_POINTER) {
  init_dci(PCB_POINTER);
  (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;
      (PCB).token_number = (dci_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr));
      (PCB).la_ptr++;
      if (ag_key_index[(PCB).sn]) {
        unsigned ag_k = ag_key_index[(PCB).sn];
        int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer));
        if (ag_ch <= 255) {
          while (ag_key_ch[ag_k] < ag_ch) ag_k++;
          if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k);
        }
      }
      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]])((PCB_TYPE *)PCB_POINTER);
  }
}


