Mercurial > ~dholland > hg > ag > index.cgi
diff tests/agcl/oldagsrc/good/bciastp.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/bciastp.cpp Sat Dec 22 17:52:45 2007 -0500 @@ -0,0 +1,1913 @@ +/* + BCIAST.SYN + + Compiler for Byte Code Interpreter (using parse tree) + Copyright (c) 1997 Parsifal Software, All Rights Reserved. + + 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 + Built-in functions LOG, EXP + + 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. + + vmParse makes the following external calls: + void pushChar(int character); + Push the specified character onto a character stack. + + int locateVariable(int nameLength); + Pop the last nameLength characters from the character stack + and, treating them as the name of a variable, return an + index into the variable array. + + Overrides for macros defined by AnaGram, such as SYNTAX_ERROR + are included in VMDEFS.H + + VMPT.SYN is compiled with the AnaGram parser generator + yielding VMPT.H and VMPT.CPP. + + To build VMPT, compile and link VMPT.CPP, VMDEMO.CPP and PTREE.CPP + with your C++ compiler. + + For information about AnaGram, visit http://www.parsifalsoft.com. +*/ + +#include "bciast.h" +#include "agstk.h" // Defines AgStack<Object> +#include "agstr.h" // Defines AgString et al +#include <math.h> // for pow() +#include "ptree.h" + +//typedef AgStack<Statement *> StatementList; + + +/* + * 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 BCIASTP_H +#include "bciastp.h" +#endif + +#ifndef BCIASTP_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 astParse_pcb_type +#endif + + +#define PCB (*pcb_pointer) +#define PCB_DECL PCB_TYPE *pcb_pointer +#define PCB_POINTER pcb_pointer + +Program * astParse_value(PCB_DECL); + +static void ag_delete_wrappers(PCB_DECL); +#ifndef DELETE_WRAPPERS +#define DELETE_WRAPPERS ag_delete_wrappers(PCB_POINTER) +#endif + +/* Line -, bciastp.syn */ + // begin embedded C + +void ag_delete_wrappers(astParse_pcb_struct *); + +void parseStatements(AbstractSyntaxTree *tree, char *text) { + astParse_pcb_struct pcb; + pcb.ast = tree; + pcb.pointer = (unsigned char *) text; + astParse(&pcb); + if (pcb.exit_flag == AG_SUCCESS_CODE) tree->setRoot(astParse_value(&pcb)); + else ag_delete_wrappers(&pcb); +} + +#ifndef CONVERT_CASE +#define CONVERT_CASE(c) (c) +#endif +#ifndef TAB_SPACING +#define TAB_SPACING 8 +#endif +Program * astParse_value(PCB_DECL) { + Program * returnValue; + returnValue = (*(Program * *) &(PCB).vs[(PCB).ssx]); + return returnValue; +} + +static inline Program * ag_rp_1(PCB_DECL, AgStack<Statement *> &s) { +/* Line -, bciastp.syn */ + return PCB.ast->makeProgram(s); +} + +static inline AgStack<Statement *> ag_rp_2(PCB_DECL) { +/* Line -, bciastp.syn */ + return AgStack<Statement *>(); +} + +static inline AgStack<Statement *> ag_rp_3(PCB_DECL, AgStack<Statement *> &s, Statement * x) { +/* Line -, bciastp.syn */ + return s.push(x); +} + +static inline Statement * ag_rp_4(PCB_DECL, Expression * x, Statement * s) { +/* Line -, bciastp.syn */ + return PCB.ast->makeIfStatement(x, s); +} + +static inline Statement * ag_rp_5(PCB_DECL, Expression * x, Statement * s1, Statement * s2) { +/* Line -, bciastp.syn */ + return PCB.ast->makeIfElseStatement(x,s1,s2); +} + +static inline Statement * ag_rp_6(PCB_DECL, Expression * x, Statement * s) { +/* Line -, bciastp.syn */ + return PCB.ast->makeWhileStatement(x,s); +} + +static inline Statement * ag_rp_7(PCB_DECL, Expression * init, Expression * cond, Expression * inc, Statement * s) { +/* Line -, bciastp.syn */ + return PCB.ast->makeForStatement(init, cond, inc, s); +} + +static inline Statement * ag_rp_8(PCB_DECL, Expression * x, Statement * s1, Statement * s2) { +/* Line -, bciastp.syn */ + return PCB.ast->makeIfElseStatement(x,s1,s2); +} + +static inline Statement * ag_rp_9(PCB_DECL, Expression * x, Statement * s) { +/* Line -, bciastp.syn */ + return PCB.ast->makeWhileStatement(x,s); +} + +static inline Statement * ag_rp_10(PCB_DECL, Expression * init, Expression * cond, Expression * inc, Statement * s) { +/* Line -, bciastp.syn */ + return PCB.ast->makeForStatement(init, cond, inc, s); +} + +static inline Statement * ag_rp_11(PCB_DECL, Statement * x) { +/* Line -, bciastp.syn */ + return x; +} + +static inline Statement * ag_rp_12(PCB_DECL, Statement * s, Expression * x) { +/* Line -, bciastp.syn */ + return PCB.ast->makeDoStatement(s,x); +} + +static inline Statement * ag_rp_13(PCB_DECL, Expression * x) { +/* Line -, bciastp.syn */ + return PCB.ast->makeExpressionStatement(x); +} + +static inline Statement * ag_rp_14(PCB_DECL) { +/* Line -, bciastp.syn */ + return PCB.ast->makeStatement(); +} + +static inline Statement * ag_rp_15(PCB_DECL, AgStack<Statement *> &s) { +/* Line -, bciastp.syn */ + return PCB.ast->makeStatementBlock(s); +} + +static inline Expression * ag_rp_16(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeCommaExpression(x,y); +} + +static inline Expression * ag_rp_17(PCB_DECL, AgString &k, Expression * x) { +/* Line -, bciastp.syn */ + return PCB.ast->makeSimpleAssignment(k, x); +} + +static inline Expression * ag_rp_18(PCB_DECL, AgString &k, Expression * x) { +/* Line -, bciastp.syn */ + return PCB.ast->makeAddMemory(k, x); +} + +static inline Expression * ag_rp_19(PCB_DECL, AgString &k, Expression * x) { +/* Line -, bciastp.syn */ + return PCB.ast->makeSubMemory(k, x); +} + +static inline Expression * ag_rp_20(PCB_DECL, AgString &k, Expression * x) { +/* Line -, bciastp.syn */ + return PCB.ast->makeMulMemory(k, x); +} + +static inline Expression * ag_rp_21(PCB_DECL, AgString &k, Expression * x) { +/* Line -, bciastp.syn */ + return PCB.ast->makeDivMemory(k, x); +} + +static inline Expression * ag_rp_22(PCB_DECL, Expression * c, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeConditionalExpression(c,x,y); +} + +static inline Expression * ag_rp_23(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeLogicalOrExpression(x, y); +} + +static inline Expression * ag_rp_24(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeLogicalAndExpression(x,y); +} + +static inline Expression * ag_rp_25(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeEqExpression(x,y); +} + +static inline Expression * ag_rp_26(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeNeExpression(x,y); +} + +static inline Expression * ag_rp_27(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeLtExpression(x,y); +} + +static inline Expression * ag_rp_28(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeLeExpression(x,y); +} + +static inline Expression * ag_rp_29(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeGtExpression(x,y); +} + +static inline Expression * ag_rp_30(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeGeExpression(x,y); +} + +static inline Expression * ag_rp_31(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeAddExpression(x,y); +} + +static inline Expression * ag_rp_32(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeSubExpression(x,y); +} + +static inline Expression * ag_rp_33(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeMulExpression(x,y); +} + +static inline Expression * ag_rp_34(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makeDivExpression(x,y); +} + +static inline Expression * ag_rp_35(PCB_DECL, Expression * x) { +/* Line -, bciastp.syn */ + return PCB.ast->makeNegExpression(x); +} + +static inline Expression * ag_rp_36(PCB_DECL, Expression * x) { +/* Line -, bciastp.syn */ + return x; +} + +static inline Expression * ag_rp_37(PCB_DECL, Expression * x) { +/* Line -, bciastp.syn */ + return PCB.ast->makeNotExpression(x); +} + +static inline Expression * ag_rp_38(PCB_DECL, Expression * x, Expression * y) { +/* Line -, bciastp.syn */ + return PCB.ast->makePowExpression(x,y); +} + +static inline Expression * ag_rp_39(PCB_DECL, double x) { +/* Line -, bciastp.syn */ + return PCB.ast->makeConstant(x); +} + +static inline Expression * ag_rp_40(PCB_DECL, AgString &k) { +/* Line -, bciastp.syn */ + return PCB.ast->makeVariable(k); +} + +static inline Expression * ag_rp_41(PCB_DECL, Expression * x) { +/* Line -, bciastp.syn */ + return PCB.ast->makeLogExpression(x); +} + +static inline Expression * ag_rp_42(PCB_DECL, Expression * x) { +/* Line -, bciastp.syn */ + return PCB.ast->makeExpExpression(x); +} + +static inline Expression * ag_rp_43(PCB_DECL, Expression * x) { +/* Line -, bciastp.syn */ + return PCB.ast->makeSqrtExpression(x); +} + +static inline Expression * ag_rp_44(PCB_DECL, Expression * x) { +/* Line -, bciastp.syn */ + return x; +} + +static inline double ag_rp_45(PCB_DECL, double x) { +/* Line -, bciastp.syn */ + return x; +} + +static inline double ag_rp_46(PCB_DECL, double x, int e) { +/* Line -, bciastp.syn */ + return x*pow(10,e); +} + +static inline double ag_rp_47(PCB_DECL, double x, int e) { +/* Line -, bciastp.syn */ + return x*pow(10,-e); +} + +static inline double ag_rp_48(PCB_DECL, double i, double f) { +/* Line -, bciastp.syn */ + return i+f; +} + +static inline double ag_rp_49(PCB_DECL, double i) { +/* Line -, bciastp.syn */ + return i; +} + +static inline double ag_rp_50(PCB_DECL, double f) { +/* Line -, bciastp.syn */ + return f; +} + +static inline double ag_rp_51(PCB_DECL, int d) { +/* Line -, bciastp.syn */ + return d-'0'; +} + +static inline double ag_rp_52(PCB_DECL, double x, int d) { +/* Line -, bciastp.syn */ + return 10*x + d-'0'; +} + +static inline double ag_rp_53(PCB_DECL, int d) { +/* Line -, bciastp.syn */ + return (d-'0')/10.; +} + +static inline double ag_rp_54(PCB_DECL, int d, double f) { +/* Line -, bciastp.syn */ + return (d-'0' + f)/10.; +} + +static inline int ag_rp_55(PCB_DECL, int d) { +/* Line -, bciastp.syn */ + return d-'0'; +} + +static inline int ag_rp_56(PCB_DECL, int x, int d) { +/* Line -, bciastp.syn */ + return 10*x + d-'0'; +} + +static inline AgString ag_rp_57(PCB_DECL, int c) { +/* Line -, bciastp.syn */ + return AgString().concat(c); +} + +static inline AgString ag_rp_58(PCB_DECL, AgString &s, int c) { +/* Line -, bciastp.syn */ + return s.concat(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, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 5, 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, 4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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<AgStack<Statement *> > +#undef AG_WRAP_5 +#define AG_WRAP_5 AgObjectWrapper<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; + default: break; + } + sn = (PCB).ss[sx]; + } +} + +static astParse_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, + 0, 16, 0, 17, 18, 19, 20, 21, 0, 22, 0, 23, 0, 24, 0, 25, 26, 0, + 27, 28, 29, 30, 0, 31, 32, 0, 33, 34, 0, 35, 36, 37, 0, 38, 39, 40, + 41, 42, 43, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, + 46, 47, 48, 0, 0, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58 +}; + +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,100,101,102,105,108,115,119,255, 42,255, 42, 61,255, + 42, 47, 61,255,108,120,255, 33, 38, 42, 43, 45, 47, 60, 61, 62,100,101, + 102,105,108,115,119,124,255,100,101,102,105,108,115,119,255, 42, 47,255, + 33, 38, 42, 47, 60, 61, 62,124,255, 42, 47,255, 47,101,108,115,255, 42, + 47,255, 47,255,101,108,115,255, 33, 38, 42, 60, 61, 62,124,255, 33, 38, + 60, 61, 62,124,255, 33, 38, 61,124,255, 38,124,255, 42, 61,255, 42, 47, + 61,255, 33, 38, 42, 43, 45, 47, 60, 61, 62,124,255,124,255, 42, 61,255, + 33, 38, 42, 43, 45, 47, 60, 61, 62,124,255, 42, 47,255,108,120,255, 47, + 100,101,102,105,108,115,119,255,119,255, 42, 47,255, 33, 38, 42, 47, 60, + 61, 62,100,101,102,105,108,115,119,124,255,108,120,255,100,101,102,105, + 108,115,119,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, + 4,0,0,4,2,4,3,3,3,4,3,3,3,3,3,3,3,4,3,3,3,3,3,3,4,3,3,3,3,4,3,3,4,0,0, + 4,0,0,0,4,3,3,2,3,3,2,3,3,3,3,4,3,4,0,0,4,3,3,2,3,3,3,3,3,3,3,4,0,0,4, + 3,3,4,2,3,2,3,3,3,3,3,4,3,4,0,0,4,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,4,3,3, + 4,3,2,3,3,3,3,3,4 +}; + +static const unsigned char ag_key_parm[] = { + 0, 59, 64, 0, 0, 92,120, 91, 87,119,121, 89, 0, 63, 0,117,100, 0, + 59, 64,101, 0, 88,120, 0,107,105, 0, 98, 99, 0,109,106,111, 92, 0, + 91, 87,119,121, 89,104, 0, 92,120, 91, 87,119,121, 89, 0, 59, 64, 0, + 107,105,117, 0,109,106,111,104, 0, 59, 64, 0, 0,120,119,121, 0, 59, + 64, 0, 0, 0,120,119,121, 0,107,105,117,109,106,111,104, 0,107,105, + 109,106,111,104, 0,107,105,106,104, 0,105,104, 0,117,100, 0, 59, 64, + 101, 0,107,105, 0, 98, 99, 0,109,106,111,104, 0,104, 0,117,100, 0, + 107,105, 0, 98, 99,101,109,106,111,104, 0, 59, 64, 0, 88,120, 0, 0, + 92, 0, 91, 87,119,121, 89, 0, 89, 0, 59, 64, 0,107,105,117, 0,109, + 106,111, 92,120, 91, 87,119,121, 89,104, 0, 88,120, 0, 92, 0, 91, 87, + 119,121, 89, 0 +}; + +static const unsigned short ag_key_jmp[] = { + 0, 0, 0, 0, 1, 0, 2, 5, 8, 10, 13, 17, 0, 22, 0, 0, 0, 0, + 0, 0, 0, 0, 40, 43, 0, 24, 26, 15, 28, 30, 18, 32, 34, 36, 38, 22, + 45, 48, 50, 53, 57, 62, 0, 64, 66, 69, 72, 74, 77, 81, 0, 0, 0, 0, + 86, 88, 90, 51, 92, 94, 96, 98, 0, 0, 0, 0, 63,100,103,106, 0, 0, + 0, 0, 71, 0,110,113,116, 0,120,122,124,126,128,130,132, 0,134,136, + 138,140,142,144, 0,146,148,150,152, 0,154,156, 0, 0, 0, 0, 0, 0, + 0, 0,158,160,103,162,164,106,166,168,170,172, 0,174, 0, 0, 0, 0, + 176,178,123,180,182,184,186,188,190,192, 0, 0, 0, 0,196,199, 0,137, + 194,140,201,204,206,209,213, 0,218, 0, 0, 0, 0,223,225,227,154,229, + 231,233,235,237,240,243,245,248,252,257, 0,261,264, 0,259,173,266,269, + 271,274,278, 0 +}; + +static const unsigned char ag_key_index[] = { + 4, 0, 13, 25, 43, 0, 0, 13, 13, 43, 0, 54, 54, 66, 74, 74, 74, 54, + 76, 0, 0, 0, 66, 66, 66, 80, 76, 76, 76, 88, 88, 88, 95,100,110,121, + 126, 4,143, 4, 43, 0, 43, 74, 74, 74, 0, 0, 0, 54, 54, 0, 0, 76, + 76, 76, 66, 76, 66, 76, 66, 76, 76, 76, 66, 76, 66, 76, 66, 76, 66, 76, + 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, + 66, 76, 43, 66, 76,152, 76, 76, 76, 0, 0,157, 0, 0, 0, 88, 88, 88, + 88, 88, 88, 88, 88, 95,100, 0,143, 0, 0, 0, 0, 54, 54, 66, 76, 76, + 76, 43, 43, 0, 0,176, 0, 76, 4, 43, 0, 43 +}; + +static const unsigned char ag_key_ends[] = { +111,0, 120,112,0, 111,114,0, 102,0, 111,103,0, 113,114,116,0, +104,105,108,101,0, 47,0, 61,0, 38,0, 61,0, 61,0, 61,0, 61,0, +61,0, 111,0, 115,101,0, 112,0, 111,114,0, 102,0, 111,103,0, +113,114,116,0, 104,105,108,101,0, 124,0, 111,0, 120,112,0, +111,114,0, 102,0, 111,103,0, 113,114,116,0, 104,105,108,101,0, +61,0, 38,0, 42,0, 61,0, 61,0, 61,0, 124,0, 120,112,0, +111,103,0, 113,114,116,0, 120,112,0, 111,103,0, 113,114,116,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, 38,0, 124,0, +61,0, 38,0, 61,0, 61,0, 61,0, 61,0, 61,0, 124,0, 124,0, +61,0, 38,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 124,0, 111,0, +115,101,0, 112,0, 111,114,0, 102,0, 111,103,0, 113,114,116,0, +104,105,108,101,0, 104,105,108,101,0, 61,0, 38,0, 42,0, 61,0, +61,0, 61,0, 111,0, 120,112,0, 111,114,0, 102,0, 111,103,0, +113,114,116,0, 104,105,108,101,0, 124,0, 111,0, 115,101,0, 112,0, +111,114,0, 102,0, 111,103,0, 113,114,116,0, 104,105,108,101,0, +}; + +#define AG_TCV(x) ag_tcv[(x)] + +static const unsigned char ag_tcv[] = { + 6, 81, 81, 81, 81, 81, 81, 81, 81, 80, 68, 80, 80, 80, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 80,116, 81, 81, + 81, 81, 81, 81, 86, 85,114,112, 95,113, 74,115, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77,102, 90,108, 96,110,103, 81, 82, 82, 82, 82, 70, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 81, 81, 81, 81, 82, 81, 82, 82, 82, 82, 70, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 94, 81, 93, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81 +}; + +#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 = (astParse_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 = (astParse_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 = (astParse_token_type) ag_key_pt[ag_k1+1]; + break; + } + case ag_set_key: + ag_save = (int) ((PCB).la_ptr - (PCB).pointer); + (PCB).token_number = (astParse_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 = (astParse_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 = (astParse_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 = (astParse_token_type) (PCB).drt; + (PCB).ssx = (PCB).dssx; + (PCB).sn = (PCB).dsn; + (PCB).drt = -1; +} + + +static const unsigned char ag_tstt[] = { +121,120,119,116,113,112,94,92,91,90,89,87,86,82,80,77,74,70,68,64,59,6,0,1, + 83,84, +116,115,114,113,112,110,108,103,102,96,95,94,93,90,86,85,82,81,80,77,74,70, + 68,0,66,67, +116,115,114,113,112,110,108,103,102,96,95,94,93,90,86,85,82,81,80,77,74,70, + 68,63,0,61,62, +80,68,64,59,0,1, +121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,74,70,6,0,4,5, +116,115,114,113,112,110,108,103,102,96,95,94,93,90,86,85,82,81,80,77,74,70, + 0, +68,0, +116,115,114,113,112,110,108,103,102,96,95,94,93,90,86,85,82,81,80,77,74,70, + 68,0, +63,0, +121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,74,70,6,0,2,3,7,8,9,10, + 11,12,15,16,17,18,19,20,22,24,30,33,35,37,40,45,46,47,48,51,52,53,55,56, + 57,69,73,97,118, +77,0,75, +117,115,114,113,112,111,110,109,108,107,106,105,104,103,102,95,90,85,80,77, + 74,70,68,64,59,0,76, +70,0, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +86,80,68,64,59,0,1,83,84, +86,80,68,64,59,0,1,83,84, +86,80,68,64,59,0,1,83,84, +117,115,114,113,112,111,110,109,108,107,106,105,104,103,102,95,90,85,80,68, + 64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45, + 46,47,48,51,52,53,55,56,57,69,73,97,118, +86,0,11, +86,0,11, +86,0,11, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +117,0,54, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,46,47,48,51,52,53,55,56,57, + 69,73,97,118, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,46,47,48,51,52,53,55,56,57, + 69,73,97,118, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,46,47,48,51,52,53,55,56,57, + 69,73,97,118, +115,114,0,49,50, +113,112,0,46,47, +111,110,109,108,0,41,42,43,44, +107,106,0,38,39, +105,0,36, +117,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,99,98, + 96,95,90,85,82,80,77,70,68,64,59,0,1,83,84, +104,103,0,31,34, +101,100,99,98,96,0,25,26,27,28,29, +121,120,119,116,113,112,94,93,92,91,90,89,87,86,82,80,77,74,70,68,64,59,0,1, + 83,84, +121,120,119,116,113,112,94,93,92,91,90,89,88,87,86,82,80,77,74,70,68,64,59, + 6,0,1,83,84, +121,120,119,116,113,112,94,92,91,90,89,87,86,82,80,77,74,70,68,64,59,0,1,83, + 84, +121,120,119,116,113,112,94,93,92,91,90,89,87,86,82,77,74,70,0,5, +95,90,0,17,23, +121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,74,70,0,2,3,7,8,9,10,11, + 12,15,16,17,18,19,20,22,24,30,33,35,37,40,45,46,47,48,51,52,53,55,56,57, + 69,73,97,118, +86,80,68,64,59,0,1,83,84, +86,80,68,64,59,0,1,83,84, +86,80,68,64,59,0,1,83,84, +86,0,11, +86,0,11, +86,0,11, +77,0,75, +77,0,75, +113,112,77,0,71, +95,85,0,13,23, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46, + 47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45, + 46,47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45, + 46,47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,46,47,48,51,52,53,55,56,57, + 69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,46,47,48,51,52,53,55,56,57, + 69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,46,47,48,51,52,53,55,56,57, + 69,73,97,118, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,45,46,47,48,51,52,53,55,56, + 57,69,73,97,118, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,45,46,47,48,51,52,53,55,56, + 57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,40,45,46,47,48,51,52,53,55, + 56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,40,45,46,47,48,51,52,53,55, + 56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,40,45,46,47,48,51,52,53,55, + 56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,40,45,46,47,48,51,52,53,55, + 56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,37,40,45,46,47,48,51,52,53, + 55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,37,40,45,46,47,48,51,52,53, + 55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,35,37,40,45,46,47,48,51,52, + 53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,33,35,37,40,45,46,47,48,51, + 52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45, + 46,47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46, + 47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46, + 47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46, + 47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46, + 47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46, + 47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,94,93,92,91,90,89,87,86,82,77,74,70,0,2,3,7,8,9,10, + 11,12,15,16,17,18,19,20,21,22,24,30,33,35,37,40,45,46,47,48,51,52,53,55, + 56,57,69,73,97,118, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46, + 47,48,51,52,53,55,56,57,69,73,97,118, +89,0,15, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45, + 46,47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45, + 46,47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45, + 46,47,48,51,52,53,55,56,57,69,73,97,118, +77,0,72, +77,0,72, +121,120,119,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102, + 95,94,92,91,90,89,87,86,85,82,80,77,74,70,68,64,59,0,1,83,84, +85,0,13, +95,85,0,13,23, +95,85,0,13,23, +115,114,0,49,50, +115,114,0,49,50, +113,112,0,46,47, +113,112,0,46,47, +113,112,0,46,47, +113,112,0,46,47, +111,110,109,108,0,41,42,43,44, +111,110,109,108,0,41,42,43,44, +107,106,0,38,39, +105,0,36, +102,95,0,23,32, +121,120,119,116,113,112,94,93,92,91,90,89,88,87,86,82,80,77,74,70,68,64,59, + 6,0,1,83,84, +86,0,11, +95,90,0,17,23, +95,85,0,13,23, +95,85,0,13,23, +77,0, +77,0, +121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,24,30,33,35,37,40,45,46,47, + 48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45, + 46,47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45, + 46,47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,74,70,0,2,3,8,9,10,11,12, + 15,16,17,18,19,20,22,24,30,33,35,37,40,45,46,47,48,51,52,53,55,56,57,69, + 73,97,118, +121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,74,70,0,2,3,7,8,9,10,11, + 12,15,16,17,18,19,20,22,24,30,33,35,37,40,45,46,47,48,51,52,53,55,56,57, + 69,73,97,118, +95,85,0,13,23, +95,90,0,17,23, +88,0,14, +90,0,17, +121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45, + 46,47,48,51,52,53,55,56,57,69,73,97,118, +121,120,119,116,113,112,94,92,91,90,89,87,86,82,80,77,74,70,68,64,59,0,1,83, + 84, +121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,74,70,0,2,3,8,9,10,11,12, + 15,16,17,18,19,20,22,24,30,33,35,37,40,45,46,47,48,51,52,53,55,56,57,69, + 73,97,118, +95,85,0,13,23, +121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,74,70,0,2,3,8,9,10,11,12, + 15,16,17,18,19,20,22,24,30,33,35,37,40,45,46,47,48,51,52,53,55,56,57,69, + 73,97,118, + +}; + + +static unsigned const char ag_astt[2644] = { + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,1,8,8,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,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,4,4,4,4,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,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,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,7,2,1,2,2,2,1,1,1,1, + 1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,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,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, +140,140,1,2,142,140, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,0,9, +65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,67, +68,6, +60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,62, +63,8, +14,15,16,22,24,23,37,39,43,38,44,45,13,85,79,10,85,1,9,52,36,3,3,3,48,18,41, + 47,46,16,13,42,40,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20,19,12, + 11,34,17, +49,10,78, +75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,80,50,75,75,75,75, + 11,77, +51,69, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,13,3,3,144, +141,3,3,1,2,14,3,3,179, +141,3,3,1,2,15,3,3,178, +141,3,3,1,2,16,3,3,177, +141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,3,3, + 1,2,17,3,3,176, +14,15,16,22,24,23,13,85,79,10,85,18,52,36,18,52,52,52,35,33,32,31,30,29,27, + 28,29,29,26,25,21,20,19,12,11,34,17, +13,19,53, +13,20,54, +13,21,55, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,22,3,3,174, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,23,3,3,170, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,24,3,3,171, +56,50,57, +14,15,16,22,24,23,13,85,79,10,85,26,52,53,18,27,28,49,49,26,25,21,20,19,12, + 11,34,17, +14,15,16,22,24,23,13,85,79,10,85,27,52,53,18,27,28,48,48,26,25,21,20,19,12, + 11,34,17, +14,15,16,22,24,23,13,85,79,10,85,28,52,53,18,27,28,47,47,26,25,21,20,19,12, + 11,34,17, +58,60,40,61,59, +24,23,35,63,62, +64,66,68,70,32,71,69,67,65, +72,74,30,75,73, +76,28,77, +141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141, + 141,141,141,141,86,3,86,86,3,1,2,34,3,3,155, +78,80,26,81,79, +82,84,86,88,90,53,91,89,87,85,83, +141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,3,141,141,141,3, + 1,2,37,3,3,152, +141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,3,141,141, + 141,3,1,2,141,38,3,3,148, +141,141,141,141,141,141,141,141,141,141,141,141,141,141,3,141,141,141,3,1,2, + 39,3,3,150, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,40,92, +93,38,41,15,94, +14,15,16,22,24,23,37,39,43,38,44,45,13,85,79,10,85,42,52,36,95,95,95,48,18, + 41,47,46,16,13,42,40,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20,19, + 12,11,34,17, +141,3,3,1,2,43,3,3,149, +141,3,3,1,2,44,3,3,147, +141,3,3,1,2,45,3,3,145, +13,46,96, +13,47,97, +13,48,98, +49,81,82, +49,76,74, +99,100,100,51,100, +93,101,52,57,94, +14,15,16,22,24,23,13,85,79,10,85,53,52,36,18,102,102,35,33,32,31,30,29,27, + 28,29,29,26,25,21,20,19,12,11,34,17, +14,15,16,22,24,23,13,85,79,10,85,54,52,36,18,103,103,103,35,33,32,31,30,29, + 27,28,29,29,26,25,21,20,19,12,11,34,17, +14,15,16,22,24,23,13,85,79,10,85,55,52,36,18,104,104,104,35,33,32,31,30,29, + 27,28,29,29,26,25,21,20,19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,56,3,3,175, +14,15,16,22,24,23,13,85,79,10,85,57,52,53,18,27,28,51,51,26,25,21,20,19,12, + 11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,58,3,3,173, +14,15,16,22,24,23,13,85,79,10,85,59,52,53,18,27,28,45,45,26,25,21,20,19,12, + 11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,60,3,3,172, +14,15,16,22,24,23,13,85,79,10,85,61,52,53,18,27,28,44,44,26,25,21,20,19,12, + 11,34,17, +14,15,16,22,24,23,13,85,79,10,85,62,52,53,18,105,27,28,105,105,26,25,21,20, + 19,12,11,34,17, +14,15,16,22,24,23,13,85,79,10,85,63,52,53,18,106,27,28,106,106,26,25,21,20, + 19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,64,3,3,169, +14,15,16,22,24,23,13,85,79,10,85,65,52,53,18,107,29,27,28,29,29,26,25,21,20, + 19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,66,3,3,168, +14,15,16,22,24,23,13,85,79,10,85,67,52,53,18,108,29,27,28,29,29,26,25,21,20, + 19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,68,3,3,167, +14,15,16,22,24,23,13,85,79,10,85,69,52,53,18,109,29,27,28,29,29,26,25,21,20, + 19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,70,3,3,166, +14,15,16,22,24,23,13,85,79,10,85,71,52,53,18,110,29,27,28,29,29,26,25,21,20, + 19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,72,3,3,165, +14,15,16,22,24,23,13,85,79,10,85,73,52,53,18,111,30,29,27,28,29,29,26,25,21, + 20,19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,74,3,3,164, +14,15,16,22,24,23,13,85,79,10,85,75,52,53,18,112,30,29,27,28,29,29,26,25,21, + 20,19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,76,3,3,163, +14,15,16,22,24,23,13,85,79,10,85,77,52,53,18,113,31,30,29,27,28,29,29,26,25, + 21,20,19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,78,3,3,162, +14,15,16,22,24,23,13,85,79,10,85,79,52,53,18,114,32,31,30,29,27,28,29,29,26, + 25,21,20,19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,80,3,3,161, +14,15,16,22,24,23,13,85,79,10,85,81,52,36,18,115,115,115,35,33,32,31,30,29, + 27,28,29,29,26,25,21,20,19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,82,3,3,159, +14,15,16,22,24,23,13,85,79,10,85,83,52,36,18,25,25,35,33,32,31,30,29,27,28, + 29,29,26,25,21,20,19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,84,3,3,158, +14,15,16,22,24,23,13,85,79,10,85,85,52,36,18,24,24,35,33,32,31,30,29,27,28, + 29,29,26,25,21,20,19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,86,3,3,157, +14,15,16,22,24,23,13,85,79,10,85,87,52,36,18,23,23,35,33,32,31,30,29,27,28, + 29,29,26,25,21,20,19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,88,3,3,156, +14,15,16,22,24,23,13,85,79,10,85,89,52,36,18,22,22,35,33,32,31,30,29,27,28, + 29,29,26,25,21,20,19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,90,3,3,154, +14,15,16,22,24,23,13,85,79,10,85,91,52,36,18,21,21,35,33,32,31,30,29,27,28, + 29,29,26,25,21,20,19,12,11,34,17, +14,15,16,22,24,23,37,116,39,43,38,44,45,13,85,79,10,85,92,52,36,3,3,3,48,18, + 41,47,46,16,13,42,40,17,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20, + 19,12,11,34,17, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,93,3,3,153, +14,15,16,22,24,23,13,85,79,10,85,94,52,36,18,19,19,35,33,32,31,30,29,27,28, + 29,29,26,25,21,20,19,12,11,34,17, +44,95,117, +14,15,16,22,24,23,13,85,79,10,85,96,52,36,18,118,118,118,35,33,32,31,30,29, + 27,28,29,29,26,25,21,20,19,12,11,34,17, +14,15,16,22,24,23,13,85,79,10,85,97,52,36,18,119,119,119,35,33,32,31,30,29, + 27,28,29,29,26,25,21,20,19,12,11,34,17, +14,15,16,22,24,23,13,85,79,10,85,98,52,36,18,120,120,120,35,33,32,31,30,29, + 27,28,29,29,26,25,21,20,19,12,11,34,17, +83,99,121, +83,100,122, +141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141, + 141,141,141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,101,3,3,143, +101,102,56, +93,101,103,55,94, +93,101,104,54,94, +58,60,42,61,59, +58,60,41,61,59, +24,23,39,63,62, +24,23,38,63,62, +24,23,37,63,62, +24,23,36,63,62, +64,66,68,70,34,71,69,67,65, +64,66,68,70,33,71,69,67,65, +72,74,31,75,73, +76,29,77, +123,93,115,94,124, +141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,3,141,141, + 141,3,1,2,141,116,3,3,151, +13,117,125, +93,38,118,126,94, +93,101,119,127,94, +93,101,120,128,94, +84,73, +84,72, +141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,123,3,3,160, +14,15,16,22,24,23,13,85,79,10,85,124,52,53,18,27,35,33,32,31,30,29,27,28,29, + 29,26,25,21,20,19,12,11,34,17, +14,15,16,22,24,23,13,85,79,10,85,125,52,36,18,129,129,129,35,33,32,31,30,29, + 27,28,29,29,26,25,21,20,19,12,11,34,17, +14,15,16,22,24,23,13,85,79,10,85,126,52,36,18,130,130,130,35,33,32,31,30,29, + 27,28,29,29,26,25,21,20,19,12,11,34,17, +14,15,16,22,24,23,37,39,43,38,44,45,13,85,79,10,85,127,52,36,11,8,48,18,41, + 47,46,16,13,42,40,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20,19,12, + 11,34,17, +14,15,16,22,24,23,37,39,43,38,44,45,13,85,79,10,85,128,52,36,6,131,6,48,18, + 41,47,46,16,13,42,40,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20,19, + 12,11,34,17, +93,101,129,132,94, +93,38,130,133,94, +134,4,135, +38,132,14, +14,15,16,22,24,23,13,85,79,10,85,133,52,36,18,136,136,136,35,33,32,31,30,29, + 27,28,29,29,26,25,21,20,19,12,11,34,17, +141,141,141,141,141,141,141,141,141,141,141,141,141,141,3,141,141,141,3,1,2, + 134,3,3,146, +14,15,16,22,24,23,37,39,43,38,44,45,13,85,79,10,85,135,52,36,10,7,48,18,41, + 47,46,16,13,42,40,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20,19,12, + 11,34,17, +93,101,136,137,94, +14,15,16,22,24,23,37,39,43,38,44,45,13,85,79,10,85,137,52,36,12,9,48,18,41, + 47,46,16,13,42,40,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20,19,12, + 11,34,17, + +}; + + +static const unsigned short ag_sbt[] = { + 0, 26, 52, 79, 85, 106, 129, 131, 155, 157, 211, 214, 241, 243, + 262, 271, 280, 289, 315, 352, 355, 358, 361, 380, 399, 418, 421, 449, + 477, 505, 510, 515, 524, 529, 532, 566, 571, 582, 608, 636, 661, 681, + 686, 739, 748, 757, 766, 769, 772, 775, 778, 781, 786, 791, 827, 864, + 901, 920, 948, 967, 995,1014,1042,1071,1100,1119,1149,1168,1198,1217, + 1247,1266,1296,1315,1346,1365,1396,1415,1447,1466,1499,1518,1555,1574, + 1610,1629,1665,1684,1720,1739,1775,1794,1830,1885,1904,1940,1943,1980, + 2017,2054,2057,2060,2100,2103,2108,2113,2118,2123,2128,2133,2138,2143, + 2152,2161,2166,2169,2174,2202,2205,2210,2215,2220,2222,2224,2243,2278, + 2315,2352,2404,2457,2462,2467,2470,2473,2510,2535,2587,2592,2644 +}; + + +static const unsigned short ag_sbe[] = { + 22, 49, 76, 83, 103, 128, 130, 154, 156, 175, 212, 239, 242, 258, + 267, 276, 285, 311, 326, 353, 356, 359, 376, 395, 414, 419, 432, 460, + 488, 507, 512, 519, 526, 530, 562, 568, 576, 604, 632, 657, 679, 683, + 703, 744, 753, 762, 767, 770, 773, 776, 779, 784, 788, 802, 838, 875, + 916, 931, 963, 978,1010,1025,1053,1082,1115,1130,1164,1179,1213,1228, + 1262,1277,1311,1326,1361,1376,1411,1426,1462,1477,1514,1529,1570,1585, + 1625,1640,1680,1695,1735,1750,1790,1805,1848,1900,1915,1941,1954,1991, + 2028,2055,2058,2096,2101,2105,2110,2115,2120,2125,2130,2135,2140,2147, + 2156,2163,2167,2171,2198,2203,2207,2212,2217,2221,2223,2239,2254,2289, + 2326,2369,2421,2459,2464,2468,2471,2484,2531,2552,2589,2609,2644 +}; + + +static const unsigned char ag_fl[] = { + 2,2,0,2,1,1,5,7,5,9,7,5,9,1,7,2,1,3,1,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,2,1,3,1,1,4,4,4,3,1,1,2,0,1,3,1,2,0,1,3,1, + 0,1,4,4,3,0,1,2,2,1,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, + 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 +}; + +static const unsigned char ag_ptt[] = { + 0, 4, 5, 5, 7, 7, 9, 9, 9, 9, 8, 8, 8, 8, 18, 18, 18, 18, + 12, 12, 22, 22, 22, 22, 22, 22, 24, 24, 30, 30, 33, 33, 35, 35, 35, 37, + 37, 37, 37, 37, 40, 40, 40, 45, 45, 45, 48, 48, 48, 48, 51, 51, 53, 53, + 53, 53, 53, 53, 1, 61, 61, 62, 62, 1, 66, 66, 67, 67, 1,118, 71, 71, + 118,118, 69, 76, 76, 69, 69, 73, 73, 75, 75, 72, 72, 97, 97, 58, 58, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 78, 78, 79, 79, 79, 83, 83, 84, 84, 13, + 11, 10, 14, 15, 17, 16, 19, 21, 20, 23, 25, 3, 26, 27, 28, 29, 32, 31, + 34, 36, 38, 39, 41, 42, 43, 44, 46, 47, 49, 50, 52, 54, 2, 55, 56, 57 +}; + + +static void ag_ra(PCB_DECL) +{ + switch(ag_rpx[(PCB).ag_ap]) { + case 1: V(0,(Program * *)) = VDO(AG_WRAP_4 *, ag_rp_1(PCB_POINTER, VW(0, AG_WRAP_4 *))); break; + case 2: VNO AG_WRAP_4(ag_rp_2(PCB_POINTER)); break; + case 3: VRO(AG_WRAP_4 *, ag_rp_3(PCB_POINTER, VW(0, AG_WRAP_4 *), V(1,(Statement * *)))); break; + case 4: V(0,(Statement * *)) = ag_rp_4(PCB_POINTER, V(2,(Expression * *)), V(4,(Statement * *))); break; + case 5: V(0,(Statement * *)) = ag_rp_5(PCB_POINTER, V(2,(Expression * *)), V(4,(Statement * *)), V(6,(Statement * *))); break; + case 6: V(0,(Statement * *)) = ag_rp_6(PCB_POINTER, V(2,(Expression * *)), V(4,(Statement * *))); break; + case 7: V(0,(Statement * *)) = ag_rp_7(PCB_POINTER, V(2,(Expression * *)), V(4,(Expression * *)), V(6,(Expression * *)), V(8,(Statement * *))); break; + case 8: V(0,(Statement * *)) = ag_rp_8(PCB_POINTER, V(2,(Expression * *)), V(4,(Statement * *)), V(6,(Statement * *))); break; + case 9: V(0,(Statement * *)) = ag_rp_9(PCB_POINTER, V(2,(Expression * *)), V(4,(Statement * *))); break; + case 10: V(0,(Statement * *)) = ag_rp_10(PCB_POINTER, V(2,(Expression * *)), V(4,(Expression * *)), V(6,(Expression * *)), V(8,(Statement * *))); break; + case 11: V(0,(Statement * *)) = ag_rp_11(PCB_POINTER, V(0,(Statement * *))); break; + case 12: V(0,(Statement * *)) = ag_rp_12(PCB_POINTER, V(1,(Statement * *)), V(4,(Expression * *))); break; + case 13: V(0,(Statement * *)) = ag_rp_13(PCB_POINTER, V(0,(Expression * *))); break; + case 14: V(0,(Statement * *)) = ag_rp_14(PCB_POINTER); break; + case 15: V(0,(Statement * *)) = ag_rp_15(PCB_POINTER, VW(1, AG_WRAP_4 *)); + VWD(1, AG_WRAP_4 *); break; + case 16: V(0,(Expression * *)) = ag_rp_16(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 17: V(0,(Expression * *)) = VDO(AG_WRAP_5 *, ag_rp_17(PCB_POINTER, VW(0, AG_WRAP_5 *), V(2,(Expression * *)))); break; + case 18: V(0,(Expression * *)) = VDO(AG_WRAP_5 *, ag_rp_18(PCB_POINTER, VW(0, AG_WRAP_5 *), V(2,(Expression * *)))); break; + case 19: V(0,(Expression * *)) = VDO(AG_WRAP_5 *, ag_rp_19(PCB_POINTER, VW(0, AG_WRAP_5 *), V(2,(Expression * *)))); break; + case 20: V(0,(Expression * *)) = VDO(AG_WRAP_5 *, ag_rp_20(PCB_POINTER, VW(0, AG_WRAP_5 *), V(2,(Expression * *)))); break; + case 21: V(0,(Expression * *)) = VDO(AG_WRAP_5 *, ag_rp_21(PCB_POINTER, VW(0, AG_WRAP_5 *), V(2,(Expression * *)))); break; + case 22: V(0,(Expression * *)) = ag_rp_22(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *)), V(4,(Expression * *))); break; + case 23: V(0,(Expression * *)) = ag_rp_23(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 24: V(0,(Expression * *)) = ag_rp_24(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 25: V(0,(Expression * *)) = ag_rp_25(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 26: V(0,(Expression * *)) = ag_rp_26(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 27: V(0,(Expression * *)) = ag_rp_27(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 28: V(0,(Expression * *)) = ag_rp_28(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 29: V(0,(Expression * *)) = ag_rp_29(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 30: V(0,(Expression * *)) = ag_rp_30(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 31: V(0,(Expression * *)) = ag_rp_31(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 32: V(0,(Expression * *)) = ag_rp_32(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 33: V(0,(Expression * *)) = ag_rp_33(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 34: V(0,(Expression * *)) = ag_rp_34(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 35: V(0,(Expression * *)) = ag_rp_35(PCB_POINTER, V(1,(Expression * *))); break; + case 36: V(0,(Expression * *)) = ag_rp_36(PCB_POINTER, V(1,(Expression * *))); break; + case 37: V(0,(Expression * *)) = ag_rp_37(PCB_POINTER, V(1,(Expression * *))); break; + case 38: V(0,(Expression * *)) = ag_rp_38(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break; + case 39: V(0,(Expression * *)) = ag_rp_39(PCB_POINTER, V(0,(double *))); break; + case 40: V(0,(Expression * *)) = VDO(AG_WRAP_5 *, ag_rp_40(PCB_POINTER, VW(0, AG_WRAP_5 *))); break; + case 41: V(0,(Expression * *)) = ag_rp_41(PCB_POINTER, V(2,(Expression * *))); break; + case 42: V(0,(Expression * *)) = ag_rp_42(PCB_POINTER, V(2,(Expression * *))); break; + case 43: V(0,(Expression * *)) = ag_rp_43(PCB_POINTER, V(2,(Expression * *))); break; + case 44: V(0,(Expression * *)) = ag_rp_44(PCB_POINTER, V(1,(Expression * *))); break; + case 45: V(0,(double *)) = ag_rp_45(PCB_POINTER, V(0,(double *))); break; + case 46: V(0,(double *)) = ag_rp_46(PCB_POINTER, V(0,(double *)), V(3,(int *))); break; + case 47: V(0,(double *)) = ag_rp_47(PCB_POINTER, V(0,(double *)), V(3,(int *))); break; + case 48: V(0,(double *)) = ag_rp_48(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 49: V(0,(double *)) = ag_rp_49(PCB_POINTER, V(0,(double *))); break; + case 50: V(0,(double *)) = ag_rp_50(PCB_POINTER, V(1,(double *))); break; + case 51: V(0,(double *)) = ag_rp_51(PCB_POINTER, V(0,(int *))); break; + case 52: V(0,(double *)) = ag_rp_52(PCB_POINTER, V(0,(double *)), V(1,(int *))); break; + case 53: V(0,(double *)) = ag_rp_53(PCB_POINTER, V(0,(int *))); break; + case 54: V(0,(double *)) = ag_rp_54(PCB_POINTER, V(0,(int *)), V(1,(double *))); break; + case 55: V(0,(int *)) = ag_rp_55(PCB_POINTER, V(0,(int *))); break; + case 56: V(0,(int *)) = ag_rp_56(PCB_POINTER, V(0,(int *)), V(1,(int *))); break; + case 57: VNO AG_WRAP_5(ag_rp_57(PCB_POINTER, V(0,(int *)))); break; + case 58: VRO(AG_WRAP_5 *, ag_rp_58(PCB_POINTER, VW(0, AG_WRAP_5 *), V(1,(int *)))); break; + } + (PCB).la_ptr = (PCB).pointer; +} + +#define TOKEN_NAMES astParse_token_names +const char *const astParse_token_names[122] = { + "input string", + "white space", + "real", + "name", + "input string", + "statements", + "eof", + "statement", + "closed statement", + "open statement", + "\"if\"", + "'('", + "expression", + "')'", + "\"else\"", + "\"while\"", + "\"for\"", + "';'", + "simple statement", + "\"do\"", + "'{'", + "'}'", + "assignment expression", + "','", + "conditional expression", + "'='", + "\"+=\"", + "\"-=\"", + "\"*=\"", + "\"/=\"", + "logical or expression", + "'\\?'", + "':'", + "logical and expression", + "\"||\"", + "equality expression", + "\"&&\"", + "relational expression", + "\"==\"", + "\"!=\"", + "additive expression", + "'<'", + "\"<=\"", + "'>'", + "\">=\"", + "multiplicative expression", + "'+'", + "'-'", + "unary expression", + "'*'", + "'/'", + "factor", + "'!'", + "primary", + "\"**\"", + "\"log\"", + "\"exp\"", + "\"sqrt\"", + "", + "\"/*\"", + "", + "", + "", + "\"*/\"", + "\"//\"", + "", + "", + "", + "'\\n'", + "simple real", + "", + "", + "exponent", + "integer part", + "'.'", + "fraction part", + "", + "digit", + "letter", + "", + "", + "", + "", + "", + "", + "')'", + "'('", + "\"if\"", + "\"else\"", + "\"while\"", + "';'", + "\"for\"", + "\"do\"", + "'}'", + "'{'", + "','", + "'='", + "name", + "\"+=\"", + "\"-=\"", + "\"*=\"", + "\"/=\"", + "':'", + "'\\?'", + "\"||\"", + "\"&&\"", + "\"==\"", + "\"!=\"", + "'<'", + "\"<=\"", + "'>'", + "\">=\"", + "'+'", + "'-'", + "'*'", + "'/'", + "'!'", + "\"**\"", + "real", + "\"log\"", + "\"exp\"", + "\"sqrt\"", + +}; + +#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 = (astParse_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 == (astParse_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 = (astParse_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 == (astParse_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 = (astParse_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 = (astParse_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 = (astParse_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 = (astParse_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); + (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 = (astParse_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 { + (PCB).ss[(PCB).ssx] = (PCB).sn; + } + (PCB).la_ptr = (PCB).pointer; + (PCB).reduction_token = (astParse_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 = (astParse_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); + (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_astParse(astParse_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 astParse(astParse_pcb_type *PCB_POINTER) { + init_astParse(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 = (astParse_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); + } +} + +