Mercurial > ~dholland > hg > ag > index.cgi
diff tests/agcl/oldagsrc/good/asiwdp.cpp @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/agcl/oldagsrc/good/asiwdp.cpp Sat Dec 22 17:52:45 2007 -0500 @@ -0,0 +1,1902 @@ +/* + asiwdp.syn + + ASI -- A Simple Interpreter + Copyright (c) 1999 Parsifal Software, All Rights Reserved. + + This implementation of ASI uses C++ and was developed + as part of the ASI Windows Demonstration program to + illustrate the use of the "reentrant parser" switch + and the "extend pcb" statement to create a thread-safe + parser. The example program uses a Microsoft Foundation + Class program to demonstrate multiple instances of an + AnaGram parser running concurrently on separate threads. + + The expression syntax is borrowed from C but with the + addition of the FORTRAN exponentiation operator (**). + + The cast, increment, and decrement operators are not + implemented, nor are operations that are defined only + for integers: + Bitwise logical operators: &, |, ^, ~, &=, |=, ^= + Remainder operators: %, %= + Shift operators: <<, >>, >>=, <<= + + The supported operations are: + Assignment operators: =, +=, -=, *=, /= + Conditional expressions: ? : + Logical operators: !, &&, || + Comparison operators: ==, !=, <, <=, >, >= + Binary arithmetic operators: +, -, *, / + Exponentiation: ** + Unary arithmetic operators: +, - + Parentheses + Function calls + + All arithmetic is double precision floating point. + + Statements may include expression statements, blocks, if/else statements + or while statements, following the rules of C. + + The statement syntax has been written to avoid the conventional + if/else ambiguity. + + There are no declarations. All variables are presumed to be double. + + Input strings may contain any number of statements. White space may be + used freely, including both C and C++ style comments. + + asiwd uses the following classes, defined in asiwdef.h: + CharStack // Used to accumulate variable names + SymbolTable // Maintains variable names and values + WhileStack // Maintains state of active while loops + Location // Records location in source text + + The AnaGram parser generator uses asiwdp.syn as a specification to + create a C++ parser file asiwdp.cpp and a companion header file, + asiwdp.h. + + For information about AnaGram, visit http://www.parsifalsoft.com. +*/ + +#include "asiwdef.h" + + +/* + * AnaGram, A System for Syntax Directed Programming + * File generated by: ... + * + * AnaGram Parsing Engine + * Copyright 1993-2002 Parsifal Software. All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifndef ASIWDP_H +#include "asiwdp.h" +#endif + +#ifndef ASIWDP_H +#error Mismatched header file +#endif + +#include <ctype.h> +#include <stdio.h> + +#define RULE_CONTEXT (&((PCB).cs[(PCB).ssx])) +#define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx]) +#define CONTEXT ((PCB).cs[(PCB).ssx]) + + +#ifndef PCB_TYPE +#define PCB_TYPE asi_pcb_type +#endif + + +#define PCB (*pcb_pointer) +#define PCB_DECL PCB_TYPE *pcb_pointer +#define PCB_POINTER pcb_pointer +#define CHANGE_REDUCTION(x) asi_change_reduction(PCB_POINTER, asi_##x##_token) +int asi_change_reduction(PCB_DECL, asi_token_type); + + +#line - "asiwdp.syn" + // begin embedded C + +#include <math.h> + +// Check for division by zero +double asi_pcb_type::checkZero(double value) { + if (value) return value; + error_message = "Divide by Zero"; + exit_flag = AG_SEMANTIC_ERROR_CODE; + return 1; +} + +// external interface to the parser +int asi_pcb_type::interpret(char *text, SymbolTable *st) { + symbolTable = st; + charStack.reset(); + pointer = (unsigned char *) text; + asi(this); + return exit_flag != AG_SUCCESS_CODE; +} + +/* + locate value of variable whose name is given by the top k characters on the + character stack. + Return a pointer so the value can be either fetched or stored +*/ + +double *asi_pcb_type::locateValue(int k) { + double *pointer = &symbolTable->locate(charStack.popString(k)).value; + if (symbolTable->overflow()) { + error_message = "Symbol table overflow"; + exit_flag = AG_SEMANTIC_ERROR_CODE; + } + return pointer; +} + +// Encapsulate current location in source text +Location asi_pcb_type::location() { + return Location(pointer, line, column); +} + +// Set source file location for loop continuation +void asi_pcb_type::loopContinue() { + setLocation(whileStack.continueLocation()); +} + +// Set source file location for loop exit +void asi_pcb_type::loopExit() { + setLocation(whileStack.exitLocation()); + whileStack.pop(); +} + +// Push character onto character stack +void asi_pcb_type::pushChar(int c) { + if (charStack.push(c)) { + error_message = "Name is too long"; + exit_flag = AG_SEMANTIC_ERROR_CODE; + } +} + +// Set parse location in source text +void asi_pcb_type::setLocation(const Location &l) { + pointer = l.pointer; + line = l.line; + column = l.column; +} + +// Save currently active loop, if any, and init nested loop +void asi_pcb_type::stackLoop(const Location &c) { + // Current source location is exit location for loop + // c is the continue location + if (whileStack.push(c, location())) { + error_message = "While stack overflow"; + exit_flag = AG_SEMANTIC_ERROR_CODE; + } + setLocation(c); // Set location to loop condition +} + +#line - "asiwdp.cpp" + +#ifndef CONVERT_CASE +#define CONVERT_CASE(c) (c) +#endif +#ifndef TAB_SPACING +#define TAB_SPACING 8 +#endif + +static void ag_rp_1(PCB_DECL, double x) { +#line - "asiwdp.syn" +if (x == 0) CHANGE_REDUCTION(false_if_condition); +#line - "asiwdp.cpp" +} + +#define ag_rp_2(PCB_POINTER, c) (PCB.stackLoop(c)) + +#define ag_rp_3(PCB_POINTER, c) (PCB.stackLoop(c)) + +#define ag_rp_4(PCB_POINTER) (PCB.location()) + +#define ag_rp_5(PCB_POINTER) (PCB.loopExit()) + +#define ag_rp_6(PCB_POINTER) (PCB.loopContinue()) + +#define ag_rp_7(PCB_POINTER, x) (x == 0 ? CHANGE_REDUCTION(false_while_condition) : 0) + +#define ag_rp_8(PCB_POINTER, pointer, x) (*pointer = x) + +#define ag_rp_9(PCB_POINTER, pointer, x) (*pointer += x) + +#define ag_rp_10(PCB_POINTER, pointer, x) (*pointer -= x) + +#define ag_rp_11(PCB_POINTER, pointer, x) (*pointer *= x) + +#define ag_rp_12(PCB_POINTER, pointer, x) (*pointer /= x) + +#define ag_rp_13(PCB_POINTER, c, x, y) (c ? x : y) + +#define ag_rp_14(PCB_POINTER, x, y) (x ? x : y) + +#define ag_rp_15(PCB_POINTER, x, y) (x ? y : x) + +#define ag_rp_16(PCB_POINTER, x, y) (x == y) + +#define ag_rp_17(PCB_POINTER, x, y) (x != y) + +#define ag_rp_18(PCB_POINTER, x, y) (x < y) + +#define ag_rp_19(PCB_POINTER, x, y) (x <= y) + +#define ag_rp_20(PCB_POINTER, x, y) (x > y) + +#define ag_rp_21(PCB_POINTER, x, y) (x >= y) + +#define ag_rp_22(PCB_POINTER, x, y) (x + y) + +#define ag_rp_23(PCB_POINTER, x, y) (x - y) + +#define ag_rp_24(PCB_POINTER, x, y) (x * y) + +#define ag_rp_25(PCB_POINTER, x, y) (x/PCB.checkZero(y)) + +#define ag_rp_26(PCB_POINTER, x) (-x) + +#define ag_rp_27(PCB_POINTER, x) (x) + +#define ag_rp_28(PCB_POINTER, x, y) (pow(x,y)) + +#define ag_rp_29(PCB_POINTER, valuePointer) (*valuePointer) + +#define ag_rp_30(PCB_POINTER, x) (log(x)) + +#define ag_rp_31(PCB_POINTER, x) (exp(x)) + +#define ag_rp_32(PCB_POINTER, x) (sin(x)) + +#define ag_rp_33(PCB_POINTER, x) (cos(x)) + +#define ag_rp_34(PCB_POINTER, x) (tan(x)) + +#define ag_rp_35(PCB_POINTER, x) (x) + +#define ag_rp_36(PCB_POINTER, x) (x == 0) + +#define ag_rp_37(PCB_POINTER, c) (PCB.charStack.push(c), 1) + +#define ag_rp_38(PCB_POINTER, k, c) (PCB.charStack.push(c), k+1) + +#define ag_rp_39(PCB_POINTER, k) (PCB.locateValue(k)) + +#define ag_rp_40(PCB_POINTER, x, e) (x*pow(10,e)) + +#define ag_rp_41(PCB_POINTER, x, e) (x*pow(10,-e)) + +#define ag_rp_42(PCB_POINTER, i, f) (i+f) + +#define ag_rp_43(PCB_POINTER, f) (f) + +#define ag_rp_44(PCB_POINTER, d) (d-'0') + +#define ag_rp_45(PCB_POINTER, x, d) (10*x + d-'0') + +#define ag_rp_46(PCB_POINTER, d) ((d-'0')/10.) + +#define ag_rp_47(PCB_POINTER, d, f) ((d-'0' + f)/10.) + +#define ag_rp_48(PCB_POINTER, d) (d-'0') + +#define ag_rp_49(PCB_POINTER, x, d) (10*x + d-'0') + + +#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 asi_vs_type const ag_null_value NULL_VALUE_INITIALIZER; + +static const unsigned char ag_rpx[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, + 0, 6, 7, 0, 8, 9, 10, 11, 12, 0, 13, 0, 14, 0, 15, 0, 16, 17, + 0, 18, 19, 20, 21, 0, 22, 23, 0, 24, 25, 0, 26, 27, 0, 28, 0, 29, + 30, 31, 32, 33, 34, 35, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 38, 39, 0, 0, + 0, 40, 41, 42, 0, 0, 0, 43, 44, 45, 46, 47, 48, 49 +}; + +static const unsigned char ag_key_itt[] = { + 0 +}; + +static const unsigned short ag_key_pt[] = { +0 +}; + +static const unsigned char ag_key_ch[] = { + 0, 42, 47,255, 47, 99,101,105,108,115,116,119,255, 42,255, 42, 61,255, + 42, 47, 61,255,108,120,255, 33, 38, 42, 43, 45, 47, 60, 61, 62, 99,101, + 105,108,115,116,119,124,255, 99,101,105,108,115,116,119,255, 42, 47,255, + 33, 38, 42, 47, 60, 61, 62,124,255, 42, 47,255, 47, 99,101,108,115,116, + 255, 42, 47,255, 47,255, 99,101,108,115,116,255, 33, 38, 42, 60, 61, 62, + 124,255, 33, 38, 60, 61, 62,124,255, 33, 38, 61,124,255, 42, 61,255, 42, + 47, 61,255, 33, 38, 42, 43, 45, 47, 60, 61, 62,124,255, 38,124,255,124, + 255, 42, 47,255,108,120,255, 47, 99,101,105,108,115,116,119,255, 42, 61, + 255, 33, 38, 42, 43, 45, 47, 60, 61, 62,124,255,105,119,255,108,120,255, + 99,101,105,108,115,116,119,255, 42, 47,255,108,120,255, 33, 38, 42, 47, + 60, 61, 62, 99,101,105,108,115,116,119,124,255 +}; + +static const unsigned char ag_key_act[] = { + 0,0,0,4,2,3,3,3,3,3,3,3,4,3,4,0,0,4,0,0,0,4,3,3,4,3,3,2,3,3,2,3,3,3,3, + 2,3,3,3,3,3,3,4,3,3,3,3,3,3,3,4,0,0,4,3,3,3,2,3,3,3,3,4,0,0,4,2,3,3,3, + 3,3,4,0,0,4,2,4,3,3,3,3,3,4,3,3,3,3,3,3,3,4,3,3,3,3,3,3,4,3,3,3,3,4,0, + 0,4,0,0,0,4,3,3,2,3,3,2,3,3,3,3,4,3,3,4,3,4,0,0,4,3,3,4,2,3,2,3,3,3,3, + 3,4,0,0,4,3,3,2,3,3,3,3,3,3,3,4,3,3,4,3,3,4,3,2,3,3,3,3,3,4,0,0,4,3,3, + 4,3,3,3,2,3,3,3,3,2,3,3,3,3,3,3,4 +}; + +static const unsigned char ag_key_parm[] = { + 0, 73, 78, 0, 0,138,136,107,135,137,139,108, 0, 77, 0,133,117, 0, + 73, 78,118, 0,106,136, 0,124,122, 0,115,116, 0,126,123,128,138, 0, + 107,135,137,139,108,121, 0,138,136,107,135,137,139,108, 0, 73, 78, 0, + 124,122,133, 0,126,123,128,121, 0, 73, 78, 0, 0,138,136,135,137,139, + 0, 73, 78, 0, 0, 0,138,136,135,137,139, 0,124,122,133,126,123,128, + 121, 0,124,122,126,123,128,121, 0,124,122,123,121, 0,133,117, 0, 73, + 78,118, 0,124,122, 0,115,116, 0,126,123,128,121, 0,122,121, 0,121, + 0, 73, 78, 0,106,136, 0, 0,138, 0,107,135,137,139,108, 0,133,117, + 0,124,122, 0,115,116,118,126,123,128,121, 0,107,108, 0,106,136, 0, + 138, 0,107,135,137,139,108, 0, 73, 78, 0,106,136, 0,124,122,133, 0, + 126,123,128,138, 0,107,135,137,139,108,121, 0 +}; + +static const unsigned short ag_key_jmp[] = { + 0, 0, 0, 0, 1, 0, 3, 6, 8, 11, 14, 17, 0, 22, 0, 0, 0, 0, + 0, 0, 0, 0, 41, 44, 0, 24, 26, 15, 28, 30, 18, 32, 34, 36, 38, 22, + 46, 48, 51, 54, 57, 62, 0, 64, 67, 70, 72, 75, 78, 81, 0, 0, 0, 0, + 86, 88, 90, 51, 92, 94, 96, 98, 0, 0, 0, 0, 63,100,103,106,109,112, + 0, 0, 0, 0, 73, 0,115,118,121,124,127, 0,130,132,134,136,138,140, + 142, 0,144,146,148,150,152,154, 0,156,158,160,162, 0, 0, 0, 0, 0, + 0, 0, 0,164,166,104,168,170,107,172,174,176,178, 0,180,182, 0,184, + 0, 0, 0, 0,189,192, 0,127,186,130,194,196,199,202,205, 0, 0, 0, + 0,210,212,142,214,216,218,220,222,224,226, 0,228,230, 0,238,241, 0, + 235,159,243,245,248,251,254, 0, 0, 0, 0,274,277, 0,259,261,263,170, + 265,267,269,271,173,279,281,284,287,290,295, 0 +}; + +static const unsigned char ag_key_index[] = { + 4, 0, 13, 25, 43, 0, 0, 13, 13, 0, 54, 54, 66, 66, 76, 76, 76, 76, + 76, 54, 78, 78, 0, 0, 0, 0, 0, 66, 66, 84, 78, 78, 92, 92, 92, 99, + 111,122, 76,111,125, 76, 4,133,145, 0, 0, 0, 43, 0, 0,156, 43, 43, + 0, 54, 54, 0, 0, 78, 78, 78, 78, 78, 66, 78, 66, 78, 66, 78, 78, 78, + 66, 78, 66, 78, 66, 78, 66, 78, 66, 78, 66, 78, 66, 78, 66, 78, 66, 78, + 66, 78, 66, 78, 66, 78, 66, 78, 66, 78, 0,156, 78, 0, 43,133, 76, 76, + 66, 76, 76, 76, 0, 0, 0, 0, 0,162,162, 0, 0,176, 0, 0, 0, 0, + 0, 92, 92, 92, 92, 92, 92, 92, 92, 99,122, 0, 0, 0, 43, 78, 0, 0, + 0, 0,156,156, 4, 43,156, 54, 54, 78, 0,162,156 +}; + +static const unsigned char ag_key_ends[] = { +111,115,0, 120,112,0, 102,0, 111,103,0, 105,110,0, 97,110,0, +104,105,108,101,0, 47,0, 61,0, 38,0, 61,0, 61,0, 61,0, 61,0, +61,0, 111,115,0, 115,101,0, 112,0, 102,0, 111,103,0, 105,110,0, +97,110,0, 104,105,108,101,0, 124,0, 111,115,0, 120,112,0, 102,0, +111,103,0, 105,110,0, 97,110,0, 104,105,108,101,0, 61,0, 38,0, +42,0, 61,0, 61,0, 61,0, 124,0, 111,115,0, 120,112,0, 111,103,0, +105,110,0, 97,110,0, 111,115,0, 120,112,0, 111,103,0, 105,110,0, +97,110,0, 61,0, 38,0, 42,0, 61,0, 61,0, 61,0, 124,0, 61,0, +38,0, 61,0, 61,0, 61,0, 124,0, 61,0, 38,0, 61,0, 124,0, +61,0, 38,0, 61,0, 61,0, 61,0, 61,0, 61,0, 124,0, 38,0, 124,0, +124,0, 111,115,0, 115,101,0, 112,0, 102,0, 111,103,0, 105,110,0, +97,110,0, 104,105,108,101,0, 61,0, 38,0, 61,0, 61,0, 61,0, +61,0, 61,0, 61,0, 124,0, 102,0, 104,105,108,101,0, 111,115,0, +115,101,0, 112,0, 102,0, 111,103,0, 105,110,0, 97,110,0, +104,105,108,101,0, 61,0, 38,0, 42,0, 61,0, 61,0, 61,0, +111,115,0, 115,101,0, 112,0, 102,0, 111,103,0, 105,110,0, +97,110,0, 104,105,108,101,0, 124,0, +}; + +#define AG_TCV(x) ag_tcv[(x)] + +static const unsigned char ag_tcv[] = { + 7,100,100,100,100,100,100,100,100, 99, 82, 99, 99, 99,100,100,100,100, + 100,100,100,100,100,100,100,100,100,100,100,100,100,100, 99,140,141,141, + 141,141,141,141,112,111,131,129,141,130,142,132,143,143,143,143,143,143, + 143,143,143,143,119,105,125,113,127,120,141,144,144,144,144,145,144,144, + 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, + 144,141,141,141,141,144,141,144,144,144,144,145,144,144,144,144,144,144, + 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,110,141,109, + 141,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, + 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, + 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, + 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, + 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, + 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, + 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, + 100,100,100,100 +}; + +#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 = (asi_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 = (asi_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 = (asi_token_type) ag_key_pt[ag_k1+1]; + break; + } + case ag_set_key: + ag_save = (int) ((PCB).la_ptr - (PCB).pointer); + (PCB).token_number = (asi_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 = (asi_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 = (asi_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]; +} + +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).token_number = (asi_token_type) (PCB).drt; + (PCB).ssx = (PCB).dssx; + (PCB).sn = (PCB).dsn; + (PCB).drt = -1; +} + + + +static const int ag_rtt[] = { + 25, 26, 0, 35, 34, 0 +}; + +static const unsigned char ag_tstt[] = { +145,144,143,142,140,139,138,137,136,135,130,129,112,110,108,107,105,99,82, + 78,73,7,0,1,103,104, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,109, + 105,100,99,82,0,80,81, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,109, + 105,100,99,82,77,0,75,76, +99,82,78,73,0,1, +145,144,143,142,140,139,138,137,136,135,130,129,112,110,108,107,105,7,0,2,3, + 4,5,6,8,14,16,19,20,21,22,23,25,26,27,29,30,32,36,42,45,47,49,52,57,58, + 59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,109, + 105,100,99,0, +82,0, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,109, + 105,100,99,82,0, +77,0, +143,0,96, +145,143,142,133,132,131,130,129,128,127,126,125,124,123,122,121,120,119,111, + 105,99,82,78,73,0,97, +145,0, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,111,110,105,99,82,78,73,0,1,103,104, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,111,99,82,78,73,0,1,103,104, +112,99,82,78,73,0,1,103,104, +112,99,82,78,73,0,1,103,104, +112,99,82,78,73,0,1,103,104, +112,99,82,78,73,0,1,103,104, +112,99,82,78,73,0,1,103,104, +133,132,131,130,129,128,127,126,125,124,123,122,121,120,119,111,105,99,82, + 78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,112,0,2,3,30,64,66,67,68,69,70,71, + 87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +112,0,30, +112,0,30, +112,0,30, +112,0,30, +112,0,30, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,111,110,105,99,82,78,73,0,1,103,104, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,111,110,105,99,82,78,73,0,1,103,104, +133,0,65, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,58,59,60,63,64, + 66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,58,59,60,63,64, + 66,67,68,69,70,71,87,90,94,114,134, +132,131,0,61,62, +130,129,0,58,59, +128,127,126,125,0,53,54,55,56, +124,123,0,50,51, +145,144,143,0, +122,0,48, +112,99,82,78,73,0,1,103,104, +133,132,131,130,129,128,127,126,125,124,123,122,121,120,119,118,117,116,115, + 113,111,105,99,82,78,73,0,1,103,104, +121,120,0,43,46, +112,99,82,78,73,0,1,103,104, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,110,109,108,107,105,99,82,78,73,0,1,103,104, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,110,109,108,107,106,105,99,82,78,73,7,0,1,103,104, +118,117,116,115,113,0,37,38,39,40,41, +112,0,17,30, +112,0,30, +112,0,28,33, +145,144,143,142,140,139,138,137,136,135,130,129,112,110,109,108,107,105,0,2, + 3,5,8,14,16,19,20,21,22,23,24,25,26,27,29,30,32,36,42,45,47,49,52,57,58, + 59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +105,0,14, +112,0,28,33, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,108,107, + 105,0,9,10,11,12,13,15,16,17,19,23,30,37,43,44,53,55,58,59,61,62,71,91, + 95,98,101,102, +145,144,143,142,140,139,138,137,136,135,130,129,112,110,108,107,105,0,2,3,8, + 14,16,19,20,21,22,23,25,26,27,29,30,32,36,42,45,47,49,52,57,58,59,60,63, + 64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,110,108,107,105,0,2,3,8, + 14,16,19,20,21,22,23,25,26,27,29,30,32,36,42,45,47,49,52,57,58,59,60,63, + 64,66,67,68,69,70,71,87,90,94,114,134, +7,0, +143,0,96, +143,0,96, +143,130,129,0,92, +111,0,31, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,58,59,60,63,64, + 66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,111,110,105,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,58,59,60,63,64, + 66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,111,110,105,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,58,59,60,63,64, + 66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,57,58,59,60,63, + 64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,57,58,59,60,63, + 64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,52,57,58,59,60, + 63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,111,110,105,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,52,57,58,59,60, + 63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,52,57,58,59,60, + 63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,111,110,105,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,52,57,58,59,60, + 63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,49,52,57,58,59, + 60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,49,52,57,58,59, + 60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,47,49,52,57,58, + 59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,45,47,49,52,57, + 58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,111,110,105,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,111,110,105,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,0,12,13, + 17,30,37,43,44,53,55,58,59,61,62,71,91,95,98,101,102, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,108,107, + 105,0,10,11,12,13,15,16,17,19,23,30,37,43,44,53,55,58,59,61,62,71,91,95, + 98,101,102, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +112,0,30,34,35, +145,144,143,142,140,139,138,137,136,135,130,129,112,110,109,108,107,105,0,2, + 3,8,14,16,19,20,21,22,23,24,25,26,27,29,30,32,36,42,45,47,49,52,57,58, + 59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,111,110,109,108,107,106,105,99,82,78,73,7,0,1,103,104, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,105, + 99,82,78,73,0,1,103,104, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,105, + 99,82,78,73,0,1,103,104, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,111,110,105,99,82,78,73,0,1,103,104, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,105, + 99,82,78,73,0,1,103,104, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,105, + 99,82,78,73,0,1,103,104, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,105, + 99,82,78,73,0,1,103,104, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,109, + 105,0,12,13,15,17,23,30,37,43,44,53,55,58,59,61,62,71,84,85,86,91,95,98, + 101,102, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,0,15,17, + 23,30,37,43,44,53,55,58,59,61,62,71,91,95,98,101,102, +112,0,17,30, +112,0,17,30, +105,0,14, +106,0,18, +106,0,18, +143,0,93, +143,0,93, +145,144,143,142,141,140,139,138,137,136,135,133,132,131,130,129,128,127,126, + 125,124,123,122,121,120,119,113,112,111,110,109,108,107,106,105,99,82, + 78,73,7,0,1,103,104, +111,0,31, +111,0,31, +111,0,31, +111,0,31, +111,0,31, +132,131,0,61,62, +132,131,0,61,62, +130,129,0,58,59, +130,129,0,58,59, +130,129,0,58,59, +130,129,0,58,59, +128,127,126,125,0,53,54,55,56, +128,127,126,125,0,53,54,55,56, +124,123,0,50,51, +122,0,48, +119,0,44, +111,0,31, +111,0,31, +145,144,143,142,140,139,138,137,136,135,130,129,112,110,108,107,105,0,2,3,8, + 14,16,19,20,21,22,23,25,26,27,29,30,32,36,42,45,47,49,52,57,58,59,60,63, + 64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, + 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +109,0,24, +105,0,14, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,109,105, + 0,12,13,17,30,37,43,44,53,55,58,59,61,62,71,84,91,95,98,101,102, +109,0,24, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,108,107, + 105,0,10,11,12,13,15,16,17,19,23,30,37,43,44,53,55,58,59,61,62,71,91,95, + 98,101,102, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,108,107, + 105,0,9,10,11,12,13,15,16,17,19,23,30,37,43,44,53,55,58,59,61,62,71,91, + 95,98,101,102, +145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, + 113,112,110,108,107,105,99,82,78,73,0,1,103,104, +145,144,143,142,140,139,138,137,136,135,130,129,112,110,108,107,105,0,2,3, + 14,16,19,20,21,22,23,25,26,27,29,30,32,36,42,45,47,49,52,57,58,59,60,63, + 64,66,67,68,69,70,71,87,90,94,114,134, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,108,107, + 105,0,10,11,12,13,15,16,17,19,23,30,37,43,44,53,55,58,59,61,62,71,91,95, + 98,101,102, +143,0, +143,0, +145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,36,42,45,47,49, + 52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, +111,0,31, +106,0,18, +145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,108,107, + 105,0,10,11,12,13,15,16,17,19,23,30,37,43,44,53,55,58,59,61,62,71,91,95, + 98,101,102, + +}; + + +static unsigned const char ag_astt[3416] = { + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,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,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,8,7,1,1,9,9,1,1,5,3,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8,7,1,1,0,1,1,1,1, + 1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,5,3,7,1,7,2,5,10,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 5,5,7,3,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,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,1,1,1,1,7,1,1,3,5,1,1,1,1,7, + 1,1,3,5,1,1,1,1,7,1,1,3,5,1,1,1,1,7,1,1,3,5,1,1,1,1,7,1,1,3,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,1,1,1,1,7,1,1,3,2,2,2,1,1,1,1,1,1,1, + 1,7,2,2,1,2,1,1,1,1,1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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8,7,3,3,1,1,3,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1 +}; + + +static const unsigned char ag_pstt[] = { +4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,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,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,8,2,7,8, +190,190,1,2,192,190, +103,103,116,9,12,14,15,16,17,18,28,27,13,42,38,41,43,54,4,29,44,0,53,54,53, + 53,46,34,53,53,49,48,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31,32,32, + 29,26,25,24,23,22,20,36,11,10,39,19, +86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,88, +89,6, +81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,83, +84,8, +55,9,115, +112,117,56,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, + 112,112,112,112,112,10,114, +57,106, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,3,3,1,2,12,3,3,228, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,3,3,1,2,13,3,3,200, +191,3,3,1,2,14,3,3,227, +191,3,3,1,2,15,3,3,226, +191,3,3,1,2,16,3,3,225, +191,3,3,1,2,17,3,3,224, +191,3,3,1,2,18,3,3,223, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2, + 19,3,3,222, +103,103,116,9,12,14,15,16,17,18,13,20,78,71,21,78,26,25,24,23,22,20,36,11, + 10,39,19, +103,103,116,9,12,14,15,16,17,18,28,27,13,21,29,44,58,21,58,40,37,35,34,33, + 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +13,22,59, +13,23,60, +13,24,61, +13,25,62, +13,26,63, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,3,3,1,2,27,3,3,217, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,3,3,1,2,28,3,3,218, +64,68,65, +103,103,116,9,12,14,15,16,17,18,28,27,13,30,29,71,21,30,31,67,67,29,26,25, + 24,23,22,20,36,11,10,39,19, +103,103,116,9,12,14,15,16,17,18,28,27,13,31,29,71,21,30,31,66,66,29,26,25, + 24,23,22,20,36,11,10,39,19, +66,68,59,69,67, +28,27,54,71,70, +72,74,76,78,51,79,77,75,73, +80,82,49,83,81, +104,104,104,105, +84,47,85, +191,3,3,1,2,38,3,3,196, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,3,3,1,2,39,3,3,202, +86,88,45,89,87, +191,3,3,1,2,41,3,3,195, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,191,191,3,3,1,2,42,3,3,198, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,191,191,191,3,3,1,2,191,43,3,3,193, +90,92,94,96,98,71,99,97,95,93,91, +13,45,101,100, +13,46,102, +103,47,25,103, +103,103,116,9,12,14,15,16,17,18,28,27,13,42,105,38,41,43,48,29,44,104,104, + 104,46,34,104,104,49,48,21,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31, + 32,32,29,26,25,24,23,22,20,36,11,10,39,19, +43,49,19, +103,50,30,103, +106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,38,41,116,51,27,27, + 117,113,116,117,115,113,114,112,100,113,113,113,113,113,113,113,113,113, + 113,113,113,113,113,113, +103,103,116,9,12,14,15,16,17,18,28,27,13,42,38,41,43,52,29,44,26,118,46,34, + 26,118,49,48,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31,32,32,29,26, + 25,24,23,22,20,36,11,10,39,19, +103,103,116,9,12,14,15,16,17,18,28,27,13,42,38,41,43,2,29,44,5,5,46,34,5,5, + 49,48,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31,32,32,29,26,25,24,23, + 22,20,36,11,10,39,19, +3,54, +55,118,119, +55,113,111, +120,119,120,57,120, +121,58,77, +103,103,116,9,12,14,15,16,17,18,28,27,13,59,29,44,122,21,122,40,37,35,34,33, + 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +103,103,116,9,12,14,15,16,17,18,28,27,13,60,29,44,123,21,123,40,37,35,34,33, + 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +103,103,116,9,12,14,15,16,17,18,28,27,13,61,29,44,124,21,124,40,37,35,34,33, + 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +103,103,116,9,12,14,15,16,17,18,28,27,13,62,29,44,125,21,125,40,37,35,34,33, + 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +103,103,116,9,12,14,15,16,17,18,28,27,13,63,29,44,126,21,126,40,37,35,34,33, + 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,64,3,3,221, +103,103,116,9,12,14,15,16,17,18,28,27,13,65,29,71,21,30,31,69,69,29,26,25, + 24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,3,3,1,2,66,3,3,220, +103,103,116,9,12,14,15,16,17,18,28,27,13,67,29,71,21,30,31,64,64,29,26,25, + 24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,3,3,1,2,68,3,3,219, +103,103,116,9,12,14,15,16,17,18,28,27,13,69,29,71,21,30,31,63,63,29,26,25, + 24,23,22,20,36,11,10,39,19, +103,103,116,9,12,14,15,16,17,18,28,27,13,70,29,71,21,127,30,31,127,127,29, + 26,25,24,23,22,20,36,11,10,39,19, +103,103,116,9,12,14,15,16,17,18,28,27,13,71,29,71,21,128,30,31,128,128,29, + 26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,72,3,3,216, +103,103,116,9,12,14,15,16,17,18,28,27,13,73,29,71,21,129,32,30,31,32,32,29, + 26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,3,3,1,2,74,3,3,215, +103,103,116,9,12,14,15,16,17,18,28,27,13,75,29,71,21,130,32,30,31,32,32,29, + 26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,76,3,3,214, +103,103,116,9,12,14,15,16,17,18,28,27,13,77,29,71,21,131,32,30,31,32,32,29, + 26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,3,3,1,2,78,3,3,213, +103,103,116,9,12,14,15,16,17,18,28,27,13,79,29,71,21,132,32,30,31,32,32,29, + 26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,80,3,3,212, +103,103,116,9,12,14,15,16,17,18,28,27,13,81,29,71,21,133,33,32,30,31,32,32, + 29,26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,82,3,3,211, +103,103,116,9,12,14,15,16,17,18,28,27,13,83,29,71,21,134,33,32,30,31,32,32, + 29,26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,84,3,3,210, +103,103,116,9,12,14,15,16,17,18,28,27,13,85,29,71,21,135,34,33,32,30,31,32, + 32,29,26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,86,3,3,209, +103,103,116,9,12,14,15,16,17,18,28,27,13,87,29,71,21,136,35,34,33,32,30,31, + 32,32,29,26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,3,3,1,2,88,3,3,208, +103,103,116,9,12,14,15,16,17,18,28,27,13,89,29,44,137,21,137,40,37,35,34,33, + 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,90,3,3,206, +103,103,116,9,12,14,15,16,17,18,28,27,13,91,29,44,44,21,44,40,37,35,34,33, + 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,92,3,3,205, +103,103,116,9,12,14,15,16,17,18,28,27,13,93,29,44,43,21,43,40,37,35,34,33, + 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,94,3,3,204, +103,103,116,9,12,14,15,16,17,18,28,27,13,95,29,44,42,21,42,40,37,35,34,33, + 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,96,3,3,203, +103,103,116,9,12,14,15,16,17,18,28,27,13,97,29,44,41,21,41,40,37,35,34,33, + 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,3,3,1,2,98,3,3,201, +103,103,116,9,12,14,15,16,17,18,28,27,13,99,29,44,40,21,40,40,37,35,34,33, + 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,138,100,113,138,113, + 100,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,38,41,116,101,33, + 32,113,116,32,115,113,114,112,100,113,113,113,113,113,113,113,113,113, + 113,113,113,113,113,113, +103,103,116,9,12,14,15,16,17,18,28,27,13,102,29,44,139,21,139,40,37,35,34, + 33,32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +13,103,141,35,140, +103,103,116,9,12,14,15,16,17,18,28,27,13,42,105,38,41,43,104,29,44,5,5,46, + 34,5,5,49,48,22,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31,32,32,29, + 26,25,24,23,22,20,36,11,10,39,19, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,191,191,191,191,3,3,1,2,191,105,3,3,197, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 3,3,1,2,106,3,3,233, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 3,3,1,2,107,3,3,232, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,3,3,1,2,108,3,3,207, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 3,3,1,2,109,3,3,231, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 3,3,1,2,110,3,3,230, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 3,3,1,2,111,3,3,229, +106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,8,42,145,143,112,113, + 143,142,113,112,100,113,113,113,113,113,113,113,113,113,113,144,144,145, + 113,113,113,113,113, +106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,9,94,93,112,100,92, + 92,92,92,92,92,92,92,92,92,92,92,92,92,92, +13,114,146,100, +13,115,147,100, +43,116,10, +148,7,149, +148,18,150, +120,119,151, +120,120,152, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2, + 191,121,3,3,199, +121,122,76, +121,123,75, +121,124,74, +121,125,73, +121,126,72, +66,68,61,69,67, +66,68,60,69,67, +28,27,58,71,70, +28,27,57,71,70, +28,27,56,71,70, +28,27,55,71,70, +72,74,76,78,53,79,77,75,73, +72,74,76,78,52,79,77,75,73, +80,82,50,83,81, +84,48,85, +108,137,153, +121,138,95, +121,139,31, +103,103,116,9,12,14,15,16,17,18,28,27,13,42,38,41,43,140,29,44,37,37,46,34, + 37,37,49,48,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31,32,32,29,26,25, + 24,23,22,20,36,11,10,39,19, +103,103,116,9,12,14,15,16,17,18,28,27,13,141,29,44,154,21,154,40,37,35,34, + 33,32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +105,142,102, +43,143,96, +106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,8,100,143,144,113,143, + 113,100,113,113,113,113,113,113,113,113,113,113,98,113,113,113,113,113, +105,145,101, +106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,38,41,116,146,16, + 13,113,116,13,115,113,114,112,100,113,113,113,113,113,113,113,113,113, + 113,113,113,113,113,113, +106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,38,41,116,147,14, + 14,155,113,116,155,115,113,114,112,100,113,113,113,113,113,113,113,113, + 113,113,113,113,113,113,113, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 191,191,191,191,191,191,3,3,1,2,148,3,3,194, +103,103,116,9,12,14,15,16,17,18,28,27,13,42,38,41,43,149,29,44,24,46,34,29, + 24,49,48,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31,32,32,29,26,25,24, + 23,22,20,36,11,10,39,19, +106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,38,41,116,150,28, + 23,113,116,23,115,113,114,112,100,113,113,113,113,113,113,113,113,113, + 113,113,113,113,113,113, +121,110, +121,109, +103,103,116,9,12,14,15,16,17,18,28,27,13,153,29,71,21,46,40,37,35,34,33,32, + 30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, +121,154,38, +148,7,156, +106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,38,41,116,156,15, + 12,113,116,12,115,113,114,112,100,113,113,113,113,113,113,113,113,113, + 113,113,113,113,113,113, + +}; + + +static const unsigned short ag_sbt[] = { + 0, 26, 52, 79, 85, 146, 169, 171, 195, 197, 200, 226, 228, 260, + 290, 299, 308, 317, 326, 335, 360, 387, 428, 431, 434, 437, 440, 443, + 475, 507, 510, 543, 576, 581, 586, 595, 600, 604, 607, 616, 646, 651, + 660, 694, 730, 741, 745, 748, 752, 812, 815, 819, 866, 923, 980, 982, + 985, 988, 993, 996,1037,1078,1119,1160,1201,1222,1255,1287,1320,1352, + 1385,1419,1453,1474,1509,1541,1576,1597,1632,1664,1699,1720,1756,1777, + 1813,1834,1871,1892,1930,1962,2003,2024,2065,2086,2127,2148,2189,2210, + 2251,2283,2324,2361,2407,2448,2453,2512,2549,2576,2603,2635,2662,2689, + 2716,2761,2798,2802,2806,2809,2812,2815,2818,2821,2865,2868,2871,2874, + 2877,2880,2885,2890,2895,2900,2905,2910,2919,2928,2933,2936,2939,2942, + 2945,3002,3043,3046,3049,3089,3092,3138,3185,3218,3274,3320,3322,3324, + 3364,3367,3370,3416 +}; + + +static const unsigned short ag_sbe[] = { + 22, 49, 76, 83, 103, 168, 170, 194, 196, 198, 224, 227, 256, 286, + 295, 304, 313, 322, 331, 356, 371, 400, 429, 432, 435, 438, 441, 471, + 503, 508, 523, 556, 578, 583, 590, 597, 603, 605, 612, 642, 648, 656, + 690, 726, 735, 742, 746, 749, 770, 813, 816, 839, 883, 940, 981, 983, + 986, 991, 994,1009,1050,1091,1132,1173,1218,1235,1283,1300,1348,1365, + 1398,1432,1470,1487,1537,1554,1593,1610,1660,1677,1716,1733,1773,1790, + 1830,1847,1888,1905,1958,1975,2020,2037,2082,2099,2144,2161,2206,2223, + 2279,2296,2341,2381,2420,2449,2471,2545,2572,2599,2631,2658,2685,2712, + 2736,2778,2799,2803,2807,2810,2813,2816,2819,2861,2866,2869,2872,2875, + 2878,2882,2887,2892,2897,2902,2907,2914,2923,2930,2934,2937,2940,2943, + 2962,3015,3044,3047,3068,3090,3112,3158,3214,3235,3294,3321,3323,3337, + 3365,3368,3390,3416 +}; + + +static const unsigned char ag_fl[] = { + 2,0,1,2,1,2,1,1,0,1,2,1,5,3,3,5,3,1,1,2,1,2,3,4,4,2,2,2,4,4,2,4,3,3,1, + 2,0,3,3,1,3,3,3,3,3,1,5,1,3,1,3,1,3,3,1,3,3,3,3,1,3,3,1,3,3,1,2,2,1,3, + 1,1,4,4,4,4,4,3,2,1,1,2,0,1,3,1,2,0,1,3,1,1,2,2,2,3,2,1,2,0,1,3,3,1,2, + 1,1,0,1,4,4,3,0,1,2,2,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,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 +}; + +static const unsigned char ag_ptt[] = { + 0, 6, 6, 4, 5, 5, 9, 9, 13, 13, 11, 11, 11, 11, 10, 10, 10, 8, + 8, 21, 21, 21, 21, 21, 21, 21, 20, 20, 20, 20, 20, 25, 27, 29, 32, 28, + 33, 33, 35, 22, 22, 22, 22, 22, 22, 36, 36, 42, 42, 45, 45, 47, 47, 47, + 49, 49, 49, 49, 49, 52, 52, 52, 57, 57, 57, 60, 60, 60, 63, 63, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 1, 75, 75, 76, 76, 1, 80, 80, 81, 81, 1, + 12, 12, 12, 12, 12, 17, 84, 85, 85, 86, 86, 15, 15, 87, 87,114,134, 92, + 92,134,134, 90, 97, 97, 90, 90, 94, 94, 96, 96, 93, 93, 72, 72, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 79, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 88, 88, 89, 89, 89,103,103,104,104, 14, 18, 16, 19, 24, + 23, 31, 30, 37, 3, 38, 39, 40, 41, 44, 43, 46, 48, 50, 51, 53, 54, 55, + 56, 58, 59, 61, 62, 65, 2, 66, 67, 68, 69, 70, 71,101, 95, 98,102, 91 +}; + +static const unsigned char *ag_valid(PCB_DECL, int ag_k) { + const unsigned char *ag_tp = &ag_tstt[ag_sbt[(PCB).sn+1]]; + while (*--ag_tp != (unsigned char) ag_k) if (*ag_tp == 0) return NULL; + return ag_tp; +} + +int asi_change_reduction(PCB_DECL, asi_token_type ag_k) { + if (!ag_valid(PCB_POINTER, ag_k)) return 0; + (PCB).reduction_token = ag_k; + return 1; +} + +static void ag_default(PCB_DECL, const int *ag_tp) { + (PCB).ag_dsn = (PCB).sn; + (PCB).ag_dtl = ag_tp; + while (!ag_valid(PCB_POINTER, (asi_token_type) *ag_tp)) ag_tp++; + (PCB).reduction_token = (asi_token_type) *ag_tp; +} + + + +static void ag_ra(PCB_DECL) +{ + switch(ag_rpx[(PCB).ag_ap]) { + case 1: ag_default(PCB_POINTER, &ag_rtt[0]); ag_rp_1(PCB_POINTER, V(2,(double *))); break; + case 2: ag_rp_2(PCB_POINTER, V(0,(Location *))); break; + case 3: ag_rp_3(PCB_POINTER, V(0,(Location *))); break; + case 4: V(0,(Location *)) = ag_rp_4(PCB_POINTER); break; + case 5: ag_rp_5(PCB_POINTER); break; + case 6: ag_rp_6(PCB_POINTER); break; + case 7: ag_default(PCB_POINTER, &ag_rtt[3]); ag_rp_7(PCB_POINTER, V(1,(double *))); break; + case 8: V(0,(double *)) = ag_rp_8(PCB_POINTER, V(0,(double * *)), V(2,(double *))); break; + case 9: V(0,(double *)) = ag_rp_9(PCB_POINTER, V(0,(double * *)), V(2,(double *))); break; + case 10: V(0,(double *)) = ag_rp_10(PCB_POINTER, V(0,(double * *)), V(2,(double *))); break; + case 11: V(0,(double *)) = ag_rp_11(PCB_POINTER, V(0,(double * *)), V(2,(double *))); break; + case 12: V(0,(double *)) = ag_rp_12(PCB_POINTER, V(0,(double * *)), V(2,(double *))); break; + case 13: V(0,(double *)) = ag_rp_13(PCB_POINTER, V(0,(double *)), V(2,(double *)), V(4,(double *))); break; + case 14: V(0,(double *)) = ag_rp_14(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 15: V(0,(double *)) = ag_rp_15(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 16: V(0,(double *)) = ag_rp_16(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 17: V(0,(double *)) = ag_rp_17(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 18: V(0,(double *)) = ag_rp_18(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 19: V(0,(double *)) = ag_rp_19(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 20: V(0,(double *)) = ag_rp_20(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 21: V(0,(double *)) = ag_rp_21(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 22: V(0,(double *)) = ag_rp_22(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 23: V(0,(double *)) = ag_rp_23(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 24: V(0,(double *)) = ag_rp_24(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 25: V(0,(double *)) = ag_rp_25(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 26: V(0,(double *)) = ag_rp_26(PCB_POINTER, V(1,(double *))); break; + case 27: V(0,(double *)) = ag_rp_27(PCB_POINTER, V(1,(double *))); break; + case 28: V(0,(double *)) = ag_rp_28(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 29: V(0,(double *)) = ag_rp_29(PCB_POINTER, V(0,(double * *))); break; + case 30: V(0,(double *)) = ag_rp_30(PCB_POINTER, V(2,(double *))); break; + case 31: V(0,(double *)) = ag_rp_31(PCB_POINTER, V(2,(double *))); break; + case 32: V(0,(double *)) = ag_rp_32(PCB_POINTER, V(2,(double *))); break; + case 33: V(0,(double *)) = ag_rp_33(PCB_POINTER, V(2,(double *))); break; + case 34: V(0,(double *)) = ag_rp_34(PCB_POINTER, V(2,(double *))); break; + case 35: V(0,(double *)) = ag_rp_35(PCB_POINTER, V(1,(double *))); break; + case 36: V(0,(double *)) = ag_rp_36(PCB_POINTER, V(1,(double *))); break; + case 37: V(0,(int *)) = ag_rp_37(PCB_POINTER, V(0,(int *))); break; + case 38: V(0,(int *)) = ag_rp_38(PCB_POINTER, V(0,(int *)), V(1,(int *))); break; + case 39: V(0,(double * *)) = ag_rp_39(PCB_POINTER, V(0,(int *))); break; + case 40: V(0,(double *)) = ag_rp_40(PCB_POINTER, V(0,(double *)), V(3,(int *))); break; + case 41: V(0,(double *)) = ag_rp_41(PCB_POINTER, V(0,(double *)), V(3,(int *))); break; + case 42: V(0,(double *)) = ag_rp_42(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 43: V(0,(double *)) = ag_rp_43(PCB_POINTER, V(1,(double *))); break; + case 44: V(0,(double *)) = ag_rp_44(PCB_POINTER, V(0,(int *))); break; + case 45: V(0,(double *)) = ag_rp_45(PCB_POINTER, V(0,(double *)), V(1,(int *))); break; + case 46: V(0,(double *)) = ag_rp_46(PCB_POINTER, V(0,(int *))); break; + case 47: V(0,(double *)) = ag_rp_47(PCB_POINTER, V(0,(int *)), V(1,(double *))); break; + case 48: V(0,(int *)) = ag_rp_48(PCB_POINTER, V(0,(int *))); break; + case 49: V(0,(int *)) = ag_rp_49(PCB_POINTER, V(0,(int *)), V(1,(int *))); break; + } + (PCB).la_ptr = (PCB).pointer; +} + +#define TOKEN_NAMES asi_token_names +const char *const asi_token_names[146] = { + "input string", + "white space", + "real", + "name", + "input string", + "statements", + "", + "eof", + "statement", + "skip statement", + "skip open statement", + "skip closed statement", + "statement text", + "", + "';'", + "balanced braces", + "\"if\"", + "balanced parens", + "\"else\"", + "\"while\"", + "open statement", + "closed statement", + "expression", + "'{'", + "'}'", + "true if condition", + "false if condition", + "closed while", + "execute while", + "open while", + "'('", + "')'", + "while", + "while loop", + "false while condition", + "true while condition", + "conditional expression", + "'='", + "\"+=\"", + "\"-=\"", + "\"*=\"", + "\"/=\"", + "logical or expression", + "'\\?'", + "':'", + "logical and expression", + "\"||\"", + "equality expression", + "\"&&\"", + "relational expression", + "\"==\"", + "\"!=\"", + "additive expression", + "'<'", + "\"<=\"", + "'>'", + "\">=\"", + "multiplicative expression", + "'+'", + "'-'", + "unary expression", + "'*'", + "'/'", + "factor", + "primary", + "\"**\"", + "\"log\"", + "\"exp\"", + "\"sin\"", + "\"cos\"", + "\"tan\"", + "'!'", + "blank", + "\"/*\"", + "", + "", + "", + "\"*/\"", + "\"//\"", + "", + "", + "", + "'\\n'", + "statement char", + "", + "", + "", + "name string", + "letter", + "", + "simple real", + "", + "", + "exponent", + "integer part", + "'.'", + "fraction part", + "", + "digit", + "", + "", + "", + "", + "", + "", + "';'", + "\"else\"", + "\"if\"", + "\"while\"", + "'}'", + "'{'", + "')'", + "'('", + "'='", + "name", + "\"+=\"", + "\"-=\"", + "\"*=\"", + "\"/=\"", + "':'", + "'\\?'", + "\"||\"", + "\"&&\"", + "\"==\"", + "\"!=\"", + "'<'", + "\"<=\"", + "'>'", + "\">=\"", + "'+'", + "'-'", + "'*'", + "'/'", + "\"**\"", + "real", + "\"log\"", + "\"exp\"", + "\"sin\"", + "\"cos\"", + "\"tan\"", + "'!'", + "", + "'.'", + "digit", + "", + "", + +}; + +#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 = (asi_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 == (asi_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 = (asi_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 == (asi_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 = (asi_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 = (asi_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 = (asi_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; + (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; + (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 = (asi_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 (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); + if (ag_tstt[ag_t1] != (PCB).reduction_token) { + (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; + REDUCTION_TOKEN_ERROR; break;} + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_s_procs_scan[ag_astt[ag_t1]])(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 (PCB).ss[(PCB).ssx] = (PCB).sn; + ag_track(PCB_POINTER); + (PCB).reduction_token = (asi_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); + if (ag_tstt[ag_t1] != (PCB).reduction_token) { + (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; + REDUCTION_TOKEN_ERROR; break;} + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_s_procs_scan[ag_astt[ag_t1]])(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 { + (PCB).ss[(PCB).ssx] = (PCB).sn; + } + (PCB).la_ptr = (PCB).pointer; + (PCB).reduction_token = (asi_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); + if (ag_tstt[ag_t1] != (PCB).reduction_token) { + (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; + REDUCTION_TOKEN_ERROR; break;} + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_r_procs_scan[ag_astt[ag_t1]])(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 = (asi_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; + (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); + if (ag_tstt[ag_t1] != (PCB).reduction_token) { + (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; + REDUCTION_TOKEN_ERROR; break;} + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_r_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; + } + return (PCB).exit_flag == AG_RUNNING_CODE; +} + + +void init_asi(asi_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 asi(asi_pcb_type *PCB_POINTER) { + init_asi(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 = (asi_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); + } +} + +