Mercurial > ~dholland > hg > ag > index.cgi
diff tests/agcl/oldagsrc/good/y2ag.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/y2ag.cpp Sat Dec 22 17:52:45 2007 -0500 @@ -0,0 +1,1774 @@ +/* + +YACC to AnaGram converter. +Copyright (c) Jerome T. Holland, 1993 +All Rights Reserved. + +Converts YACC files to AnaGram, attempting to preserve comments. +Does not convert semantic actions. + +*/ +/* + * 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 Y2AG_H +#include "y2ag.h" +#endif + +#ifndef Y2AG_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]) + + + +y2ag_pcb_type y2ag_pcb; +#define PCB y2ag_pcb + +#line - "y2ag.syn" +#include <ctype.h> +#include <stdio.h> +#include "charsink.h" +#include "strdict.h" + +string_accumulator c_code(64000); +string_accumulator comments(10000); +string_accumulator name(100); +string_accumulator white(100); +string_accumulator config(1000); +string_accumulator type_acc(100); +string_dictionary decl_dict(100); + +char decl_name[100] = ""; +int decl_table[100]; + +output_file out; + +char *cs; + +char *type_string = "int AG_RTV;\n"; + + +int rvflag; + +char *grammar_tag = " $"; + +void dump_comments(char *ps, char *cs) { + if (size(comments) == 0) return; + out << (char *) white << ps << (char *) comments << cs; + reset(comments); +} + +void output_r(void) { + char *rs = ""; + char *ts = ""; + if (size(c_code) == 0) return; + out.printf(" ={%s%s%s}", ts,(char *) c_code,rs); + reset(c_code); +} + +void output_il(void) { + char *rs = ""; + char *ts = ""; + if (size(c_code) == 0) return; + out.printf("%s!{\n%s%s%s}", cs, ts, (char *) c_code,rs); + reset(c_code); + cs = ",\n "; +} + +void main(void) { + y2ag(); +} + +#line - "y2ag.cpp" + +#ifndef CONVERT_CASE +#define CONVERT_CASE(c) (c) +#endif +#ifndef TAB_SPACING +#define TAB_SPACING 8 +#endif + +static void ag_rp_1(void) { +#line - "y2ag.syn" +if (size(config)) + out << "\n[\n" << (char *) config << "]\n"; +#line - "y2ag.cpp" +} + +#define ag_rp_2() (comments << "*/") + +#define ag_rp_3() (comments << "/*") + +#define ag_rp_4(x) (comments << x) + +#define ag_rp_5() (reset(white),out << '\n',dump_comments("", "")) + +#define ag_rp_6() (reset(white), dump_comments("\t", "")) + +#define ag_rp_7() (reset(white), dump_comments("", "")) + +#define ag_rp_8() (out << '\n', dump_comments("", "")) + +#define ag_rp_9() (dump_comments("\t", "")) + +#define ag_rp_10(c) (reset(white), dump_comments("", "")) + +#define ag_rp_11(c) (reset(white) << c,dump_comments("", "")) + +#define ag_rp_12() (reset(white),dump_comments("", "")) + +#define ag_rp_13(c) (dump_comments("\t", "")) + +#define ag_rp_14(c) (white << c, dump_comments("", "")) + +#define ag_rp_15(c) (reset(white),out << cs, cs = "", dump_comments("", "")) + +#define ag_rp_16(c) (reset(white) << c,dump_comments("", "")) + +#define ag_rp_17() (reset(white),dump_comments("", "")) + +#define ag_rp_18(c) (out << cs, cs = "",dump_comments("", "")) + +#define ag_rp_19(c) (white << c, dump_comments("", "")) + +#define ag_rp_20() (dump_comments("\n","\n")) + +static void ag_rp_21(void) { +#line - "y2ag.syn" + out.printf("[ grammar token = %s ]\n",(char *) name); + grammar_tag = ""; + +#line - "y2ag.cpp" +} + +#define ag_rp_22() (out << '\n') + +#define ag_rp_23() (config << "}\n") + +#define ag_rp_24() (config << "}\n") + +#define ag_rp_25() (config << "}\n") + +#define ag_rp_26() (out << '\n') + +#define ag_rp_27() (out << '\n') + +#define ag_rp_28() (reset(name)) + +static void ag_rp_29(void) { +#line - "y2ag.syn" + int decl_ndx = decl_dict << decl_name; + int type_ndx = decl_dict << (char *) type_acc; + decl_table[decl_ndx] = type_ndx; + reset(type_acc); + reset(name); + *decl_name = 0; + +#line - "y2ag.cpp" +} + +#define ag_rp_30() (type_acc << (char *) decl_name, strcpy(decl_name, name), reset(name)) + +static void ag_rp_31(void) { +#line - "y2ag.syn" +if (*decl_name) type_acc << (char *) decl_name << ' ', *decl_name = 0; +#line - "y2ag.cpp" +} + +#define ag_rp_32() (type_acc << (char *) decl_name << '*', *decl_name = 0) + +#define ag_rp_33(n) (out.printf("/* expect %d unresolved conflicts */\n",n)) + +#define ag_rp_34() (config << " left {") + +#define ag_rp_35() (config << " nonassoc {") + +#define ag_rp_36() (config << " right {") + +#define ag_rp_37() (out << '(' << decl_dict[decl_table[decl_dict[name]]] << ") ", reset(name)) + +#define ag_rp_38() (out << (char *) name, cs = ", ") + +#define ag_rp_39() (out << cs << (char *) name) + +#define ag_rp_40() (out << cs << (char *) name) + +#define ag_rp_41(n) (out.printf(" = %d\n",n)) + +#define ag_rp_42() (config<< (char *) name, cs = ", ") + +#define ag_rp_43() (config << cs << (char *) name) + +#define ag_rp_44() (config << cs << (char *) name) + +#define ag_rp_45(n) (config.printf("/* = %d*/",n)) + +#define ag_rp_46() (out << "\n{\n" << (char *) c_code << "\n}\n",reset(c_code)) + +#define ag_rp_47() (reset(c_code), rvflag = 0) + +#define ag_rp_48(x) (c_code << x) + +#define ag_rp_49() (c_code << '$') + +#define ag_rp_50() (c_code << '}') + +#define ag_rp_51() (c_code << '"') + +#define ag_rp_52() (c_code << "*/") + +#define ag_rp_53() (c_code << "/*") + +#define ag_rp_54(x) (c_code << x) + +#define ag_rp_55(d) (d - '0') + +#define ag_rp_56(n, d) (10*n + d - '0') + +#define ag_rp_57() (c_code << '{') + +#define ag_rp_58(x) (c_code << '\'' << x << '\'') + +#define ag_rp_59(x) (c_code << x) + +#define ag_rp_60(x) (c_code << x) + +#define ag_rp_61() (c_code << '"') + +#define ag_rp_62(x) (c_code << x) + +#define ag_rp_63(x) (c_code << '\\' << x) + +#define ag_rp_64() (output_r()) + +static void ag_rp_65(void) { +#line - "y2ag.syn" + out << (char *) name << grammar_tag; + grammar_tag = ""; + cs = "\n -> "; + dump_comments("\t",""); + +#line - "y2ag.cpp" +} + +#define ag_rp_66() (output_r(), out << "\n -> ", cs = "") + +#define ag_rp_67() (out << cs, cs = "") + +static void ag_rp_68(void) { +#line - "y2ag.syn" + output_il(); + out.printf("%s%s",cs,(char *) name); cs = ", "; + +#line - "y2ag.cpp" +} + +static void ag_rp_69(int x) { +#line - "y2ag.syn" + char *fmt = "%d"; + if (isprint(x)) fmt ="'%c'"; + reset(name).printf(fmt,x); + output_il(); + out.printf("%s%s",cs,(char *) name); cs = ", "; + +#line - "y2ag.cpp" +} + +#define ag_rp_70() (out.printf(" /* %prec %s */",(char *) name)) + +#define ag_rp_71() (dump_comments("\t","")) + +static void ag_rp_72(int x) { +#line - "y2ag.syn" + char *fmt = "%d"; + if (isprint(x)) fmt ="'%c'"; + reset(name).printf(fmt,x); + +#line - "y2ag.cpp" +} + +#define ag_rp_73(x) (x) + +#define ag_rp_74(x) (x) + +#define ag_rp_75() ('\n') + +#define ag_rp_76() ('\r') + +#define ag_rp_77() ('\b') + +#define ag_rp_78() ('\b') + +#define ag_rp_79() ('\v') + +#define ag_rp_80(x) (x&037) + +#define ag_rp_81(x) (x) + +#define ag_rp_82(x) (reset(name) << x) + +#define ag_rp_83(x) (name << x) + +#define ag_rp_84() (name << ' ') + +#define ag_rp_85(x) (x-'0') + +#define ag_rp_86(v, x) (8*v + x-'0') + +#define ag_rp_87() (out << "\n}\n") + +#define ag_rp_88() (out << "\n{\n") + +#define ag_rp_89(x) (out << x) + + +#define READ_COUNTS +#define WRITE_COUNTS +#undef V +#define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i])) +#undef VS +#define VS(i) (PCB).vs[(PCB).ssx + i] + +#ifndef GET_CONTEXT +#define GET_CONTEXT CONTEXT = (PCB).input_context +#endif + +typedef enum { + ag_action_1, + ag_action_2, + ag_action_3, + ag_action_4, + ag_action_5, + ag_action_6, + ag_action_7, + ag_action_8, + ag_action_9, + ag_action_10, + ag_action_11, + ag_action_12 +} ag_parser_action; + + +#ifndef NULL_VALUE_INITIALIZER +#define NULL_VALUE_INITIALIZER = 0 +#endif + +static int const ag_null_value NULL_VALUE_INITIALIZER; + +static const unsigned char ag_rpx[] = { + 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 3, 4, 0, 0, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 20, 21, 0, 0, 22, + 0, 0, 23, 24, 25, 26, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 29, 30, 0, 0, 31, 32, 0, + 0, 0, 33, 0, 0, 0, 0, 34, 0, 0, 0, 35, 0, 0, 36, 0, 0, 0, + 0, 0, 0, 37, 0, 0, 0, 38, 39, 40, 41, 42, 43, 44, 45, 0, 46, 0, + 0, 0, 47, 0, 48, 49, 0, 50, 0, 51, 52, 53, 54, 55, 56, 57, 0, 58, + 0, 59, 60, 61, 0, 62, 63, 0, 0, 0, 0, 0, 0, 64, 65, 0, 0, 66, + 0, 0, 0, 0, 67, 0, 0, 0, 68, 69, 0, 0, 70, 0, 0, 71, 0, 72, + 73, 74, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 87, 88, + 89 +}; + +static const unsigned char ag_key_itt[] = { + 0 +}; + +static const unsigned short ag_key_pt[] = { +0 +}; + +static const unsigned char ag_key_ch[] = { + 0,101,111,121,255, 37, 48, 50, 60, 62, 98,101,108,110,114,115,116,117, + 123,255, 37, 47,255, 42,255,101,111,121,255, 37, 48, 50, 60, 62, 98,101, + 108,110,114,115,116,117,123,255, 37,255, 37,255, 47,255, 37, 47,255, 37, + 123,255, 37, 47,255, 37,123,255, 37,255,101,111,121,255, 37, 48, 50, 60, + 61, 62, 98,101,108,110,112,114,115,116,117,123,255, 37, 47,255, 61,112, + 255, 37, 47,255, 37, 47,255, 61,112,255, 37,255 +}; + +static const unsigned char ag_key_act[] = { + 0,3,3,3,4,0,0,0,0,0,3,3,3,3,3,3,2,3,0,4,2,3,4,3,4,3,3,3,4,0,0,0,0,0,3, + 3,3,3,3,3,2,3,0,4,2,4,3,4,3,4,3,3,4,0,0,4,2,3,4,0,0,4,2,4,3,3,3,4,0,0, + 0,0,0,0,3,3,3,3,3,3,3,2,3,0,4,2,3,4,0,3,4,2,3,4,3,3,4,0,3,4,2,4 +}; + +static const unsigned char ag_key_parm[] = { + 0, 73, 72, 76, 0, 12, 74, 66, 61, 69, 65, 58, 60, 64, 68, 71, 0, 79, + 83, 0, 0, 19, 0, 18, 0, 73, 72, 76, 0, 12, 74, 66, 61, 69, 65, 58, + 60, 64, 68, 71, 0, 79, 83, 0, 0, 0, 12, 0, 19, 0, 85, 19, 0, 12, + 83, 0, 0, 19, 0, 12, 83, 0, 0, 0, 73, 72, 76, 0, 12, 74, 66, 61, + 126, 69, 65, 58, 60, 64,125, 68, 71, 0, 79, 83, 0, 0, 19, 0,126,125, + 0, 0, 19, 0, 12, 19, 0,126,125, 0, 0, 0 +}; + +static const unsigned char ag_key_jmp[] = { + 0, 34, 37, 41, 0, 0, 0, 0, 0, 0, 0, 6, 12, 16, 24, 29, 1, 44, + 0, 0, 5, 49, 0, 51, 0, 87, 90, 94, 0, 0, 0, 0, 0, 0, 53, 59, + 65, 69, 77, 82, 25, 97, 0, 0, 29, 0,102, 0,104, 0,106,108, 0, 0, + 0, 0, 53,110, 0, 0, 0, 0, 59, 0,150,153,157, 0, 0, 0, 0, 0, + 0, 0,112,118,124,128,136,140,145, 64,160, 0, 0, 68,165, 0, 0,167, + 0, 88,171, 0,173,175, 0, 0,177, 0, 97, 0 +}; + +static const unsigned char ag_key_index[] = { + 20, 23, 20, 20, 44, 44, 20, 20, 44, 46, 48, 48, 48, 48, 48, 48, 50, 48, + 48, 20, 0, 0, 0, 0, 0, 0, 0, 56, 0, 48, 20, 50, 48, 0, 48, 0, + 20, 20, 20, 0, 20, 48, 20, 0, 0, 20, 20, 62, 20, 23, 0, 0, 48, 20, + 0, 20, 0, 85, 85, 44, 44, 44, 44, 44, 44, 48, 48, 48, 48, 48, 0, 48, + 0, 0, 0, 0, 46, 0, 0, 0, 48, 48, 44, 48, 20, 85, 85, 48, 20, 48, + 0, 48, 91, 94, 46, 46, 0, 0, 0,100, 0, 0, 0, 91, 91,100, 91, 91, + 100, 91, 0, 0, 0, 48, 48, 91, 91, 91, 48, 48, 91, 48, 0, 48, 0, 48, + 0, 0, 0, 48 +}; + +static const unsigned char ag_key_ends[] = { +105,110,97,114,121,0, 120,112,101,99,116,0, 101,102,116,0, +111,110,97,115,115,111,99,0, 105,103,104,116,0, 116,97,114,116,0, +114,109,0, 107,101,110,0, 112,101,0, 110,105,111,110,0, 42,0, +47,0, 105,110,97,114,121,0, 120,112,101,99,116,0, 101,102,116,0, +111,110,97,115,115,111,99,0, 105,103,104,116,0, 116,97,114,116,0, +114,109,0, 107,101,110,0, 112,101,0, 110,105,111,110,0, 37,0, +42,0, 125,0, 42,0, 42,0, 105,110,97,114,121,0, 120,112,101,99,116,0, +101,102,116,0, 111,110,97,115,115,111,99,0, 114,101,99,0, +105,103,104,116,0, 116,97,114,116,0, 114,109,0, 107,101,110,0, +112,101,0, 110,105,111,110,0, 42,0, 114,101,99,0, 42,0, 37,0, +42,0, 114,101,99,0, +}; +#define AG_TCV(x) (((int)(x) >= -1 && (int)(x) <= 255) ? ag_tcv[(x) + 1] : 0) + +static const unsigned char ag_tcv[] = { + 11, 11,143,143,143,143,143,143,143,143,140, 21, 21, 21,141,143,143,143, + 143,143,143,143,143,143,143,143,143, 11,143,143,143,143,143,142,144, 97, + 144, 91,144,144, 94,144,144, 55,144, 82,144,138,144,103,103,103,103,103, + 103,103,103,145,145,113, 53, 77, 88, 78,144,144,146,146,146,146,146,146, + 146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146, + 146,146,144,101,144,144,146,144,146,131,146,146,146,133,146,146,146,146, + 146,146,146,129,146,146,146,130,146,132,146,146,146,146,146,146, 41,116, + 43,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, + 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, + 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,143,143, + 143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143, + 143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143, + 143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143, + 143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143, + 143,143,143,143,143 +}; + +#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 + + +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; + +#ifndef GET_INPUT +#define GET_INPUT ((PCB).input_code = getchar()) +#endif + + +static int ag_look_ahead(void) { + if ((PCB).rx < (PCB).fx) { + return CONVERT_CASE((PCB).lab[(PCB).rx++]); + } + GET_INPUT; + (PCB).fx++; + return CONVERT_CASE((PCB).lab[(PCB).rx++] = (PCB).input_code); +} + +static void ag_get_key_word(int ag_k) { + int save_index = (PCB).rx; + const unsigned char *sp; + int ag_ch; + while (1) { + switch (ag_key_act[ag_k]) { + case ag_cf_end_key: + 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 + ag_look_ahead()]) goto ag_fail; + (PCB).rx--; + (PCB).token_number = (y2ag_token_type) ag_key_pt[ag_k1 + 1]; + return; + } + } while (ag_look_ahead() == ag_ch); + goto ag_fail; + case ag_end_key: + sp = ag_key_ends + ag_key_jmp[ag_k]; + do { + if ((ag_ch = *sp++) == 0) { + (PCB).token_number = (y2ag_token_type) ag_key_parm[ag_k]; + return; + } + } while (ag_look_ahead() == ag_ch); + case ag_no_match_key: +ag_fail: + (PCB).rx = save_index; + 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 + (ag_ch = ag_look_ahead())]) break; + save_index = --(PCB).rx; + (PCB).token_number = (y2ag_token_type) ag_key_pt[ag_k1+1]; + break; + } + case ag_set_key: + save_index = (PCB).rx; + (PCB).token_number = (y2ag_token_type) ag_key_parm[ag_k]; + case ag_jmp_key: + ag_k = ag_key_jmp[ag_k]; + ag_ch = ag_look_ahead(); + break; + case ag_accept_key: + (PCB).token_number = (y2ag_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 + ag_look_ahead()]) (PCB).rx = save_index; + else { + (PCB).rx--; + (PCB).token_number = (y2ag_token_type) ag_key_pt[ag_k1+1]; + } + return; + } + default: + /* not reachable; here to suppress compiler warnings */ + goto ag_fail; + } + if (ag_ch <= 255) while (ag_key_ch[ag_k] < ag_ch) ag_k++; + if (ag_ch > 255 || ag_key_ch[ag_k] != ag_ch) { + (PCB).rx = save_index; + return; + } + } +} + + +#ifndef AG_NEWLINE +#define AG_NEWLINE 10 +#endif + +#ifndef AG_RETURN +#define AG_RETURN 13 +#endif + +#ifndef AG_FORMFEED +#define AG_FORMFEED 12 +#endif + +#ifndef AG_TABCHAR +#define AG_TABCHAR 9 +#endif + +static void ag_track(void) { + int ag_k = 0; + while (ag_k < (PCB).rx) { + int ag_ch = (PCB).lab[ag_k++]; + switch (ag_ch) { + 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++; + } + } + ag_k = 0; + while ((PCB).rx < (PCB).fx) (PCB).lab[ag_k++] = (PCB).lab[(PCB).rx++]; + (PCB).fx = ag_k; + (PCB).rx = 0; +} + + +static void ag_prot(void) { + int ag_k; + ag_k = 128 - ++(PCB).btsx; + if (ag_k <= (PCB).ssx) { + (PCB).exit_flag = AG_STACK_ERROR_CODE; + PARSER_STACK_OVERFLOW; + return; + } + (PCB).bts[(PCB).btsx] = (PCB).sn; + (PCB).bts[ag_k] = (PCB).ssx; + (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx]; + (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx]; +} + +static void ag_undo(void) { + if ((PCB).drt == -1) return; + while ((PCB).btsx) { + int ag_k = 128 - (PCB).btsx; + (PCB).sn = (PCB).bts[(PCB).btsx--]; + (PCB).ssx = (PCB).bts[ag_k]; + (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k]; + (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k]; + } + (PCB).token_number = (y2ag_token_type) (PCB).drt; + (PCB).ssx = (PCB).dssx; + (PCB).sn = (PCB).dsn; + (PCB).drt = -1; +} + + +static const unsigned char ag_tstt[] = { +142,140,83,79,76,74,73,72,71,69,68,66,65,64,61,60,58,21,19,12,0,2,3,4,16,17, +146,145,144,143,142,141,140,138,133,132,131,130,129,116,113,103,101,97,94, + 91,88,82,78,77,55,53,43,41,21,18,0, +146,145,142,140,138,133,132,131,130,129,103,97,94,83,82,79,78,77,76,74,73, + 72,71,69,68,66,65,64,61,60,58,21,19,12,11,0,16,17,22, +146,145,142,140,138,133,132,131,130,129,103,97,94,83,82,79,78,77,76,74,73, + 72,71,69,68,66,65,64,61,60,58,21,19,12,11,0,16,17,22, +142,140,21,0, +83,79,76,74,73,72,71,69,68,66,65,64,61,60,58,12,0,5,13, +146,145,142,140,138,133,132,131,130,129,103,97,94,83,82,79,78,77,76,74,73, + 72,71,69,68,66,65,64,61,60,58,21,19,12,11,0,16,17,22, +146,145,142,140,138,133,132,131,130,129,103,97,94,83,82,79,78,77,76,74,73, + 72,71,69,68,66,65,64,61,60,58,21,19,12,11,0,16,17,22, +83,79,76,74,73,72,71,69,68,66,65,64,61,60,58,0,7,26,27,29,31,33,36,37,38,40, + 62,67,70,75, +12,0,6, +145,142,140,103,21,19,0,3,4,16,17, +142,141,140,21,19,0,14,16,17,54, +146,142,141,140,138,133,132,131,130,129,97,94,77,21,19,0,14,16,17,54,63, +146,142,141,140,138,133,132,131,130,129,97,94,77,21,19,0,14,16,17,54,63, +146,142,141,140,138,133,132,131,130,129,97,94,77,21,19,0,14,16,17,54,63, +146,142,141,140,138,133,132,131,130,129,97,94,77,21,19,0,14,16,17,54,63, +146,145,144,143,142,141,140,138,133,132,131,130,129,116,113,103,101,97,94, + 91,88,85,82,78,77,55,53,41,21,19,0,84, +142,141,140,41,21,19,0,14,16,17,54,63, +146,142,141,140,138,133,132,131,130,129,97,94,21,19,0,14,16,17,54,63, +142,140,83,79,76,74,73,72,71,69,68,66,65,64,61,60,58,21,19,12,0,3,4,16,17, +77,0,39, +146,138,133,132,131,130,129,97,94,77,0,34,80,81, +146,138,133,132,131,130,129,97,94,77,0,34,80,81, +146,138,133,132,131,130,129,97,94,77,0,34,80,81, +146,138,133,132,131,130,129,97,94,77,0,32,80,81, +41,0,30, +146,138,133,132,131,130,129,97,94,0,1,28,122, +146,142,140,138,133,132,131,130,129,97,94,83,21,19,12,11,0,3,4,16,17, +145,103,0,59, +142,141,140,21,19,0,14,16,17, +142,141,140,21,19,0,14,16,17, +146,145,144,143,142,141,140,138,133,132,131,130,129,116,113,103,101,97,94, + 91,88,85,82,78,77,55,53,41,21,19,0,89,92,96,98, +146,142,141,140,138,133,132,131,130,129,21,19,0,14,16,17,54,63, +146,138,133,132,131,130,129,97,94,77,0,32,80,81, +146,142,140,138,133,132,131,130,129,97,94,21,19,0,3,4,16,17, +146,138,133,132,131,130,129,97,94,0,1,28,122, +142,140,83,82,79,76,74,73,72,71,69,68,66,65,64,61,60,58,21,19,12,0,16,17,24, + 35, +142,140,83,82,79,76,74,73,72,71,69,68,66,65,64,61,60,58,21,19,12,0,16,17,24, + 35, +142,140,83,82,79,76,74,73,72,71,69,68,66,65,64,61,60,58,21,19,12,0,16,17,24, + 35, +146,138,133,132,131,130,129,97,94,0,1,28,122, +142,140,83,82,79,76,74,73,72,71,69,68,66,65,64,61,60,58,21,19,12,0,3,4,16, + 17, +146,142,141,140,138,133,132,131,130,129,55,53,21,19,0,1,14,16,17,42,44,45, + 46,47,48,49,50,51,52,54,56,57, +142,140,83,79,76,74,73,72,71,69,68,66,65,64,61,60,58,21,19,12,0,3,4,16,17, +146,145,144,142,138,133,132,131,130,129,116,113,103,101,97,94,91,88,82,78, + 77,55,53,43,41,0,128, +146,145,144,142,138,133,132,131,130,129,116,113,103,101,97,94,91,88,82,78, + 77,55,53,43,41,0,128, +146,145,138,133,132,131,130,129,103,0, +142,140,83,79,76,74,73,72,71,69,68,66,65,64,61,60,58,21,19,12,0,3,4,16,17, +146,138,133,132,131,130,129,97,94,83,12,11,0,7,8, +145,103,0, +146,145,144,143,142,141,140,138,133,132,131,130,129,116,113,103,101,97,94, + 91,88,82,78,77,55,53,43,41,21,18,0, +146,145,144,142,138,133,132,131,130,129,116,113,103,101,97,94,91,88,82,78, + 77,55,53,43,41,0,104, +146,145,144,142,138,133,132,131,130,129,116,113,103,101,97,94,91,88,82,78, + 77,55,53,43,41,0,95, +146,145,144,143,142,141,140,138,133,132,131,130,129,116,113,103,101,97,94, + 91,88,82,78,77,55,53,43,41,21,19,0,93, +146,142,141,140,138,133,132,131,130,129,97,94,83,79,76,74,73,72,71,69,68,66, + 65,64,61,60,58,21,19,12,11,0,14,16,17,54,63, +146,138,133,132,131,130,129,0,1, +142,140,83,82,79,76,74,73,72,71,69,68,66,65,64,61,60,58,21,19,12,0,3,4,16, + 17, +146,138,133,132,131,130,129,97,94,0,1,28,122, +146,145,142,140,138,133,132,131,130,129,126,125,116,103,97,94,88,83,82,79, + 76,74,73,72,71,69,68,66,65,64,61,60,58,53,41,21,19,12,0,16,17,22, +146,145,142,140,138,133,132,131,130,129,126,125,116,103,97,94,88,83,82,79, + 76,74,73,72,71,69,68,66,65,64,61,60,58,53,41,21,19,12,0,16,17,22, +146,145,142,140,138,133,132,131,130,129,103,97,94,21,0,1,28,59,122, +82,0, +82,0, +82,0, +146,145,142,140,138,133,132,131,130,129,103,97,94,21,0,1,28,59,122, +82,0, +55,0,56, +142,141,140,21,19,0,14,16,17, +146,145,138,133,132,131,130,129,103,0, +146,142,141,140,138,133,132,131,130,129,55,21,19,0,1,14,16,17,44,45,46,54, + 56,57, +146,142,141,140,138,133,132,131,130,129,53,21,19,0,1,14,16,17,44,45,47,54, +146,138,133,132,131,130,129,55,53,0,1,44,46,47,56,57, +142,141,140,55,53,21,19,0,14,16,17,45,46,47,54,56,57, +43,0, +146,145,144,142,138,133,132,131,130,129,116,113,103,101,97,94,91,88,82,78, + 77,55,53,43,41,0,135, +97,0, +94,0, +146,138,133,132,131,130,129,97,94,12,11,0,1,9,28,107,108,109,110,111,122, +146,145,144,142,138,133,132,131,130,129,116,113,103,101,97,94,91,88,82,78, + 77,55,53,43,41,0, +103,0,102, +94,0, +146,145,144,143,142,141,140,138,133,132,131,130,129,116,113,103,101,97,94, + 91,88,82,78,77,55,53,43,41,21,19,0,89,92,96,98, +146,145,142,141,140,138,133,132,131,130,129,103,78,21,19,0,14,16,17,54,63, +82,0, +142,140,78,21,19,0,3,4,16,17, +145,103,0, +146,145,142,140,138,133,132,131,130,129,126,125,116,103,97,94,88,83,82,79, + 76,74,73,72,71,69,68,66,65,64,61,60,58,53,41,21,19,12,0,16,17,22, +146,145,142,140,138,133,132,131,130,129,126,125,116,103,97,94,88,83,82,79, + 76,74,73,72,71,69,68,66,65,64,61,60,58,53,41,21,19,12,0,16,17,22, +146,142,140,138,133,132,131,130,129,97,94,21,19,0,16,17,24,35, +145,103,0, +146,142,140,138,133,132,131,130,129,97,94,21,19,0,3,4,16,17, +103,0, +142,141,140,113,21,19,0,14,16,17,54,63, +146,142,140,138,133,132,131,130,129,126,125,116,97,94,88,53,41,21,19,0,16, + 17,25,112,114,115,117,119,120,121, +146,142,140,138,133,132,131,130,129,97,94,21,19,12,11,0,3,4,16,17, +146,138,133,132,131,130,129,97,94,0,1,28,107,108,111,122, +12,11,0,6,10, +103,0, +78,0, +78,0, +142,140,21,0, +146,138,133,132,131,130,129,97,94,0,1,28,122, +146,138,133,132,131,130,129,97,94,0,1,28,122, +113,0, +146,142,140,138,133,132,131,130,129,126,125,116,97,94,88,53,41,21,19,0,16, + 17,22, +146,142,140,138,133,132,131,130,129,126,125,116,97,94,88,53,41,21,19,0,16, + 17,22, +142,140,21,0, +146,142,140,138,133,132,131,130,129,126,125,116,97,94,88,53,41,21,19,0,16, + 17,24,35, +146,142,140,138,133,132,131,130,129,126,125,116,97,94,88,53,41,21,19,0,16, + 17,24,35, +146,138,133,132,131,130,129,126,125,97,94,88,41,0,1,86,87,118,122,123,124, + 127, +146,142,140,138,133,132,131,130,129,126,125,116,97,94,88,53,41,21,19,0,16, + 17,25,114,117,119,120,121, +116,53,0, +146,145,144,143,142,141,140,138,133,132,131,130,129,116,113,103,101,97,94, + 91,88,82,78,77,55,53,43,41,21,11,0,139, +11,0, +146,142,140,138,133,132,131,130,129,97,94,77,21,19,0,3,4,16,17, +146,142,140,138,133,132,131,130,129,97,94,21,19,0,3,4,16,17, +146,142,140,138,133,132,131,130,129,126,125,116,97,94,88,53,41,21,19,0,16, + 17,22, +146,142,140,138,133,132,131,130,129,126,125,116,97,94,88,53,41,21,19,0,16, + 17,22, +146,145,138,133,132,131,130,129,103,0, +146,145,144,143,142,141,140,138,133,132,131,130,129,116,113,103,101,97,94, + 91,88,82,78,77,55,53,43,41,21,19,0,84, +142,141,140,41,21,19,0,14,16,17,54,63, +146,142,140,138,133,132,131,130,129,126,125,116,97,94,88,53,41,21,19,0,16, + 17,24,35, +146,142,141,140,138,133,132,131,130,129,97,94,21,19,0,14,16,17,54,63, +146,138,133,132,131,130,129,97,94,0,1,28,122, +142,140,88,41,21,19,0,16,17,24,35, +146,145,144,143,142,141,140,138,133,132,131,130,129,116,113,103,101,97,94, + 91,88,82,78,77,55,53,43,41,21,0, +146,145,144,143,142,141,140,138,133,132,131,130,129,116,113,103,101,97,94, + 91,88,82,78,77,55,53,43,41,21,19,0,89,92,96,98, +41,0,87, +88,41,0,86,87, +142,140,116,88,53,41,21,0, +142,140,116,53,21,19,0,16,17,24,35, + +}; + + +static unsigned const char ag_astt[2277] = { + 1,1,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,1,2,5,7,0,1,1,2,1,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10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,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,2,7,2,1,2,10, + 10,10,10,10,10,10,10,10,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,7,1,1,1,1,8,1,2,7,1,1,1,1,1,5,1,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 1,2,7,2,1,1,3,5,1,1,1,5,5,5,5,5,5,5,5,1,2,7,1,1,1,1,2,2,2,2,2,2,2,2,1,1,7, + 1,2,2,1,1,8,8,1,2,7,2,1,1,1,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,4,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 2,2,2,1,2,2,2,2,2,2,2,3,1,2,2,7,3,3,1,1,1,7,3,1,1,7,1,1,1,1,5,5,5,5,1,7,1, + 1,5,5,1,2,7,2,1,1,3 +}; + + +static const unsigned char ag_pstt[] = { +2,2,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,11,1,0,0,4,5,17,1, +12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,10,1, +13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,11,13,13,2,16,1,16, +13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,11,13,13,3,15,1,15, +6,6,7,2, +8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,30,5,9,8, +13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,11,13,13,6,19,1,19, +13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,11,13,13,7,18,1,18, +16,17,11,15,15,15,18,13,13,12,12,12,14,14,10,7,31,31,26,25,24,23,22,21,20, + 19,14,12,13,15, +27,9,27, +28,2,2,28,3,11,10,4,28,17,1, +29,29,29,29,11,11,29,29,1,29, +77,30,30,30,77,77,77,77,77,77,77,77,77,30,11,12,30,30,1,30,83, +77,30,30,30,77,77,77,77,77,77,77,77,77,30,11,13,30,30,1,30,86, +77,30,30,30,77,77,77,77,77,77,77,77,77,30,11,14,30,30,1,30,79, +77,30,30,30,77,77,77,77,77,77,77,77,77,30,11,15,30,30,1,30,91, +110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, + 110,110,110,110,110,110,110,110,110,110,110,16,31, +30,30,30,77,30,11,17,30,30,1,30,94, +77,30,30,30,77,77,77,77,77,77,77,77,30,11,18,30,30,1,30,87, +2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,11,1,19,4,42,17,1, +32,20,33, +35,35,35,35,35,35,35,35,35,34,21,36,35,35, +35,35,35,35,35,35,35,35,35,34,22,37,35,35, +35,35,35,35,35,35,35,35,35,34,23,38,35,35, +39,39,39,39,39,39,39,39,39,34,24,40,39,39, +41,25,42, +172,172,172,172,172,172,172,43,44,26,45,46,161, +1,2,2,1,1,1,1,1,1,1,1,47,3,11,1,1,27,4,47,17,1, +121,121,28,48, +68,68,68,68,11,92,68,68,1, +68,68,68,68,11,78,68,68,1, +112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,129,51, + 113,112,53,112,112,112,112,112,52,112,119,31,111,111,50,49, +54,30,30,30,54,54,54,54,54,54,30,11,32,30,30,1,30,54, +39,39,39,39,39,39,39,39,39,34,33,55,39,39, +56,2,2,56,56,56,56,56,56,56,56,3,11,34,4,56,17,1, +172,172,172,172,172,172,172,43,44,35,45,101,161, +57,57,36,60,36,36,36,36,36,36,36,36,36,36,36,36,36,36,58,11,36,36,22,1,59, + 60, +57,57,36,61,36,36,36,36,36,36,36,36,36,36,36,36,36,36,58,11,36,37,22,1,59, + 61, +57,57,36,62,36,36,36,36,36,36,36,36,36,36,36,36,36,36,58,11,36,38,22,1,59, + 62, +172,172,172,172,172,172,172,43,44,39,45,97,161, +2,2,1,64,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,11,1,40,63,64,17,1, +172,66,66,66,172,172,172,172,172,172,70,65,66,11,41,67,66,66,1,72,71,70,69, + 68,71,70,69,68,64,66,65,65, +2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,11,1,42,4,33,17,1, +74,74,74,74,74,74,74,74,74,74,74,74,74,73,74,74,74,74,74,74,74,74,74,74,74, + 43,74, +75,75,75,75,75,75,75,75,75,75,75,75,75,73,75,75,75,75,75,75,75,75,75,75,75, + 44,75, +173,173,174,173,173,173,173,173,173,160, +2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,11,1,46,4,32,17,1, +76,76,76,76,76,76,76,76,76,16,3,3,47,76,76, +122,122,74, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, + 120,120,120,120,120,120,120,120,120,120,118,49, +131,131,131,131,131,131,131,131,131,131,131,131,131,77,117,131,131,131,131, + 131,131,131,131,131,131,50,130, +125,125,125,125,125,125,125,125,125,125,125,125,125,78,125,125,125,125,125, + 125,125,125,125,125,125,51,79, +123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, + 123,123,123,123,123,123,123,123,123,123,123,52,80, +77,30,30,30,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77, + 77,77,30,11,77,77,53,30,30,1,30,106, +172,172,172,172,172,172,172,54,81, +2,2,1,82,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,11,1,55,63,82,17,1, +172,172,172,172,172,172,172,43,44,56,45,83,161, +13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,11,13,57,21,1,21, +13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,11,13,58,20,1,20, +172,121,85,85,172,172,172,172,172,172,121,43,44,86,37,45,102,84,161, +87,40, +87,39, +87,38, +172,121,6,6,172,172,172,172,172,172,121,43,44,7,2,45,98,88,161, +89,35, +70,73,72, +68,68,68,68,11,69,68,68,1, +173,173,174,173,173,173,173,173,173,66, +172,66,66,66,172,172,172,172,172,172,70,66,11,63,67,66,66,1,47,51,55,66,65, + 65, +172,66,66,66,172,172,172,172,172,172,65,66,11,62,67,66,66,1,46,50,58,66, +172,172,172,172,172,172,172,70,65,61,67,45,53,57,65,65, +66,66,66,70,65,66,11,60,66,66,1,48,52,56,66,65,65, +43,72, +170,170,170,170,170,169,168,167,166,165,170,170,175,170,170,170,170,170,170, + 170,170,170,170,170,170,73,90, +163,74, +162,75, +172,172,172,172,172,172,172,43,44,136,136,76,45,95,91,93,94,94,95,92,161, +132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132, + 132,132,132,132,132,132,77, +127,78,96, +116,79, +112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,129,51, + 113,112,112,112,112,112,112,115,52,112,119,80,124,124,50,49, +173,173,30,30,30,174,173,173,173,173,173,173,97,30,11,81,30,30,1,30,97, +89,41, +2,2,98,3,11,83,4,98,17,1, +122,122,104, +13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,11,13,85,24,1,24, +13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,11,13,86,23,1,23, +100,57,57,100,100,100,100,100,100,100,100,58,11,87,22,1,99,100, +122,122,100, +101,2,2,101,101,101,101,101,101,101,101,3,11,89,4,101,17,1, +176,171, +30,30,30,102,30,11,91,30,30,1,30,102, +146,103,103,146,146,146,146,146,146,146,146,146,146,146,146,146,146,104,11, + 92,27,1,105,110,110,109,108,148,107,106, +1,2,2,1,1,1,1,1,1,1,1,3,11,1,1,93,4,133,17,1, +172,172,172,172,172,172,172,43,44,137,45,91,93,135,92,161, +111,112,95,111,112, +128,126, +113,97, +114,98, +85,85,86,37, +172,172,172,172,172,172,172,43,44,100,45,103,161, +172,172,172,172,172,172,172,43,44,101,45,99,161, +140,102, +13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,103,26,1,26, +13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,104,25,1,25, +115,115,116,147, +36,57,57,36,36,36,36,36,36,36,36,36,36,36,36,36,36,58,11,106,22,1,99,150, +36,57,57,36,36,36,36,36,36,36,36,36,36,36,36,36,36,58,11,107,22,1,99,149, +172,172,172,172,172,172,172,121,121,43,44,119,118,144,117,120,120,145,153, + 123,122,121, +146,103,103,146,146,146,146,146,146,146,146,146,146,146,146,146,146,104,11, + 109,27,1,105,142,108,148,107,106, +143,139,110, +179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179, + 179,179,179,179,179,179,179,179,179,179,179,111,124, +5,112, +1,2,2,1,1,1,1,1,1,1,1,1,3,11,113,4,93,17,1, +1,2,2,1,1,1,1,1,1,1,1,3,11,114,4,105,17,1, +13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,115,29,1,29, +13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,116,28,1,28, +173,173,174,173,173,173,173,173,173,152, +110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, + 110,110,110,110,110,110,110,110,110,110,110,118,125, +30,30,30,126,30,11,119,30,30,1,30,126, +36,57,57,36,36,36,36,36,36,36,36,36,36,36,36,36,36,58,11,120,22,1,99,151, +77,30,30,30,77,77,77,77,77,77,77,77,30,11,121,30,30,1,30,159, +172,172,172,172,172,172,172,43,44,122,45,156,161, +57,57,127,127,58,11,123,22,1,128,127, +180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180, + 180,180,180,180,180,180,180,180,180,180,178, +112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,129,51, + 113,112,112,112,112,112,112,109,52,112,119,125,111,111,50,49, +118,126,108, +119,118,127,129,129, +85,85,154,37,154,37,86,128, +57,57,36,36,58,11,129,22,1,99,155, + +}; + + +static const unsigned short ag_sbt[] = { + 0, 26, 57, 96, 135, 139, 158, 197, 236, 266, 269, 280, 290, 311, + 332, 353, 374, 406, 418, 438, 463, 466, 480, 494, 508, 522, 525, 538, + 559, 563, 572, 581, 616, 634, 648, 666, 679, 705, 731, 757, 770, 796, + 828, 853, 880, 907, 917, 942, 957, 960, 991,1018,1045,1077,1114,1123, + 1149,1162,1204,1246,1265,1267,1269,1271,1290,1292,1295,1304,1314,1338, + 1360,1376,1393,1395,1422,1424,1426,1447,1473,1476,1478,1513,1534,1536, + 1546,1549,1591,1633,1651,1654,1672,1674,1686,1716,1736,1752,1757,1759, + 1761,1763,1767,1780,1793,1795,1818,1841,1845,1869,1893,1915,1943,1946, + 1978,1980,1999,2017,2040,2063,2073,2105,2117,2141,2161,2174,2185,2215, + 2250,2253,2258,2266,2277 +}; + + +static const unsigned short ag_sbe[] = { + 20, 56, 92, 131, 138, 155, 193, 232, 251, 267, 275, 285, 305, 326, + 347, 368, 404, 412, 432, 458, 464, 476, 490, 504, 518, 523, 534, 554, + 561, 568, 577, 611, 628, 644, 661, 675, 700, 726, 752, 766, 791, 810, + 848, 878, 905, 916, 937, 954, 959, 990,1016,1043,1075,1108,1121,1144, + 1158,1200,1242,1260,1266,1268,1270,1285,1291,1293,1300,1313,1327,1351, + 1369,1383,1394,1420,1423,1425,1437,1472,1474,1477,1508,1528,1535,1541, + 1548,1587,1629,1646,1653,1667,1673,1680,1705,1731,1745,1754,1758,1760, + 1762,1766,1776,1789,1794,1814,1837,1844,1864,1888,1906,1934,1945,1976, + 1979,1994,2012,2036,2059,2072,2103,2111,2136,2155,2170,2180,2214,2245, + 2251,2255,2265,2272,2277 +}; + + +static const unsigned char ag_fl[] = { + 1,0,1,0,1,8,1,1,1,1,2,1,2,0,1,2,2,1,3,3,2,2,1,3,3,2,2,1,3,3,0,2,3,3,1, + 3,0,1,3,3,3,4,2,3,1,2,2,2,2,1,2,2,2,2,1,2,2,2,2,1,1,1,1,1,1,1,1,1,2,1, + 1,1,2,1,3,1,1,0,1,2,1,1,1,2,1,1,2,2,1,1,1,2,2,6,2,0,1,2,3,5,3,2,3,5,3, + 6,4,1,3,3,0,2,1,1,1,3,3,2,2,1,2,1,2,0,2,1,2,1,2,1,2,1,2,2,1,2,0,1,1,3, + 3,1,2,2,1,2,0,1,1,2,2,3,2,2,2,4,2,1,1,2,1,1,3,3,1,2,2,2,2,2,2,2,1,2,2, + 1,2,0,2,0,2 +}; + +static const unsigned char ag_ptt[] = { + 0, 4, 4, 8, 8, 2, 6, 5, 14, 14, 16, 17, 17, 22, 22, 3, 3, 3, + 3, 3, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 13, 13, 26, 26, 26, 26, + 35, 35, 26, 26, 26, 26, 26, 30, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, + 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 42, 47, 44, 54, 54, 45, 56, 57, + 57, 46, 40, 62, 62, 63, 63, 33, 67, 67, 67, 37, 70, 70, 36, 27, 75, 75, + 75, 31, 38, 39, 29, 81, 81, 32, 32, 32, 32, 34, 34, 34, 34, 80, 7, 86, + 86, 87, 84, 84, 89, 89, 89, 89, 89, 89, 92, 98, 98, 59, 59, 93, 93, 95, + 95,102,102, 96, 96,104,104,108,109,109,110,110, 9,107,111,112,112,115, + 114,114,119,119,117,117,117,117,120,121,118,118,123,127,127,124, 28, 28, + 122,122,128,128,128,128,128,128,128,128, 1, 1, 1,135,135, 10, 10,139, + 139 +}; + + +static void ag_ra(void) +{ + switch(ag_rpx[(PCB).ag_ap]) { + case 1: ag_rp_1(); break; + case 2: ag_rp_2(); break; + case 3: ag_rp_3(); break; + case 4: ag_rp_4(VS(1)); break; + case 5: ag_rp_5(); break; + case 6: ag_rp_6(); break; + case 7: ag_rp_7(); break; + case 8: ag_rp_8(); break; + case 9: ag_rp_9(); break; + case 10: ag_rp_10(VS(0)); break; + case 11: ag_rp_11(VS(0)); break; + case 12: ag_rp_12(); break; + case 13: ag_rp_13(VS(1)); break; + case 14: ag_rp_14(VS(1)); break; + case 15: ag_rp_15(VS(0)); break; + case 16: ag_rp_16(VS(0)); break; + case 17: ag_rp_17(); break; + case 18: ag_rp_18(VS(1)); break; + case 19: ag_rp_19(VS(1)); break; + case 20: ag_rp_20(); break; + case 21: ag_rp_21(); break; + case 22: ag_rp_22(); break; + case 23: ag_rp_23(); break; + case 24: ag_rp_24(); break; + case 25: ag_rp_25(); break; + case 26: ag_rp_26(); break; + case 27: ag_rp_27(); break; + case 28: ag_rp_28(); break; + case 29: ag_rp_29(); break; + case 30: ag_rp_30(); break; + case 31: ag_rp_31(); break; + case 32: ag_rp_32(); break; + case 33: ag_rp_33(VS(2)); break; + case 34: ag_rp_34(); break; + case 35: ag_rp_35(); break; + case 36: ag_rp_36(); break; + case 37: ag_rp_37(); break; + case 38: ag_rp_38(); break; + case 39: ag_rp_39(); break; + case 40: ag_rp_40(); break; + case 41: ag_rp_41(VS(2)); break; + case 42: ag_rp_42(); break; + case 43: ag_rp_43(); break; + case 44: ag_rp_44(); break; + case 45: ag_rp_45(VS(2)); break; + case 46: ag_rp_46(); break; + case 47: ag_rp_47(); break; + case 48: ag_rp_48(VS(0)); break; + case 49: ag_rp_49(); break; + case 50: ag_rp_50(); break; + case 51: ag_rp_51(); break; + case 52: ag_rp_52(); break; + case 53: ag_rp_53(); break; + case 54: ag_rp_54(VS(1)); break; + case 55: VS(0) = ag_rp_55(VS(0)); break; + case 56: VS(0) = ag_rp_56(VS(0), VS(1)); break; + case 57: ag_rp_57(); break; + case 58: ag_rp_58(VS(0)); break; + case 59: ag_rp_59(VS(0)); break; + case 60: ag_rp_60(VS(1)); break; + case 61: ag_rp_61(); break; + case 62: ag_rp_62(VS(0)); break; + case 63: ag_rp_63(VS(1)); break; + case 64: ag_rp_64(); break; + case 65: ag_rp_65(); break; + case 66: ag_rp_66(); break; + case 67: ag_rp_67(); break; + case 68: ag_rp_68(); break; + case 69: ag_rp_69(VS(1)); break; + case 70: ag_rp_70(); break; + case 71: ag_rp_71(); break; + case 72: ag_rp_72(VS(0)); break; + case 73: VS(0) = ag_rp_73(VS(1)); break; + case 74: VS(0) = ag_rp_74(VS(1)); break; + case 75: VS(0) = ag_rp_75(); break; + case 76: VS(0) = ag_rp_76(); break; + case 77: VS(0) = ag_rp_77(); break; + case 78: VS(0) = ag_rp_78(); break; + case 79: VS(0) = ag_rp_79(); break; + case 80: VS(0) = ag_rp_80(VS(1)); break; + case 81: VS(0) = ag_rp_81(VS(1)); break; + case 82: ag_rp_82(VS(0)); break; + case 83: ag_rp_83(VS(1)); break; + case 84: ag_rp_84(); break; + case 85: VS(0) = ag_rp_85(VS(0)); break; + case 86: VS(0) = ag_rp_86(VS(0), VS(1)); break; + case 87: ag_rp_87(); break; + case 88: ag_rp_88(); break; + case 89: ag_rp_89(VS(1)); break; + } +} + +#define TOKEN_NAMES y2ag_token_names +const char *const y2ag_token_names[147] = { + "grammar", + "name", + "grammar", + "elc", + "", + "definition block", + "mark", + "c code block", + "", + "rule section", + "tail", + "eof", + "\"%%\"", + "definitions", + "white", + "", + "comment", + "comment text", + "\"*/\"", + "\"/*\"", + "anything", + "", + "", + "", + "blc", + "clc", + "definition", + "start", + "identifier", + "union", + "union text", + "token", + "print token list", + "left", + "print prec list", + "", + "right", + "nonassoc", + "type", + "type name", + "expect statement", + "'{'", + "decl", + "'}'", + "decl name", + "decl white", + "decl star", + "decl term", + "", + "", + "", + "", + "", + "';'", + "", + "'*'", + "", + "", + "\"%expect\"", + "number", + "\"%left\"", + "\"%<\"", + "", + "", + "\"%nonassoc\"", + "\"%binary\"", + "\"%2\"", + "", + "\"%right\"", + "\"%>\"", + "", + "\"%start\"", + "\"%token\"", + "\"%term\"", + "\"%0\"", + "", + "\"%type\"", + "'<'", + "'>'", + "\"%union\"", + "tag", + "", + "','", + "\"%{\"", + "c text", + "\"%}\"", + "action", + "embedded c", + "'='", + "c char", + "simple c char", + "'$'", + "c code comment", + "nested c text", + "'\\''", + "c literal character", + "literal string", + "'\\\"'", + "c code comment text", + "digit", + "", + "'\\\\'", + "octal digits", + "", + "string character", + "", + "", + "production", + "", + "", + "", + "production head", + "complete rules", + "':'", + "complete rule", + "rule set continuation", + "'|'", + "rule", + "explicit precedence", + "", + "rule name continuation", + "rule literal continuation", + "literal", + "explicit precedence head", + "prec", + "\"%prec\"", + "\"%=\"", + "", + "literal character", + "'n'", + "'r'", + "'b'", + "'t'", + "'f'", + "", + "octal number", + "", + "", + "dot", + "tail code", + "", + "", + "", + "", + "", + "", + "", + +}; + +#ifndef MISSING_FORMAT +#define MISSING_FORMAT "Missing %s" +#endif +#ifndef UNEXPECTED_FORMAT +#define UNEXPECTED_FORMAT "Unexpected %s" +#endif +#ifndef UNNAMED_TOKEN +#define UNNAMED_TOKEN "input" +#endif + + +static void ag_diagnose(void) { + int ag_snd = (PCB).sn; + int ag_k = ag_sbt[ag_snd]; + + if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) { + sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); + } + else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8 + && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1 + && *TOKEN_NAMES[ag_tstt[ag_k]]) { + sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); + } + else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) { + sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]); + } + else if (isprint((*(PCB).lab)) && (*(PCB).lab) != '\\') { + char buf[20]; + sprintf(buf, "\'%c\'", (char) (*(PCB).lab)); + sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf); + } + else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN); + (PCB).error_message = (PCB).ag_msg; + + +} +static int ag_action_1_r_proc(void); +static int ag_action_2_r_proc(void); +static int ag_action_3_r_proc(void); +static int ag_action_4_r_proc(void); +static int ag_action_1_s_proc(void); +static int ag_action_3_s_proc(void); +static int ag_action_1_proc(void); +static int ag_action_2_proc(void); +static int ag_action_3_proc(void); +static int ag_action_4_proc(void); +static int ag_action_5_proc(void); +static int ag_action_6_proc(void); +static int ag_action_7_proc(void); +static int ag_action_8_proc(void); +static int ag_action_9_proc(void); +static int ag_action_10_proc(void); +static int ag_action_11_proc(void); +static int ag_action_8_proc(void); + + +static int (*const ag_r_procs_scan[])(void) = { + ag_action_1_r_proc, + ag_action_2_r_proc, + ag_action_3_r_proc, + ag_action_4_r_proc +}; + +static int (*const ag_s_procs_scan[])(void) = { + ag_action_1_s_proc, + ag_action_2_r_proc, + ag_action_3_s_proc, + ag_action_4_r_proc +}; + +static int (*const ag_gt_procs_scan[])(void) = { + ag_action_1_proc, + ag_action_2_proc, + ag_action_3_proc, + ag_action_4_proc, + ag_action_5_proc, + ag_action_6_proc, + ag_action_7_proc, + ag_action_8_proc, + ag_action_9_proc, + ag_action_10_proc, + ag_action_11_proc, + ag_action_8_proc +}; + + +static int ag_action_10_proc(void) { + int ag_t = (PCB).token_number; + (PCB).btsx = 0, (PCB).drt = -1; + do { + ag_track(); + if ((PCB).rx < (PCB).fx) { + (PCB).input_code = (PCB).lab[(PCB).rx++]; + (PCB).token_number = (y2ag_token_type) AG_TCV((PCB).input_code);} + else { + GET_INPUT; + (PCB).lab[(PCB).fx++] = (PCB).input_code; + (PCB).token_number = (y2ag_token_type) AG_TCV((PCB).input_code); + (PCB).rx++; + } + if (ag_key_index[(PCB).sn]) { + unsigned ag_k = ag_key_index[(PCB).sn]; + int ag_ch = CONVERT_CASE((PCB).input_code); + 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(ag_k); + } + } + } while ((PCB).token_number == (y2ag_token_type) ag_t); + (PCB).rx = 0; + return 1; +} + +static int ag_action_11_proc(void) { + int ag_t = (PCB).token_number; + + (PCB).btsx = 0, (PCB).drt = -1; + do { + (PCB).vs[(PCB).ssx] = *(PCB).lab; + (PCB).ssx--; + ag_track(); + ag_ra(); + if ((PCB).exit_flag != AG_RUNNING_CODE) return 0; + (PCB).ssx++; + if ((PCB).rx < (PCB).fx) { + (PCB).input_code = (PCB).lab[(PCB).rx++]; + (PCB).token_number = (y2ag_token_type) AG_TCV((PCB).input_code);} + else { + GET_INPUT; + (PCB).lab[(PCB).fx++] = (PCB).input_code; + (PCB).token_number = (y2ag_token_type) AG_TCV((PCB).input_code); + (PCB).rx++; + } + if (ag_key_index[(PCB).sn]) { + unsigned ag_k = ag_key_index[(PCB).sn]; + int ag_ch = CONVERT_CASE((PCB).input_code); + 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(ag_k); + } + } + } + while ((PCB).token_number == (y2ag_token_type) ag_t); + (PCB).rx = 0; + return 1; +} + +static int ag_action_3_r_proc(void) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + (PCB).btsx = 0, (PCB).drt = -1; + (PCB).reduction_token = (y2ag_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(); + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_3_s_proc(void) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + (PCB).btsx = 0, (PCB).drt = -1; + (PCB).reduction_token = (y2ag_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(); + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_4_r_proc(void) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + (PCB).reduction_token = (y2ag_token_type) ag_ptt[(PCB).ag_ap]; + return 1; +} + +static int ag_action_2_proc(void) { + (PCB).btsx = 0, (PCB).drt = -1; + if ((PCB).ssx >= 128) { + (PCB).exit_flag = AG_STACK_ERROR_CODE; + PARSER_STACK_OVERFLOW; + } + (PCB).vs[(PCB).ssx] = *(PCB).lab; + (PCB).ss[(PCB).ssx] = (PCB).sn; + (PCB).ssx++; + (PCB).sn = (PCB).ag_ap; + ag_track(); + return 0; +} + +static int ag_action_9_proc(void) { + if ((PCB).drt == -1) { + (PCB).drt=(PCB).token_number; + (PCB).dssx=(PCB).ssx; + (PCB).dsn=(PCB).sn; + } + ag_prot(); + (PCB).vs[(PCB).ssx] = ag_null_value; + (PCB).ss[(PCB).ssx] = (PCB).sn; + (PCB).ssx++; + (PCB).sn = (PCB).ag_ap; + (PCB).rx = 0; + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_2_r_proc(void) { + (PCB).ssx++; + (PCB).sn = (PCB).ag_ap; + return 0; +} + +static int ag_action_7_proc(void) { + --(PCB).ssx; + (PCB).rx = 0; + (PCB).exit_flag = AG_SUCCESS_CODE; + return 0; +} + +static int ag_action_1_proc(void) { + ag_track(); + (PCB).exit_flag = AG_SUCCESS_CODE; + return 0; +} + +static int ag_action_1_r_proc(void) { + (PCB).exit_flag = AG_SUCCESS_CODE; + return 0; +} + +static int ag_action_1_s_proc(void) { + (PCB).exit_flag = AG_SUCCESS_CODE; + return 0; +} + +static int ag_action_4_proc(void) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + (PCB).reduction_token = (y2ag_token_type) ag_ptt[(PCB).ag_ap]; + (PCB).btsx = 0, (PCB).drt = -1; + (PCB).vs[(PCB).ssx] = *(PCB).lab; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + else (PCB).ss[(PCB).ssx] = (PCB).sn; + ag_track(); + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break; + } + return 0; +} + +static int ag_action_3_proc(void) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + (PCB).btsx = 0, (PCB).drt = -1; + (PCB).vs[(PCB).ssx] = *(PCB).lab; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + else (PCB).ss[(PCB).ssx] = (PCB).sn; + ag_track(); + (PCB).reduction_token = (y2ag_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(); + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break; + } + return 0; +} + +static int ag_action_8_proc(void) { + ag_undo(); + (PCB).rx = 0; + (PCB).exit_flag = AG_SYNTAX_ERROR_CODE; + ag_diagnose(); + SYNTAX_ERROR; + {(PCB).rx = 1; ag_track();} + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_5_proc(void) { + int ag_sd = ag_fl[(PCB).ag_ap]; + (PCB).btsx = 0, (PCB).drt = -1; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + else { + (PCB).ss[(PCB).ssx] = (PCB).sn; + } + (PCB).rx = 0; + (PCB).reduction_token = (y2ag_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(); + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break; + } + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_6_proc(void) { + int ag_sd = ag_fl[(PCB).ag_ap]; + (PCB).reduction_token = (y2ag_token_type) ag_ptt[(PCB).ag_ap]; + if ((PCB).drt == -1) { + (PCB).drt=(PCB).token_number; + (PCB).dssx=(PCB).ssx; + (PCB).dsn=(PCB).sn; + } + if (ag_sd) { + (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + } + else { + ag_prot(); + (PCB).vs[(PCB).ssx] = ag_null_value; + (PCB).ss[(PCB).ssx] = (PCB).sn; + } + (PCB).rx = 0; + 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]])() == 0) break; + } + return (PCB).exit_flag == AG_RUNNING_CODE; +} + + +void init_y2ag(void) { + (PCB).rx = (PCB).fx = 0; + (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0; + (PCB).exit_flag = AG_RUNNING_CODE; + (PCB).line = FIRST_LINE; + (PCB).column = FIRST_COLUMN; + (PCB).btsx = 0, (PCB).drt = -1; +} + +void y2ag(void) { + init_y2ag(); + (PCB).exit_flag = AG_RUNNING_CODE; + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbt[(PCB).sn]; + if (ag_tstt[ag_t1]) { + unsigned ag_t2 = ag_sbe[(PCB).sn] - 1; + if ((PCB).rx < (PCB).fx) { + (PCB).input_code = (PCB).lab[(PCB).rx++]; + (PCB).token_number = (y2ag_token_type) AG_TCV((PCB).input_code);} + else { + GET_INPUT; + (PCB).lab[(PCB).fx++] = (PCB).input_code; + (PCB).token_number = (y2ag_token_type) AG_TCV((PCB).input_code); + (PCB).rx++; + } + if (ag_key_index[(PCB).sn]) { + unsigned ag_k = ag_key_index[(PCB).sn]; + int ag_ch = CONVERT_CASE((PCB).input_code); + 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(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]])(); + } +} + +