Mercurial > ~dholland > hg > ag > index.cgi
diff tests/agcl/examples/good/ts.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/examples/good/ts.cpp Sat Dec 22 17:52:45 2007 -0500 @@ -0,0 +1,3135 @@ +/* + * AnaGram, a System for Syntax Directed Programming + * C Macro preprocessor and parser + * TS.SYN: Token Scanner Module + * + * Copyright 1993-2000 Parsifal Software. All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#include "mpp.h" + + +// context structure for diagnostics + +struct location { unsigned line, column; }; + + +/* + * 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 TS_H +#include "ts.h" +#endif + +#ifndef TS_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]) + + +#define CHANGE_REDUCTION(x) ts_change_reduction(ts_##x##_token) +int ts_change_reduction(ts_token_type); + + +#line - "ts.syn" + // Embedded C +#include "array.h" // \AnaGram\classlib\include\array.h +#include "stack.h" // \AnaGram\classlib\include\stack.h +#if defined(__MSDOS__) || defined(__WIN32__) +#include <io.h> // If not found, not necessary +#endif +#include <sys/types.h> // If not found, not necessary +#include <sys/stat.h> +#include <fcntl.h> + + +// Macro Definitions + +#define SYNTAX_ERROR syntax_error_scanning(PCB.error_message) +#define GET_CONTEXT (CONTEXT.line = PCB.line, CONTEXT.column = PCB.column) +#define GET_INPUT (PCB.input_code = getc(input.file)) +#define PCB input.pcb + + +// Structure Definition + +struct file_descriptor { + char *name; // name of file + FILE *file; // source of input characters + ts_pcb_type pcb; // parser control block for file +}; + +typedef stack<file_descriptor> file_descriptor_stack; + +// Static Data Declarations + +static const char *error_modifier = ""; +static file_descriptor input; +static stack<token_sink *> save_sink(5); +static file_descriptor_stack active_files(20); + +// Syntax Error Reporting +/* + syntax_error() provides an error diagnostic procedure for those + parsers which are called by the token scanner. error_modifier is set + by expand() so that an error encountered during a macro expansion + will be so described. Otherwise, the diagnostic will not make + sense. + + Since all other parsers are called from reduction procedures, the + line and column number of the token they are dealing with is given + by the context of the token scanner production that is being + reduced. +*/ + +void syntax_error(const char *msg) { + printf("%s: Line %d, Column %d: %s%s\n", + input.name, CONTEXT.line, CONTEXT.column, msg, error_modifier); +} + +/* + syntax_error_scanning() provides an error diagnostic procedure for + the token scanner itself. The locus of the error is given by the + current line and column number of the token scan, as given in the + parser control block. +*/ + +static void syntax_error_scanning(const char *msg) { + printf("%s: Line %d, Column %d: %s\n", + input.name, PCB.line, PCB.column, msg); +} + + +// Support for Reduction Procedures +/* + name_token() looks up the name string in the string accumulator, + identifies it in the token dictionary, checks to see if it is a + reserved word, and creates a token. +*/ + +static token name_token(void) { + token t; + t.id = NAME; + t.handle = td << sa.top(); + --sa; + if (t.handle <= n_reserved_words) t.id = reserved_words[t.handle].id; + return t; +} + +/* + op() creates a token for a punctuation character. +*/ + +static token op(unsigned x) { + token t; + t.id = (token_id) x; + t.handle = token_handles[x]; + return t; +} + +/* + space_op() creates a token for a space character. Note that a space + could be a tab, vertical tab, or form feed character as well as a + blank. +*/ + +static token space_op(unsigned x) { + token t; + t.id = (token_id) ' '; + t.handle = token_handles[x]; + return t; +} + +/* + tkn() creates a token with a specified id for the string on the top + of the string accumulator +*/ + +static token tkn(token_id id) { + token t; + t.id = id; + t.handle = td << sa.top(); + --sa; + return t; +} + + +// Macro Processing Procedures + +/* + check_defined() looks up the name on the string accumulator to see if + it is the name of a macro. It then selects a reduction token according + to the outcome of the test and an input flag. +*/ + +static void check_defined(int flag) { + unsigned id = macro_id[td[sa.top()]]; + --sa; + flag ^= id != 0; + if (flag) CHANGE_REDUCTION(false_condition); + else CHANGE_REDUCTION(true_condition); +} + +/* + defined() returns a decimal constant token equal to one or zero + depending on whether the token named on the string accumulator is or + is not defined as a macro +*/ + +static token defined(void) { + unsigned id = macro_id[td[sa.top()]]; + token t; + t.id = DECconstant; + t.handle = id ? one_value : zero_value; + --sa; + return t; +} + +/* + expand() expands and outputs a macro. t.handle is the token dictionary + index of the macro name. n is the number of arguments found. + + Since it is possible that scanner sink is pointing to ta, it is + necessary to pop the expanded macro from ta before passing it on to + scanner_sink. Otherwise, we would have effectively ta << ta, a + situation which causes an infinite loop. +*/ + +static void expand(token t, unsigned n) { + error_modifier = " in macro expansion"; // fix error diagnostic + expand_macro(t,n); // Defined in MAS.SYN + if (size(ta)) { + array<token> x(ta,size(ta) + 1); + --ta; + *scanner_sink << x; + } else --ta; + error_modifier = ""; +} + +/* + Look up the name string on the string accumulator. Determine whether + it is a reserved word, or a simple identifier. Then determine + whether it is the name of a macro. +*/ + +static token id_macro(void) { + token t; + unsigned id; + + t.id = NAME; + t.handle = td << sa.top(); + --sa; + if (t.handle <= n_reserved_words) t.id = reserved_words[t.handle].id; + + if (if_clause && t.handle == defined_value) { + CHANGE_REDUCTION(defined); + return t; + } + id = macro_id[t.handle]; + if (id == 0) return t; + + if (macro[id].parens) CHANGE_REDUCTION(macro); + else CHANGE_REDUCTION(simple_macro); + return t; +} + +/* + Start a macro definition. This procedure defines all but the body of + the macro. + + nargs is the count of parameters that were found. flag is set if + the macro was defined with parentheses. + + The parameter names are on the string accumulator, with the last + name on the top of the stack, so they must be popped off, identified + and stored in reverse order. + + The name of the macro is beneath the parameter names on the string + accumulator. + + Before returning, this procedure saves the current value of + scanner_sink, increments the level on the token stack and sets + scanner_sink so that subsequent tokens produced by the token scanner + will accumulate on the token stack. These tokens comprise the body + of the macro. When the end of the macro body is encountered, the + procedure save_macro_body will remove them from the token stack and + restore the value of scanner_sink. +*/ + +static int init_macro_def(int nargs, int flag) { + int k; + int id = ++n_macros; + unsigned name; + unsigned *arg_list = nargs ? new unsigned[nargs] : NULL; + + assert(id < N_MACROS); + for (k = nargs; k--;) { + arg_list[k] = td << sa.top(); + --sa; + } + + macro[id].arg_names = arg_list; + macro[id].n_args = nargs; + + macro[id].name = name = td << sa.top(); + --sa; + + macro_id[name] = id; + + macro[id].busy_flag = 0; + macro[id].parens = flag ; + + save_sink << scanner_sink; + scanner_sink = &++ta; + return id; +} + +/* + save_macro_body() finishes the definition of a macro by making a + permanent copy of the token string on the token accumulator. It then + restores the scanner_sink to the value it had when the macro + definition was encountered. +*/ + +static void save_macro_body(int id) { + macro[id].body = size(ta) ? copy(ta) : NULL; + --ta; + save_sink >> scanner_sink; +} + +/* + undefine() deletes the macro definition for the macro whose name is + on the top of the string accumulator. If there is no macro with the + given name, undefine simply returns. + + Otherwise, it frees the storage associated with the macro. It then + fills the resulting hole in the table with the last macro in the + table. The macro_id table is updated appropriately. +*/ + +static void undefine(void) { + unsigned name = td << sa.top(); + int id = macro_id[name]; + --sa; + if (id == 0) return; + macro_id[name] = 0; + if (macro[id].arg_names) delete [] macro[id].arg_names; + if (macro[id].body) delete [] macro[id].body; + macro[id] = macro[n_macros--]; + macro_id[macro[id].name] = id; +} + + +// Include file procedures + +/* + file_name() interprets the file name provided by an #include + statement. If the file name is enclosed in <> brackets it scans the + directory list in paths to try to find the file. If it finds it, it + prefixes the path to the file name. + + If the file name is enclosed in "" quotation marks, file_name() + simply strips the quotation marks. + + If file_name() succeeds, it returns 1 and provides path-name in the + string accumulator, otherwise it returns 0 and nothing in the string + accumulator. + + Note that file name uses a temporary string accumulator, lsa. +*/ + +static int file_name(char *file) { + int c; + int tc; + string_accumulator lsa(100); // for temporary storage of name + + while (*file == ' ') file++; + tc = *file++; + if (tc == '<') tc = '>'; + else if (tc != '"') return 0; + while ((c = *file++) != 0 && c != tc) lsa << c; + if (c != tc) return 0; + if (tc == '"') { + int k, n; + active_files << input; + n = size(active_files); + + while (n--) { + FILE *f; +#ifdef _MSC_VER //Cope with peculiarity of MSVC++ + char *cp; + int junk; + + ++sa << ((file_descriptor *)active_files)[n].name; + k = size(sa); + cp = (char *)sa; + while (k-- && cp[k] != '\\' && cp[k] != '/') { sa >> junk;} +#else + ++sa << active_files[n].name; + while (size(sa) && sa[0] != '\\' && sa[0] != '/') { + sa >> k; // strip off current file name to leave only path + } +#endif + sa << lsa; // append desired file name + f = fopen(sa.top(),"rt"); + if (f != NULL) { + fclose(f); + active_files >> input; + return 1; + } + --sa; + } + active_files >> input; + } + int k, n; + n = size(paths); + for (k = 0; k < n; k++) { + FILE *f; + +#ifdef _MSC_VER //Cope with peculiarity of MSVC++ + ++sa << ((char **) paths)[k]; + char c = ((char *)sa)[size(sa)-1]; + if (size(sa) && c != '\\' && c != '/') sa << '/'; +#else + ++sa << paths[k]; + if (size(sa) && sa[0] != '\\' && sa[0] != '/') sa << '/'; +#endif + sa << lsa; + f = fopen(sa.top(),"rt"); + if (f != NULL) { + fclose(f); + return 1; + } + --sa; + } + return 0; +} + +/* + include_file() is called in response to a #include statement. + + First, it saves the file_descriptor for the current input. Then it + restores the scanner_sink which was saved prior to accumulating + macro expanded tokens on the token_accumulator. + + When include_file() is called, the argument of the #include + statement exists in the form of tokens on the token accumulator. + These tokens are passed to a token_translator which turns the tokens + into a string on the string accumulator. + + file_name() is then called to distinguish between "" and <> files. + In the latter case, file_name() prefixes a directory path to the name. + The name is then in the string accumulator. + + scan_input() is then called to scan the include file. + + Finally, before returning, the previous file_descriptor is restored. +*/ + +static void include_file(void) { + int flag; + + save_sink >> scanner_sink; // restore scanner_sink + + token_translator tt(&++sa); + tt << ta; // recover string from tokens + --ta; // discard token string + + array<char> file(sa.top(), size(sa)+1); // local copy of string + --sa; + + flag = file_name(file); + + if (!flag) { + fprintf(stderr, "Bad include file name: %s\n", (char *) file); + return; + } + array<char> path(sa.top(), size(sa) + 1); + --sa; + active_files << input; // Save current file + scan_input(path); // recursive call to ts() + active_files >> input; // Restore previous file + return; +} + + +// Conditional compilation procedures + +/* + init_condition() prepares for evaluation the condition expression in + #if and #elif statements. + + It protects scanner_sink by pushing it onto the save_sink stack. + Then it resets the expression evaluatior, condition, and sets + scanner_sink to point to it. + + Finally it sets the if_clause flag so that defined() will be handled + properly. +*/ + +static void init_condition(void) { + save_sink << scanner_sink; + scanner_sink = &reset(condition); + if_clause = 1; +} + +/* + eval_condition() is called to deal with #if and #elif statements. The + init_condition() procedure has redirected scanner output to the + expression evaluator, so eval_condition() restores the previous + scanner destination. + + It then sends an eof token to the expression evaluator, resets + if_clause and reads the value of the condition. Remember that + (long) condition returns the value of the expression. +*/ + +static int eval_condition(void) { + save_sink >> scanner_sink; + condition << op(0); // eof to exp evaluator + if_clause = 0; + return condition != 0L; +} + +/* + In eval_if() and eval_elif() note the use of CHANGE_REDUCTION to + select the appropriate reduction token depending on the outcome of + the condition. +*/ + +static void eval_elif(void) { + if (eval_condition()) CHANGE_REDUCTION(true_else_condition); + else CHANGE_REDUCTION(false_else_condition); +} + +static void eval_if(void) { + if (eval_condition()) CHANGE_REDUCTION(true_condition); + else CHANGE_REDUCTION(false_condition); +} + + +// Do token scan + +/* + scan_input() + 1) opens the specified file, if possible + 2) calls the parser + 3) closes the input file +*/ + +void scan_input(char *path) { + input.file = fopen(path, "rt"); + input.name = path; + if (input.file == NULL) { + fprintf(stderr,"Cannot open %s\n", (char *) path); + return; + } + ts(); + fclose(input.file); +} + +#line - "ts.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 - "ts.syn" + *scanner_sink << op('\n'); +#line - "ts.cpp" +} + +static void ag_rp_2(void) { +#line - "ts.syn" + check_defined(1); +#line - "ts.cpp" +} + +static void ag_rp_3(void) { +#line - "ts.syn" + check_defined(0); +#line - "ts.cpp" +} + +static void ag_rp_4(void) { +#line - "ts.syn" + eval_if(); +#line - "ts.cpp" +} + +static void ag_rp_5(void) { +#line - "ts.syn" + eval_elif(); +#line - "ts.cpp" +} + +static void ag_rp_6(void) { +#line - "ts.syn" + init_condition(); +#line - "ts.cpp" +} + +static void ag_rp_7(void) { +#line - "ts.syn" + init_condition(); +#line - "ts.cpp" +} + +static void ag_rp_8(void) { +#line - "ts.syn" + include_file(); +#line - "ts.cpp" +} + +static void ag_rp_9(void) { +#line - "ts.syn" + undefine(); +#line - "ts.cpp" +} + +static void ag_rp_10(int id) { +#line - "ts.syn" + save_macro_body(id); +#line - "ts.cpp" +} + +static void ag_rp_11(void) { +#line - "ts.syn" + save_sink << scanner_sink, scanner_sink = &++ta; +#line - "ts.cpp" +} + +static int ag_rp_12(void) { +#line - "ts.syn" + return init_macro_def(0,0); +#line - "ts.cpp" +} + +static int ag_rp_13(int n) { +#line - "ts.syn" + return init_macro_def(n,1); +#line - "ts.cpp" +} + +static int ag_rp_14(void) { +#line - "ts.syn" + return 0; +#line - "ts.cpp" +} + +static int ag_rp_15(void) { +#line - "ts.syn" + return 1; +#line - "ts.cpp" +} + +static int ag_rp_16(int n) { +#line - "ts.syn" + return n+1; +#line - "ts.cpp" +} + +static void ag_rp_17(int c) { +#line - "ts.syn" + *scanner_sink << space_op(c); +#line - "ts.cpp" +} + +static void ag_rp_18(void) { +#line - "ts.syn" + *scanner_sink << op('#'); +#line - "ts.cpp" +} + +static void ag_rp_19(void) { +#line - "ts.syn" + *scanner_sink << name_token(); +#line - "ts.cpp" +} + +static void ag_rp_20(token t) { +#line - "ts.syn" + *scanner_sink << t; +#line - "ts.cpp" +} + +static void ag_rp_21(token t) { +#line - "ts.syn" + expand(t,0); +#line - "ts.cpp" +} + +static void ag_rp_22(token t) { +#line - "ts.syn" + *scanner_sink << t; +#line - "ts.cpp" +} + +static void ag_rp_23(token t, int n) { +#line - "ts.syn" + expand(t,n); +#line - "ts.cpp" +} + +static void ag_rp_24(void) { +#line - "ts.syn" + *scanner_sink << defined(); +#line - "ts.cpp" +} + +static void ag_rp_25(void) { +#line - "ts.syn" + *scanner_sink << defined(); +#line - "ts.cpp" +} + +static token ag_rp_26(void) { +#line - "ts.syn" + return id_macro(); +#line - "ts.cpp" +} + +static int ag_rp_27(void) { +#line - "ts.syn" + return 0; +#line - "ts.cpp" +} + +static void ag_rp_28(void) { +#line - "ts.syn" + save_sink << scanner_sink, scanner_sink = &ta; +#line - "ts.cpp" +} + +static int ag_rp_29(int n) { +#line - "ts.syn" + return save_sink >> scanner_sink, n; +#line - "ts.cpp" +} + +static int ag_rp_30(void) { +#line - "ts.syn" + return 1; +#line - "ts.cpp" +} + +static int ag_rp_31(int n) { +#line - "ts.syn" + return n+1; +#line - "ts.cpp" +} + +static void ag_rp_32(void) { +#line - "ts.syn" + ++ta; +#line - "ts.cpp" +} + +static void ag_rp_33(int c) { +#line - "ts.syn" + *scanner_sink << space_op(c); +#line - "ts.cpp" +} + +static void ag_rp_34(void) { +#line - "ts.syn" + *scanner_sink << name_token(); +#line - "ts.cpp" +} + +static void ag_rp_35(void) { +#line - "ts.syn" + *scanner_sink << tkn(STRINGliteral); +#line - "ts.cpp" +} + +static void ag_rp_36(void) { +#line - "ts.syn" + *scanner_sink << tkn(CHARACTERconstant); +#line - "ts.cpp" +} + +static void ag_rp_37(int p) { +#line - "ts.syn" + *scanner_sink << op(p); +#line - "ts.cpp" +} + +static void ag_rp_38(int t) { +#line - "ts.syn" + *scanner_sink << op(t); +#line - "ts.cpp" +} + +static void ag_rp_39(int t) { +#line - "ts.syn" + *scanner_sink << op(t); +#line - "ts.cpp" +} + +static void ag_rp_40(int t) { +#line - "ts.syn" + *scanner_sink << op(t); +#line - "ts.cpp" +} + +static void ag_rp_41(void) { +#line - "ts.syn" + *scanner_sink << tkn(STRINGliteral); +#line - "ts.cpp" +} + +static void ag_rp_42(void) { +#line - "ts.syn" + *scanner_sink << tkn(CHARACTERconstant); +#line - "ts.cpp" +} + +static void ag_rp_43(int p) { +#line - "ts.syn" + *scanner_sink << op(p); +#line - "ts.cpp" +} + +static int ag_rp_44(void) { +#line - "ts.syn" + return ' '; +#line - "ts.cpp" +} + +static void ag_rp_45(void) { +#line - "ts.syn" +if (nest_comments) CHANGE_REDUCTION(comment_head); +#line - "ts.cpp" +} + +static void ag_rp_46(void) { +#line - "ts.syn" + *scanner_sink << op(ANDAND); +#line - "ts.cpp" +} + +static void ag_rp_47(void) { +#line - "ts.syn" + *scanner_sink << op(ANDassign); +#line - "ts.cpp" +} + +static void ag_rp_48(void) { +#line - "ts.syn" + *scanner_sink << op(ARROW); +#line - "ts.cpp" +} + +static void ag_rp_49(void) { +#line - "ts.syn" + *scanner_sink << op(CONCAT); +#line - "ts.cpp" +} + +static void ag_rp_50(void) { +#line - "ts.syn" + *scanner_sink << op(DECR); +#line - "ts.cpp" +} + +static void ag_rp_51(void) { +#line - "ts.syn" + *scanner_sink << op(DIVassign); +#line - "ts.cpp" +} + +static void ag_rp_52(void) { +#line - "ts.syn" + *scanner_sink << op(ELLIPSIS); +#line - "ts.cpp" +} + +static void ag_rp_53(void) { +#line - "ts.syn" + *scanner_sink << op(EQ); +#line - "ts.cpp" +} + +static void ag_rp_54(void) { +#line - "ts.syn" + *scanner_sink << op(ERassign); +#line - "ts.cpp" +} + +static void ag_rp_55(void) { +#line - "ts.syn" + *scanner_sink << op(GE); +#line - "ts.cpp" +} + +static void ag_rp_56(void) { +#line - "ts.syn" + *scanner_sink << op(ICR); +#line - "ts.cpp" +} + +static void ag_rp_57(void) { +#line - "ts.syn" + *scanner_sink << op(LE); +#line - "ts.cpp" +} + +static void ag_rp_58(void) { +#line - "ts.syn" + *scanner_sink << op(LS); +#line - "ts.cpp" +} + +static void ag_rp_59(void) { +#line - "ts.syn" + *scanner_sink << op(LSassign); +#line - "ts.cpp" +} + +static void ag_rp_60(void) { +#line - "ts.syn" + *scanner_sink << op(MODassign); +#line - "ts.cpp" +} + +static void ag_rp_61(void) { +#line - "ts.syn" + *scanner_sink << op(MINUSassign); +#line - "ts.cpp" +} + +static void ag_rp_62(void) { +#line - "ts.syn" + *scanner_sink << op(MULTassign); +#line - "ts.cpp" +} + +static void ag_rp_63(void) { +#line - "ts.syn" + *scanner_sink << op(NE); +#line - "ts.cpp" +} + +static void ag_rp_64(void) { +#line - "ts.syn" + *scanner_sink << op(ORassign); +#line - "ts.cpp" +} + +static void ag_rp_65(void) { +#line - "ts.syn" + *scanner_sink << op(OROR); +#line - "ts.cpp" +} + +static void ag_rp_66(void) { +#line - "ts.syn" + *scanner_sink << op(PLUSassign); +#line - "ts.cpp" +} + +static void ag_rp_67(void) { +#line - "ts.syn" + *scanner_sink << op(RS); +#line - "ts.cpp" +} + +static void ag_rp_68(void) { +#line - "ts.syn" + *scanner_sink << op(RSassign); +#line - "ts.cpp" +} + +static void ag_rp_69(void) { +#line - "ts.syn" + *scanner_sink << tkn(FLOATconstant); +#line - "ts.cpp" +} + +static void ag_rp_70(void) { +#line - "ts.syn" + sa << 'F'; +#line - "ts.cpp" +} + +static void ag_rp_71(void) { +#line - "ts.syn" + sa << 'L'; +#line - "ts.cpp" +} + +static void ag_rp_72(void) { +#line - "ts.syn" + sa << '.'; +#line - "ts.cpp" +} + +static void ag_rp_73(void) { +#line - "ts.syn" + sa << '.'; +#line - "ts.cpp" +} + +static void ag_rp_74(int d) { +#line - "ts.syn" + ++sa << '.' << d; +#line - "ts.cpp" +} + +static void ag_rp_75(int d) { +#line - "ts.syn" + sa << d; +#line - "ts.cpp" +} + +static void ag_rp_76(int d) { +#line - "ts.syn" + sa << d; +#line - "ts.cpp" +} + +static void ag_rp_77(int d) { +#line - "ts.syn" + sa << d; +#line - "ts.cpp" +} + +static void ag_rp_78(int d) { +#line - "ts.syn" + sa << '-' << d; +#line - "ts.cpp" +} + +static void ag_rp_79(int d) { +#line - "ts.syn" + sa << '+' << d; +#line - "ts.cpp" +} + +static void ag_rp_80(int d) { +#line - "ts.syn" + sa << d; +#line - "ts.cpp" +} + +static void ag_rp_81(void) { +#line - "ts.syn" + sa << 'U'; +#line - "ts.cpp" +} + +static void ag_rp_82(void) { +#line - "ts.syn" + sa << 'L'; +#line - "ts.cpp" +} + +static void ag_rp_83(void) { +#line - "ts.syn" + *scanner_sink << tkn(OCTconstant); +#line - "ts.cpp" +} + +static void ag_rp_84(void) { +#line - "ts.syn" + *scanner_sink << tkn(DECconstant); +#line - "ts.cpp" +} + +static void ag_rp_85(void) { +#line - "ts.syn" + *scanner_sink << tkn(HEXconstant); +#line - "ts.cpp" +} + +static void ag_rp_86(void) { +#line - "ts.syn" + ++sa << '0'; +#line - "ts.cpp" +} + +static void ag_rp_87(int d) { +#line - "ts.syn" + sa << d; +#line - "ts.cpp" +} + +static void ag_rp_88(int d) { +#line - "ts.syn" + ++sa << "0X" << d; +#line - "ts.cpp" +} + +static void ag_rp_89(int d) { +#line - "ts.syn" + sa << d; +#line - "ts.cpp" +} + +static void ag_rp_90(int d) { +#line - "ts.syn" + ++sa << d; +#line - "ts.cpp" +} + +static void ag_rp_91(int d) { +#line - "ts.syn" + sa << d; +#line - "ts.cpp" +} + +static void ag_rp_92(void) { +#line - "ts.syn" + sa << '"'; +#line - "ts.cpp" +} + +static void ag_rp_93(void) { +#line - "ts.syn" + ++sa << '"'; +#line - "ts.cpp" +} + +static void ag_rp_94(int c) { +#line - "ts.syn" + sa << c; +#line - "ts.cpp" +} + +static void ag_rp_95(int c) { +#line - "ts.syn" + sa << '\\' << c; +#line - "ts.cpp" +} + +static void ag_rp_96(void) { +#line - "ts.syn" + sa << '\''; +#line - "ts.cpp" +} + +static void ag_rp_97(void) { +#line - "ts.syn" + ++sa << '\''; +#line - "ts.cpp" +} + +static void ag_rp_98(int c) { +#line - "ts.syn" + sa << c; +#line - "ts.cpp" +} + +static void ag_rp_99(int c) { +#line - "ts.syn" + sa << '\\' << c; +#line - "ts.cpp" +} + +static void ag_rp_100(int c) { +#line - "ts.syn" + ++sa << c; +#line - "ts.cpp" +} + +static void ag_rp_101(int c) { +#line - "ts.syn" + sa << c; +#line - "ts.cpp" +} + + +#ifndef AG_TRACE_FILE_NAME +#define AG_TRACE_FILE_NAME "ts.etr" +#endif + +static void ag_trace_error(void) { + FILE *ag_file = fopen(AG_TRACE_FILE_NAME, "w"); + int i; + if (ag_file == NULL) return; + fprintf(ag_file, "%d\n", (PCB).ssx); + for (i = 0; i < (PCB).ssx; i++) fprintf(ag_file, "%d\n", (PCB).ss[i]); + fprintf(ag_file, "%d\n", (PCB).sn); + fprintf(ag_file, "%d\n", (PCB).token_number); + fclose(ag_file); +} + + +#define READ_COUNTS +#define WRITE_COUNTS +#undef V +#define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i])) +#undef VS +#define VS(i) (PCB).vs[(PCB).ssx + i] + +#ifndef GET_CONTEXT +#define GET_CONTEXT CONTEXT = (PCB).input_context +#endif + +typedef enum { + ag_action_1, + ag_action_2, + ag_action_3, + ag_action_4, + ag_action_5, + ag_action_6, + ag_action_7, + ag_action_8, + ag_action_9, + ag_action_10, + ag_action_11, + ag_action_12 +} ag_parser_action; + + +#ifndef NULL_VALUE_INITIALIZER +#define NULL_VALUE_INITIALIZER = { 0 } +#endif + +static ts_vs_type const ag_null_value NULL_VALUE_INITIALIZER; + +static const unsigned char ag_rpx[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, + 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, + 0, 15, 16, 17, 0, 0, 18, 0, 0, 19, 0, 0, 0, 0, 0, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, 33, 0, 34, 0, 0, 35, + 36, 0, 37, 38, 39, 0, 40, 41, 42, 0, 43, 0, 0, 44, 0, 0, 0, 0, + 0, 0, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, 0, 70, 71, 0, 0, 0, 0, 72, + 0, 73, 74, 75, 76, 77, 78, 0, 0, 79, 80, 81, 82, 83, 84, 85, 0, 0, + 86, 87, 0, 0, 88, 89, 0, 0, 90, 91, 92, 93, 94, 95, 0, 96, 97, 98, + 99, 0,100,101 +}; + +static const unsigned char ag_key_itt[] = { + 0 +}; + +static const unsigned short ag_key_pt[] = { +0 +}; + +static const unsigned char ag_key_ch[] = { + 0, 47,255, 42, 47,255,100,110,255,102,110,255, 47,100,101,105,108,112, + 117,255,100,110,255,102,110,255,100,101,105,108,112,117,255,105,115,255, + 108,110,114,255,100,110,255,102,110,255, 47,100,101,105,108,112,117,255, + 105,115,255,108,110,114,255,100,110,255,102,110,255, 47,100,101,105,108, + 112,117,255,105,115,255,108,110,114,255,100,110,255,102,110,255,100,101, + 105,108,112,117,255,105,115,255,108,110,114,255,100,110,255,102,110,255, + 100,101,105,108,112,117,255,110,114,255,100,110,255,102,110,255, 47,100, + 101,105,108,112,117,255,110,114,255,100,110,255,102,110,255,100,101,105, + 108,112,117,255 +}; + +static const unsigned char ag_key_act[] = { + 0,3,4,3,3,4,3,3,4,1,3,4,3,3,3,2,3,3,3,4,3,3,4,1,3,4,3,3,2,3,3,3,4,3,3, + 4,2,3,3,4,3,3,4,1,3,4,3,3,2,2,3,3,3,4,3,3,4,2,3,3,4,3,3,4,1,3,4,3,3,2, + 2,3,3,3,4,3,3,4,2,3,3,4,3,3,4,1,3,4,3,2,2,3,3,3,4,3,3,4,2,3,3,4,3,3,4, + 1,3,4,3,2,2,3,3,3,4,3,3,4,3,3,4,1,3,4,3,3,2,2,3,3,3,4,3,3,4,3,3,4,1,3, + 4,3,2,2,3,3,3,4 +}; + +static const unsigned char ag_key_parm[] = { + 0,100, 0, 99,100, 0, 38, 39, 0, 37, 48, 0,100, 46, 50, 0, 49, 51, + 63, 0, 38, 39, 0, 37, 48, 0, 46, 50, 0, 49, 51, 63, 0, 45, 33, 0, + 0, 34, 50, 0, 38, 39, 0, 37, 48, 0,100, 46, 0, 0, 49, 51, 47, 0, + 45, 33, 0, 0, 34, 50, 0, 38, 39, 0, 37, 48, 0,100, 46, 0, 0, 49, + 51, 63, 0, 45, 33, 0, 0, 34, 50, 0, 38, 39, 0, 37, 48, 0, 46, 0, + 0, 49, 51, 47, 0, 45, 33, 0, 0, 34, 50, 0, 38, 39, 0, 37, 48, 0, + 46, 0, 0, 49, 51, 63, 0, 34, 50, 0, 38, 39, 0, 37, 48, 0,100, 46, + 0, 0, 49, 51, 63, 0, 34, 50, 0, 38, 39, 0, 37, 48, 0, 46, 0, 0, + 49, 51, 63, 0 +}; + +static const unsigned short ag_key_jmp[] = { + 0, 0, 0, 2, 4, 0, 19, 22, 0, 6, 26, 0, 6, 8, 14, 9, 32, 36, + 42, 0, 58, 61, 0, 20, 65, 0, 47, 53, 23, 71, 75, 81, 0, 94, 96, 0, + 33, 98,102, 0,106,109, 0, 40,113, 0, 86, 88, 36, 43,119,123,129, 0, + 145,147, 0, 54,149,153, 0,157,160, 0, 61,164, 0,137,139, 57, 64,170, + 174,180, 0,191,193, 0, 75,195,199, 0,203,206, 0, 82,210, 0,185, 78, + 85,216,220,226, 0,240,242, 0, 95,244,248, 0,252,255, 0,102,259, 0, + 234, 98,105,265,269,275, 0,288,292, 0,296,299, 0,118,303, 0,280,282, + 115,121,309,313,319, 0,330,334, 0,338,341, 0,135,345, 0,324,132,138, + 351,355,361, 0 +}; + +static const unsigned char ag_key_index[] = { + 1, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 12, 1, + 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 1, 0, 0, 1, 26, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, + 0, 46, 0, 67, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 88, + 0,108, 0, 0, 1, 0, 0, 1, 0, 0, 46,124, 1, 1, 0, 0, 1, 1, + 1, 0, 0, 1, 1, 1, 0, 0, 0, 88,141, 1, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, + 0, 1, 1, 0, 1 +}; + +static const unsigned char ag_key_ends[] = { +42,0, 47,0, 42,0, 42,0, 101,102,105,110,101,0, 114,114,111,114,0, +101,102,0, 100,101,102,0, 99,108,117,100,101,0, 105,110,101,0, +114,97,103,109,97,0, 110,100,101,102,0, 101,102,105,110,101,0, +114,114,111,114,0, 101,102,0, 100,101,102,0, 99,108,117,100,101,0, +105,110,101,0, 114,97,103,109,97,0, 110,100,101,102,0, 42,0, +101,102,105,110,101,0, 102,0, 101,0, 100,105,102,0, 114,111,114,0, +101,102,0, 100,101,102,0, 99,108,117,100,101,0, 105,110,101,0, +114,97,103,109,97,0, 110,100,101,102,105,110,101,0, 42,0, +101,102,105,110,101,0, 102,0, 101,0, 100,105,102,0, 114,111,114,0, +101,102,0, 100,101,102,0, 99,108,117,100,101,0, 105,110,101,0, +114,97,103,109,97,0, 110,100,101,102,0, 101,102,105,110,101,0, +102,0, 101,0, 100,105,102,0, 114,111,114,0, 101,102,0, +100,101,102,0, 99,108,117,100,101,0, 105,110,101,0, +114,97,103,109,97,0, 110,100,101,102,105,110,101,0, +101,102,105,110,101,0, 102,0, 101,0, 100,105,102,0, 114,111,114,0, +101,102,0, 100,101,102,0, 99,108,117,100,101,0, 105,110,101,0, +114,97,103,109,97,0, 110,100,101,102,0, 42,0, 101,102,105,110,101,0, +100,105,102,0, 114,111,114,0, 101,102,0, 100,101,102,0, +99,108,117,100,101,0, 105,110,101,0, 114,97,103,109,97,0, +110,100,101,102,0, 101,102,105,110,101,0, 100,105,102,0, +114,111,114,0, 101,102,0, 100,101,102,0, 99,108,117,100,101,0, +105,110,101,0, 114,97,103,109,97,0, 110,100,101,102,0, +}; + +#define AG_TCV(x) ag_tcv[(x) + 1] + +static const unsigned char ag_tcv[] = { + 12, 12,148,148,148,148,148,148,148,148, 95, 94, 95, 95, 95,148,148,148, + 148,148,148,148,148,148,148,148,148,148,148,148,148,148,148, 95,112,140, + 31,148,110,101,144, 68, 70,111,108, 72,103,106,105,133,149,149,149,149, + 149,149,149,125,125,148,148,109,102,104,148,148,150,150,150,150,126,117, + 151,151,151,151,151,118,151,151,151,151,151,151,151,151,129,151,151,136, + 151,151,148, 56,148,107,151,148,150,150,150,150,126,117,151,151,151,151, + 151,118,151,151,151,151,151,151,151,151,129,151,151,136,151,151,148,113, + 148,148,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, + 152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, + 152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, + 152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, + 152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, + 152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, + 152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, + 152,152,152,152,152 +}; + +#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 = (ts_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 = (ts_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 = (ts_token_type) ag_key_pt[ag_k1+1]; + break; + } + case ag_set_key: + save_index = (PCB).rx; + (PCB).token_number = (ts_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 = (ts_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 = (ts_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) { + ag_trace_error(); + (PCB).exit_flag = AG_STACK_ERROR_CODE; + PARSER_STACK_OVERFLOW; + return; + } + (PCB).bts[(PCB).btsx] = (PCB).sn; + (PCB).bts[ag_k] = (PCB).ssx; + (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx]; + (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx]; + (PCB).cs[ag_k] = (PCB).cs[(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).cs[(PCB).ssx] = (PCB).cs[ag_k]; + } + (PCB).token_number = (ts_token_type) (PCB).drt; + (PCB).ssx = (PCB).dssx; + (PCB).sn = (PCB).dsn; + (PCB).drt = -1; +} + + + +static const int ag_rtt[] = { + 26, 28, 0, 26, 28, 0, 26, 28, 0, 27, 30, 0, 78, 79, 80, 82, 0, 96, + 98, 0 +}; + +static const unsigned char ag_tstt[] = { +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,94,72,70,68,56,31,12,0,2,5,6,7,8,9, + 10,11,13,14,18,19,20,21,24,26,28,59,62,74,75,76,77,78,79,80,82,88,89,90, + 96,98,114,116,119,121,122,123,130,131,132,135,139,143, +136,0, +149,133,126,125,106,0,120, +149,133,126,125,0,120, +150,149,133,126,125,117,0, +149,133,126,125,106,0,120, +149,133,125,106,0, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,100,99,95,94,72,70,68,56,31,0,96,98, +113,102,0, +102,0, +102,0, +102,0, +109,102,0, +108,102,0, +104,102,0, +102,0, +102,0, +149,133,125,106,0, +102,0, +104,103,102,0, +102,101,0, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,72,70,68,56,31,0, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,72,70,68,56,31,0, +151,150,149,136,133,129,126,125,118,117,0, +129,118,0,128, +129,118,0,128, +129,118,0,128, +118,117,0,115, +94,0, +100,95,68,0,4,14,32,96,97,98, +100,95,68,0,4,14,32,96,97,98, +94,0,5,13, +94,0,5,13, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,94,72,70,68,56,31,12,0,1,14,59,66,67, + 73,74,75,76,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135,139, + 143, +100,95,94,63,51,50,49,48,46,39,38,37,31,12,0,4,14,32,96,97,98, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,18,59,74,75,76, + 77,78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135, + 139,143, +100,95,94,0,13,14,15,16,17,96,98, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,59,74,75,76,77, + 78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135,139, + 143, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,6,8,14,18,19,20, + 21,24,26,28,59,62,74,75,76,77,78,79,80,82,88,89,90,96,98,114,116,119, + 121,122,123,130,131,132,135,139,143, +94,0,5,13, +12,0, +150,149,133,126,125,117,0, +149,133,125,108,103,0,127, +149,133,125,0, +149,133,125,0, +149,133,125,0, +102,0, +102,0, +106,0, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0, +100,95,0,14,96,98, +151,150,136,129,126,118,117,0,59, +68,0, +68,0, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,72,70,68,56,31,0,22,25,27,29,30,35, + 36,54, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,6,8,14,18,19,20, + 21,22,23,24,26,28,44,59,62,74,75,76,77,78,79,80,82,88,89,90,96,98,114, + 116,119,121,122,123,130,131,132,135,139,143, +151,150,149,136,133,129,126,125,118,117,0, +31,0, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,1,14,59,73,74,75,76, + 88,89,90,96,98,114,116,119,121,122,123,130,131,132,135,139,143, +94,63,51,50,49,48,46,39,38,37,12,0,60,64,65, +31,0, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,59,74,75,76,77, + 78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135,139, + 143, +100,95,94,0,13,14,15,96,98, +149,133,125,0, +149,133,125,0, +151,150,149,136,133,129,126,125,118,117,0, +151,150,136,129,126,118,117,100,95,0,4,14,32,96,97,98, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,70,68,31,0,4,14,32,96,97,98, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0,41,42,43, +94,0,5,13, +94,0,5,13, +100,95,94,51,50,49,48,47,46,45,39,38,37,34,33,0,4,14,32,96,97,98, +94,0,5,13, +100,95,94,63,51,50,49,48,46,45,39,38,37,34,33,31,0,4,14,32,96,97,98, +100,95,0,4,14,96,97,98, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,12,0,41,42,43, +100,95,0,4,14,96,97,98, +100,95,0,4,14,96,97,98, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,18,59,74,75,76, + 77,78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135, + 139,143, +100,95,0,4,14,96,97,98, +100,95,0,4,14,96,97,98, +151,150,136,129,126,118,117,0,59, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,70,68,31,0,81,83, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,72,70,68,56,31,0,41, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,72,70,68,56,31,0,22,29,35,36,44,54, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,6,8,14,18,19,20, + 21,22,24,26,28,59,62,74,75,76,77,78,79,80,82,88,89,90,96,98,114,116,119, + 121,122,123,130,131,132,135,139,143, +94,51,50,49,48,47,46,45,39,38,37,34,33,0,40,52,53,61, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,72,70,68,56,31,0,22,29,35,36,44,54, +94,63,51,50,49,48,46,45,39,38,37,34,33,0,60,64,65, +151,150,136,129,126,118,117,0,59, +151,150,136,129,126,118,117,0,59, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,59,74,75,76,77, + 78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135,139, + 143, +151,150,136,129,126,118,117,0,59, +151,150,136,129,126,118,117,0,59, +151,150,149,136,133,129,126,125,118,117,100,95,70,0,4,14,32,96,97,98, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,68,31,0,84,85, +70,0, +100,95,94,51,50,49,48,47,46,45,39,38,37,34,33,0,4,14,32,96,97,98, +100,95,94,63,51,50,49,48,46,39,38,37,34,31,0,4,14,32,96,97,98, +100,95,0,4,14,96,97,98, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,18,59,74,75,76, + 77,78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135, + 139,143, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0,41,42,43, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0,41,42,43, +100,95,94,12,0,4,14,32,96,97,98, +100,95,94,0,4,14,32,96,97,98, +100,95,94,0,4,14,32,96,97,98, +152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, + 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0,41,42,43, +151,150,149,136,133,129,126,125,118,117,68,0, +151,150,149,136,133,129,126,125,118,117,100,95,94,12,0,4,14,32,96,97,98, +151,150,149,136,133,129,126,125,118,117,100,95,94,0,4,14,32,96,97,98, +151,150,149,136,133,129,126,125,118,117,100,95,94,0,4,14,32,96,97,98, +70,0, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,68,31,0,3,59,75,76,86,88,89,90,92,114,116, + 119,121,122,123,130,131,132,135,139,143, +72,0, +94,51,50,49,48,47,46,45,39,38,37,34,33,0,40,52,53, +94,63,51,50,49,48,46,39,38,37,34,0,60,64,65, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,59,74,75,76,77, + 78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135,139, + 143, +151,150,136,129,126,118,117,100,95,70,0,4,14,32,96,97,98, +113,102,0, +102,0, +102,0, +102,0, +109,102,0, +108,102,0, +104,102,0, +102,0, +102,0, +149,133,125,106,0, +102,0, +104,103,102,0, +102,101,0, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,72,70,68,31,0,3,14,59,75,76,87,88,89, + 90,92,96,98,114,116,119,121,122,123,130,131,132,135,139,143, +151,150,149,136,133,129,126,125,118,117,0, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,68,31,0,3,14,59,75,76,87,88,89,90,92, + 96,98,114,116,119,121,122,123,130,131,132,135,139,143, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,68,31,0,4,14,32,96,97,98, +151,150,136,129,126,118,117,70,0,59,69,71, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,68,31,0,85, +151,150,149,136,133,129,126,125,118,117,0, +100,95,72,70,0,4,14,32,96,97,98, +70,0, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,68,31,0,3,59,75,76,86,88,89,90,92,114,116, + 119,121,122,123,130,131,132,135,139,143, +72,0, +151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, + 107,106,105,104,103,102,101,100,95,68,31,0,3,14,59,75,76,87,88,89,90,92, + 96,98,114,116,119,121,122,123,130,131,132,135,139,143, +151,150,136,129,126,118,117,100,95,0,4,14,32,96,97,98, +151,150,136,129,126,118,117,0,59, +151,150,149,136,133,129,126,125,118,117,0, + +}; + + +static unsigned const char ag_astt[2705] = { + 2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,2,2,2,1,1,8,7,1, + 1,1,0,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,3,3,3,3,2,2,1,1,2,2,3,2,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,4,10,10,1,10,2,7,1,10,10,1,10,5,1,10,10,10,10,10,10,5,10,10, + 1,10,2,5,1,10,10,2,3,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,1,3,3,3,3,3,3,3,3,7,2,1,2,2,4,2,4,2,4,2,4,1,2,4,2,2,4,1,2,4,2,4,2,4,2,2, + 2,1,4,2,4,2,2,2,4,2,2,4,10,10,10,10,10,2,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,1,10,7,10,10,10,10,10,10,2,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,1,10,7, + 10,10,10,10,10,10,10,10,10,10,4,2,2,4,3,2,2,4,3,2,2,4,3,2,2,5,2,3,7,1,1,8, + 7,1,1,1,2,1,1,1,1,8,7,1,1,1,2,1,1,1,7,1,1,1,7,1,1,2,2,2,2,2,2,2,1,2,2,2,2, + 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,5,2,2,2,1,1,5,7,1,2,1,1,2,3,3,3,3,2,2,3,2, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,8,8,8,8,8,8,8,8,8,2,5,7,1,1,1,2,1,1,2,2,2, + 2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,7,1,3,1,1,3,3, + 3,3,2,2,1,1,2,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,3,2,1,2,2,2, + 2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,4,3,3,1,3,3,3, + 3,2,2,1,1,2,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,5,1,1,3,3,1,3,3,1,1,1,1,1,1,3,3,3,3,2, + 2,1,1,2,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,3,1,3,7,2,2,2,2,2,2,7,8,8,8,1, + 1,7,1,10,10,10,5,10,10,10,5,10,10,10,5,2,4,2,4,2,7,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,3,2,2,2,2,2,7,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,3,2,2,2,2,2,7,1,9,5,3,2,1,2,2,2,2,2,2,2,5,1,1, + 7,1,4,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,7, + 3,1,3,3,3,3,1,1,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2, + 2,2,1,1,7,1,1,3,3,1,3,3,1,3,1,1,1,1,1,1,1,3,3,3,3,2,2,1,1,2,2,3,2,1,1,1,1, + 1,1,1,1,1,1,1,1,1,10,10,10,10,10,10,10,10,10,10,4,2,4,2,2,2,2,2,2,2,1,2,2, + 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,1,1,5,3,2,1,3,3,3,3,2,2,3,2,1,1, + 1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,2,1,1,1,1,5,7,1,1,3,2,7,2,2,2,2,2,2,2,1,2, + 2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,4,3,3,1,3,3,3,3,2,2,1,1,2, + 2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,5,3,3,3,2,1,2,2,2,7,2,2,2,7,10,10,10, + 10,10,10,10,10,10,10,4,8,8,8,8,8,8,8,1,1,7,1,1,1,2,1,1,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,1,1,5,8,8,7,1,1,1,2,1,1,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,7,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,7,1,1,3,1,7,1,1,1,7,1,1,1,1, + 5,8,8,8,8,8,8,8,8,8,8,8,8,7,1,1,1,2,1,1,1,7,1,1,1,1,5,8,8,8,8,8,8,8,8,8,8, + 8,8,2,7,1,1,1,2,1,1,1,1,7,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,5,7,1,1,3,1,1,7,1,1,2,1,1,1,1,7,2,1,2,1,1,2, + 2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,7,1,3,1,1, + 3,3,3,3,2,2,1,1,2,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,2,1,1,1,1,7,1, + 1,2,1,1,2,2,2,2,2,2,2,7,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,7,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 1,9,5,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 7,3,3,3,1,3,1,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2, + 2,1,1,7,1,1,3,3,1,3,3,1,3,1,1,1,1,1,3,3,3,3,2,2,1,1,2,2,3,2,1,1,1,1,1,1,1, + 1,1,1,1,1,1,5,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,3,3,3,1,3,1,5,1,1,1,1,2,1,1,1,1, + 1,1,1,7,1,1,3,2,2,2,2,2,2,2,7,1,2,2,2,2,2,2,2,7,1,2,2,2,2,2,2,2,1,2,2,2,2, + 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,4,3,3,1,3,3,3,3,2,2,1,1,2,2,3,2, + 1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,7,1,2,2,2,2,2,2,2,7,1,10,10,10,10, + 10,10,10,10,10,10,1,1,8,7,1,1,1,2,1,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,7,1,1,2,7,1,1,5,8,8,8,8,8,8,8,8,8,8,8,8,7,1,1,1,2,1,1, + 1,1,5,8,8,8,8,8,8,8,8,8,8,2,7,1,1,1,2,1,1,1,1,7,2,1,2,1,1,2,2,2,2,2,2,2,1, + 2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,7,1,3,1,1,3,3,3,3,2,2,1, + 1,2,2,3,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,5,1,1,1,1,1,7,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,7,1,1,3,1,1,5,5,7,3,1,3,2,1,1,1,1,5,7,3,1, + 3,2,1,1,1,1,5,7,3,1,3,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,5,1,1,1,1,1,7,1,1,3,10,10,10,10,10,10,10,10,10,10,1,4,10,10,10, + 10,10,10,10,10,10,10,1,1,5,5,7,2,1,2,2,1,1,10,10,10,10,10,10,10,10,10,10,1, + 1,5,7,2,1,2,2,1,1,10,10,10,10,10,10,10,10,10,10,1,1,5,7,2,1,2,2,1,1,2,7,2, + 2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,7,1,1,3,3,1,2,2,3,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,4,5,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,3,5,1,1,1,1,2, + 1,1,1,1,1,7,1,1,3,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3, + 2,2,2,1,1,4,3,3,1,3,3,3,3,2,2,1,1,2,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,8,8,8, + 8,8,8,8,1,1,5,7,1,1,1,2,1,1,2,2,4,2,4,2,4,2,4,1,2,4,2,2,4,1,2,4,2,4,2,4,2, + 2,2,1,4,2,4,2,2,2,4,2,2,4,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,2,10,2,2,1,7,3,2,1,3,3,3,2,2,3,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,10,10, + 10,10,10,10,10,10,10,10,4,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,2,2,1,4,3,2,1,3,3,3,2,2,3,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,1,5,5,7,1,1,1,2,1,1,2,2,2,2,2,2, + 2,4,7,1,1,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,10, + 10,10,10,10,10,10,10,10,10,4,1,1,8,5,7,1,1,1,2,1,1,2,7,2,2,2,2,2,2,2,1,2,2, + 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,7,1,1,3,3,1,2,2,3,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,5,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,4,3, + 2,1,3,3,3,2,2,3,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,8,8,8,8,8,8,8,1,1,7,1,1,1,2, + 1,1,2,2,2,2,2,2,2,7,1,10,10,10,10,10,10,10,10,10,10,4 +}; + + +static const unsigned char ag_pstt[] = { +218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, + 14,19,16,20,7,102,36,136,136,136,28,34,40,0,37,38,33,0,39,39,38,40,36, + 102,37,39,39,32,31,32,31,23,35,101,103,104,100,105,106,30,29,133,134, + 101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, +41,198, +185,185,42,185,179,2,43, +183,183,42,183,175,44, +203,203,203,203,203,203,200, +207,207,42,207,181,204,45, +199,199,184,180,196, +145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145, + 145,145,145,145,145,145,145,145,7,143,145,145,145,145,145,145,145,7,146, + 7, +166,165,136, +164,136, +163,136, +161,136, +46,158,136, +157,167,136, +47,156,136, +155,136, +154,136, +182,182,182,48,136, +152,136, +149,151,162,136, +148,147,136, +215,215,215,215,215,213,215,215,215,215,215,215,215,215,215,215,215,215,215, + 215,215,215,215,215,215,215,215,215,215,215,215,49,215,21, +210,210,210,210,210,210,208,210,210,210,210,210,210,210,210,210,210,210,210, + 210,210,210,210,210,210,210,210,210,210,210,210,50,210,22, +219,219,219,219,219,219,219,219,219,219,111, +191,192,195,201, +191,192,194,205, +191,192,193,197, +174,173,172,170, +137,28, +7,51,53,29,52,51,53,139,51,7, +7,51,54,30,54,51,54,139,51,7, +36,31,55,36, +36,32,56,36, +218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, + 14,19,16,20,7,93,83,136,136,136,28,58,83,33,59,93,57,59,85,94,95,97,98, + 133,134,95,139,7,27,27,3,2,5,6,26,25,24,4,22,21, +7,51,31,60,60,60,60,60,60,60,60,60,150,31,34,60,51,60,139,51,7, +218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, + 14,19,16,20,7,102,136,136,136,28,61,35,62,102,62,23,101,103,104,100,105, + 106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, +7,63,63,13,63,63,63,63,15,139,7, +218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, + 14,19,16,20,7,102,136,136,136,28,61,18,17,102,23,101,103,104,100,105, + 106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, +218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, + 14,19,16,20,7,102,136,136,136,28,34,7,37,33,2,102,37,2,2,32,31,32,31,23, + 35,101,103,104,100,105,106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25, + 24,4,22,21, +36,6,3,36, +8,40, +202,202,202,202,202,202,41, +64,64,64,64,65,42,64, +190,190,190,177, +190,190,190,176, +190,190,190,178, +160,159, +169,168, +153,48, +216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216, + 216,216,216,216,216,216,216,216,216,217,216,216,216,216,216,49, +211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211, + 211,211,211,211,211,211,211,211,211,212,211,211,211,211,211,50, +7,141,142,141,139,7, +218,218,218,218,218,218,218,32,66, +67,53, +68,107, +70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70, + 70,70,70,70,70,70,69,73,55,23,72,27,29,30,29,71,70, +218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, + 14,19,16,20,7,102,136,136,136,28,75,56,37,33,26,102,37,26,26,32,21,74, + 31,32,31,74,23,35,101,103,104,100,105,106,30,29,133,134,101,139,7,27,27, + 3,2,5,6,26,25,24,4,22,21, +219,219,219,219,219,219,219,219,219,219,99, +150,96, +218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, + 14,19,16,20,7,93,136,136,136,28,58,84,82,93,57,94,95,97,98,133,134,95, + 139,7,27,27,3,2,5,6,26,25,24,4,22,21, +78,78,77,77,77,86,76,81,82,79,78,60,80,77,80, +150,61, +218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, + 14,19,16,20,7,102,136,136,136,28,61,73,17,102,23,101,103,104,100,105, + 106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, +7,12,12,14,12,12,12,139,7, +189,189,189,64, +186,186,186,65, +219,219,219,219,219,219,219,219,219,219,110, +83,83,83,83,83,83,83,7,51,67,83,51,83,139,51,7, +84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84, + 84,7,51,31,84,84,68,84,51,84,139,51,7, +66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66, + 66,66,66,66,66,66,66,66,66,69, +86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86, + 86,86,86,43,86,86,86,85,86,70,86,86,62, +36,71,87,36, +36,72,88,36, +7,51,31,89,89,89,89,89,89,89,89,89,89,89,89,73,89,51,89,139,51,7, +36,74,90,36, +7,51,31,91,91,91,91,91,91,91,91,91,91,91,91,150,75,91,51,91,139,51,7, +7,51,76,92,51,139,51,7, +86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86, + 86,86,86,43,86,86,86,85,86,43,77,86,86,79, +7,51,78,93,51,139,51,7, +7,51,79,71,51,139,51,7, +218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, + 14,19,16,20,7,102,136,136,136,28,61,80,94,102,94,23,101,103,104,100,105, + 106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, +7,51,81,95,51,139,51,7, +7,51,82,96,51,139,51,7, +218,218,218,218,218,218,218,83,97, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, + 113,113,113,113,113,113,113,112,113,113,84,99,98, +64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64, + 64,64,64,64,64,64,64,64,64,85, +42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, + 42,42,42,42,42,42,85,42,44,42, +70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70, + 70,70,70,70,70,70,69,100,87,37,46,46,71,47,70, +218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, + 14,19,16,20,7,102,136,136,136,28,101,88,37,33,34,102,37,34,34,32,24,31, + 32,31,23,35,101,103,104,100,105,106,30,29,133,134,101,139,7,27,27,3,2,5, + 6,26,25,24,4,22,21, +59,104,104,104,104,104,104,102,105,105,105,106,107,89,105,104,61,103, +70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70, + 70,70,70,70,70,70,69,100,90,22,50,50,71,49,70, +78,78,77,77,77,86,76,109,81,82,79,106,108,91,80,77,80, +218,218,218,218,218,218,218,92,110, +218,218,218,218,218,218,218,93,111, +218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, + 14,19,16,20,7,102,136,136,136,28,61,69,17,102,23,101,103,104,100,105, + 106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, +218,218,218,218,218,218,218,95,112, +218,218,218,218,218,218,218,96,113, +219,219,219,219,219,219,219,219,219,219,7,51,114,97,114,51,114,139,51,7, +117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117, + 117,117,117,117,117,117,117,117,117,98,116,115, +108,99, +7,51,31,117,117,117,117,117,117,117,117,117,117,117,117,100,117,51,117,139, + 51,7, +7,51,31,118,118,118,118,118,118,118,118,118,118,150,101,118,51,118,139,51,7, +7,51,102,72,51,139,51,7, +218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, + 14,19,16,20,7,102,136,136,136,28,61,103,119,102,119,23,101,103,104,100, + 105,106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, +86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86, + 86,86,86,43,86,86,86,85,86,104,86,86,60, +86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86, + 86,86,86,43,86,86,86,85,86,105,86,86,45, +7,51,31,31,106,35,51,35,139,51,7, +7,51,31,107,33,51,33,139,51,7, +7,51,31,108,52,51,52,139,51,7, +86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86, + 86,86,86,43,86,86,86,85,86,109,86,86,51, +219,219,219,219,219,219,219,219,219,219,120,87, +219,219,219,219,219,219,219,219,219,219,7,51,31,31,111,74,51,74,139,51,7, +219,219,219,219,219,219,219,219,219,219,7,51,31,112,68,51,68,139,51,7, +219,219,219,219,219,219,219,219,219,219,7,51,31,113,67,51,67,139,51,7, +109,114, +218,218,206,128,214,209,218,1,218,218,206,218,218,121,122,123,124,125,126, + 128,130,131,127,132,129,133,130,61,115,136,135,123,124,136,125,126,127, + 134,27,27,3,2,5,6,26,25,24,4,22,21, +137,114, +59,104,104,104,104,104,104,109,105,105,105,106,108,117,105,104,61, +78,78,77,77,77,86,76,81,82,79,106,118,80,77,80, +218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, + 14,19,16,20,7,102,136,136,136,28,61,70,17,102,23,101,103,104,100,105, + 106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, +138,138,138,138,138,138,138,7,51,31,120,138,51,138,139,51,7, +166,165,128, +164,128, +163,128, +161,128, +46,158,128, +157,167,128, +47,156,128, +155,128, +154,128, +182,182,182,48,128, +152,128, +149,151,162,128, +148,147,128, +218,218,206,128,214,209,218,1,218,218,206,218,218,121,122,123,124,125,126, + 128,130,131,127,132,129,133,7,120,132,129,130,61,134,131,120,135,123, + 124,131,125,126,127,134,139,7,27,27,3,2,5,6,26,25,24,4,22,21, +219,219,219,219,219,219,219,219,219,219,122, +218,218,206,128,214,209,218,1,218,218,206,218,218,121,122,123,124,125,126, + 128,130,131,127,132,129,133,7,120,130,61,115,119,120,135,123,124,119, + 125,126,127,134,139,7,27,27,3,2,5,6,26,25,24,4,22,21, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, + 31,7,51,31,31,137,139,51,139,139,51,7, +218,218,218,218,218,218,218,89,138,140,142,141, +117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117, + 117,117,117,117,117,117,117,117,117,139,143, +219,219,219,219,219,219,219,219,219,219,91, +7,51,144,31,141,144,51,144,139,51,7, +88,142, +218,218,206,128,214,209,218,1,218,218,206,218,218,121,122,123,124,125,126, + 128,130,131,127,132,129,133,130,61,143,145,135,123,124,145,125,126,127, + 134,27,27,3,2,5,6,26,25,24,4,22,21, +146,90, +218,218,206,128,214,209,218,1,218,218,206,218,218,121,122,123,124,125,126, + 128,130,131,127,132,129,133,7,120,130,61,116,119,120,135,123,124,119, + 125,126,127,134,139,7,27,27,3,2,5,6,26,25,24,4,22,21, +147,147,147,147,147,147,147,7,51,146,147,51,147,139,51,7, +218,218,218,218,218,218,218,147,148, +219,219,219,219,219,219,219,219,219,219,92, + +}; + + +static const unsigned short ag_sbt[] = { + 0, 80, 82, 89, 95, 102, 109, 114, 153, 156, 158, 160, 162, 165, + 168, 171, 173, 175, 180, 182, 186, 189, 223, 257, 268, 272, 276, 280, + 284, 286, 296, 306, 310, 314, 376, 397, 460, 471, 533, 605, 609, 611, + 618, 625, 629, 633, 637, 639, 641, 643, 678, 713, 719, 728, 730, 732, + 774, 849, 860, 862, 920, 935, 937, 999,1008,1012,1016,1027,1043,1081, + 1116,1154,1158,1162,1184,1188,1211,1219,1258,1266,1274,1337,1345,1353, + 1362,1394,1429,1464,1504,1577,1595,1635,1652,1661,1670,1732,1741,1750, + 1770,1801,1803,1825,1846,1854,1917,1955,1993,2004,2014,2024,2062,2074, + 2095,2115,2135,2137,2187,2189,2206,2221,2283,2300,2303,2305,2307,2309, + 2312,2315,2318,2320,2322,2327,2329,2333,2336,2393,2404,2459,2496,2508, + 2538,2549,2560,2562,2612,2614,2669,2685,2694,2705 +}; + + +static const unsigned short ag_sbe[] = { + 35, 81, 87, 93, 101, 107, 113, 150, 155, 157, 159, 161, 164, 167, + 170, 172, 174, 179, 181, 185, 188, 222, 256, 267, 270, 274, 278, 282, + 285, 289, 299, 307, 311, 349, 390, 430, 463, 504, 566, 606, 610, 617, + 623, 628, 632, 636, 638, 640, 642, 677, 712, 715, 726, 729, 731, 765, + 807, 859, 861, 895, 931, 936, 970,1002,1011,1015,1026,1036,1074,1115, + 1150,1155,1159,1177,1185,1204,1213,1254,1260,1268,1307,1339,1347,1360, + 1391,1428,1462,1497,1537,1590,1628,1648,1659,1668,1703,1739,1748,1763, + 1798,1802,1818,1839,1848,1887,1951,1989,1997,2007,2017,2058,2073,2088, + 2108,2128,2136,2165,2188,2202,2217,2254,2293,2302,2304,2306,2308,2311, + 2314,2317,2319,2321,2326,2328,2332,2335,2368,2403,2434,2489,2504,2536, + 2548,2553,2561,2590,2613,2644,2678,2692,2704,2705 +}; + + +static const unsigned char ag_fl[] = { + 1,1,2,2,1,0,1,1,2,1,1,1,2,0,1,2,1,2,1,1,1,3,5,3,5,1,3,3,1,3,3,0,1,4,3, + 4,1,3,1,1,1,1,2,0,1,4,3,3,1,3,3,4,4,1,1,1,1,1,1,0,2,3,2,1,2,1,2,6,6,4, + 4,2,2,2,6,1,1,1,0,2,3,1,2,0,1,2,3,5,9,0,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,2,6,7,3,1,0,0,2,2,5,0,1,2,1,1,1,1,1,1,1,1,1,2,1,2,2,1,1,1,1,2,1,1, + 1,2,1,2,1,2,2,2,2,2,2,2,2,3,2,2,2,2,2,2,3,2,2,2,2,2,2,2,2,3,2,1,0,1,1, + 1,2,2,2,2,2,2,2,2,2,2,3,0,1,3,2,1,1,1,1,1,1,2,1,2,1,2,3,2,1,2,1,2,2,1, + 2,3,3,2,1,2,3,3,1,2,1 +}; + +static const unsigned char ag_ptt[] = { + 0, 9, 9, 10, 10, 11, 11, 11, 7, 15, 15, 16, 16, 17, 17, 5, 18, 18, + 8, 8, 8, 20, 20, 20, 20, 21, 21, 21, 24, 24, 24, 32, 32, 25, 25, 22, + 29, 29, 40, 40, 40, 42, 42, 43, 43, 36, 36, 36, 23, 23, 23, 44, 44, 52, + 52, 52, 52, 52, 52, 53, 53, 35, 35, 41, 41, 54, 54, 26, 26, 26, 27, 60, + 61, 19, 19, 64, 64, 64, 65, 65, 19, 66, 66, 67, 67, 19, 62, 6, 6, 69, + 69, 71, 71, 1, 1, 1, 1, 1, 1, 73, 2, 2, 2, 2, 2, 77, 77, 77, + 77, 77, 77, 78, 81, 83, 81, 84, 84, 85, 86, 86, 87, 87, 3, 3, 3, 3, + 3, 3, 3, 3, 92, 92, 92, 74, 74, 74, 74, 74, 14, 14, 97, 97, 4, 96, + 98, 98, 96, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 75,114,115,115,115,116,116,116,116,119, + 119,119,119,119,121,121,120,127,127,120,120,128,128, 76, 76, 76,130,130, + 123,123,132,132,135,135,131,131,122,122, 88,139,139,139,139, 89,143,143, + 143,143, 59, 59, 13 +}; + +static const unsigned char *ag_valid(int ag_k) { + const unsigned char *ag_tp = &ag_tstt[ag_sbt[(PCB).sn+1]]; + while (*--ag_tp != (unsigned char) ag_k) if (*ag_tp == 0) return NULL; + return ag_tp; +} + +int ts_change_reduction(ts_token_type ag_k) { + if (!ag_valid(ag_k)) return 0; + (PCB).reduction_token = ag_k; + return 1; +} + +static void ag_default(const int *ag_tp) { + (PCB).ag_dsn = (PCB).sn; + (PCB).ag_dtl = ag_tp; + while (!ag_valid((ts_token_type) *ag_tp)) ag_tp++; + (PCB).reduction_token = (ts_token_type) *ag_tp; +} + + + +static void ag_ra(void) +{ + switch(ag_rpx[(PCB).ag_ap]) { + case 1: ag_rp_1(); break; + case 2: ag_default(&ag_rtt[0]); ag_rp_2(); break; + case 3: ag_default(&ag_rtt[3]); ag_rp_3(); break; + case 4: ag_default(&ag_rtt[6]); ag_rp_4(); break; + case 5: ag_default(&ag_rtt[9]); 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(V(0,(int *))); break; + case 11: ag_rp_11(); break; + case 12: V(0,(int *)) = ag_rp_12(); break; + case 13: V(0,(int *)) = ag_rp_13(V(7,(int *))); break; + case 14: V(0,(int *)) = ag_rp_14(); break; + case 15: V(0,(int *)) = ag_rp_15(); break; + case 16: V(0,(int *)) = ag_rp_16(V(0,(int *))); break; + case 17: ag_rp_17(V(0,(int *))); break; + case 18: ag_rp_18(); break; + case 19: ag_rp_19(); break; + case 20: ag_rp_20(V(0,(token *))); break; + case 21: ag_rp_21(V(0,(token *))); break; + case 22: ag_rp_22(V(0,(token *))); break; + case 23: ag_rp_23(V(0,(token *)), V(4,(int *))); break; + case 24: ag_rp_24(); break; + case 25: ag_rp_25(); break; + case 26: ag_default(&ag_rtt[12]); V(0,(token *)) = ag_rp_26(); break; + case 27: V(0,(int *)) = ag_rp_27(); break; + case 28: ag_rp_28(); break; + case 29: V(0,(int *)) = ag_rp_29(V(1,(int *))); break; + case 30: V(0,(int *)) = ag_rp_30(); break; + case 31: V(0,(int *)) = ag_rp_31(V(0,(int *))); break; + case 32: ag_rp_32(); break; + case 33: ag_rp_33(V(0,(int *))); break; + case 34: ag_rp_34(); break; + case 35: ag_rp_35(); break; + case 36: ag_rp_36(); break; + case 37: ag_rp_37(V(0,(int *))); break; + case 38: ag_rp_38(V(1,(int *))); break; + case 39: ag_rp_39(V(0,(int *))); break; + case 40: ag_rp_40(V(1,(int *))); break; + case 41: ag_rp_41(); break; + case 42: ag_rp_42(); break; + case 43: ag_rp_43(V(0,(int *))); break; + case 44: V(0,(int *)) = ag_rp_44(); break; + case 45: ag_default(&ag_rtt[17]); ag_rp_45(); break; + case 46: ag_rp_46(); break; + case 47: ag_rp_47(); break; + case 48: ag_rp_48(); 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(); break; + case 55: ag_rp_55(); break; + case 56: ag_rp_56(); break; + case 57: ag_rp_57(); break; + case 58: ag_rp_58(); break; + case 59: ag_rp_59(); break; + case 60: ag_rp_60(); break; + case 61: ag_rp_61(); break; + case 62: ag_rp_62(); break; + case 63: ag_rp_63(); 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(); break; + case 70: ag_rp_70(); break; + case 71: ag_rp_71(); break; + case 72: ag_rp_72(); break; + case 73: ag_rp_73(); break; + case 74: ag_rp_74(V(1,(int *))); break; + case 75: ag_rp_75(V(1,(int *))); break; + case 76: ag_rp_76(V(1,(int *))); break; + case 77: ag_rp_77(V(1,(int *))); break; + case 78: ag_rp_78(V(2,(int *))); break; + case 79: ag_rp_79(V(2,(int *))); break; + case 80: ag_rp_80(V(1,(int *))); break; + case 81: ag_rp_81(); break; + case 82: ag_rp_82(); break; + case 83: ag_rp_83(); break; + case 84: ag_rp_84(); break; + case 85: ag_rp_85(); break; + case 86: ag_rp_86(); break; + case 87: ag_rp_87(V(1,(int *))); break; + case 88: ag_rp_88(V(2,(int *))); break; + case 89: ag_rp_89(V(1,(int *))); break; + case 90: ag_rp_90(V(0,(int *))); break; + case 91: ag_rp_91(V(1,(int *))); break; + case 92: ag_rp_92(); break; + case 93: ag_rp_93(); break; + case 94: ag_rp_94(V(1,(int *))); break; + case 95: ag_rp_95(V(2,(int *))); break; + case 96: ag_rp_96(); break; + case 97: ag_rp_97(); break; + case 98: ag_rp_98(V(1,(int *))); break; + case 99: ag_rp_99(V(2,(int *))); break; + case 100: ag_rp_100(V(0,(int *))); break; + case 101: ag_rp_101(V(1,(int *))); break; + } +} + +#define TOKEN_NAMES ts_token_names +const char *const ts_token_names[153] = { + "input file", + "simple token", + "expanded token", + "initial arg element", + "ws", + "eol", + "macro definition header", + "input file", + "section", + "", + "", + "", + "eof", + "newline", + "space", + "", + "", + "", + "", + "control line", + "conditional block", + "true if section", + "endif line", + "skip else section", + "false if section", + "else section", + "true condition", + "true else condition", + "false condition", + "skip section", + "false else condition", + "'#'", + "", + "\"else\"", + "\"endif\"", + "skip line", + "skip if section", + "\"if\"", + "\"ifdef\"", + "\"ifndef\"", + "", + "any text", + "", + "", + "skip else line", + "\"elif\"", + "\"define\"", + "\"undefine\"", + "\"include\"", + "\"line\"", + "\"error\"", + "\"pragma\"", + "", + "", + "not control mark", + "any text char", + "'\\\\'", + "", + "", + "name string", + "if header", + "else if header", + "include header", + "\"undef\"", + "", + "", + "", + "", + "'('", + "parameter list", + "')'", + "names", + "','", + "word", + "separator", + "qualified real", + "integer constant", + "expanded word", + "variable", + "simple macro", + "macro", + "macro arg list", + "defined", + "", + "macro args", + "increment ta", + "arg elements", + "arg element", + "string literal", + "character constant", + "operator", + "", + "nested elements", + "punctuation", + "'\\n'", + "blank", + "comment", + "", + "comment head", + "\"*/\"", + "\"/*\"", + "'&'", + "'='", + "'-'", + "'>'", + "'/'", + "'.'", + "'^'", + "'+'", + "'<'", + "'%'", + "'*'", + "'!'", + "'|'", + "real constant", + "floating qualifier", + "real", + "", + "", + "simple real", + "exponent", + "confusion", + "decimal integer", + "octal integer", + "", + "", + "", + "", + "integer qualifier", + "", + "octal constant", + "decimal constant", + "hex constant", + "'0'", + "", + "hex integer", + "", + "hex digit", + "", + "string chars", + "'\\\"'", + "string char", + "", + "simple chars", + "'\\''", + "simple char", + "letter", + "", + "", + "", + "", + "", + "", + +}; + + +static const unsigned char ag_ctn[] = { + 0,0,135,1,116,1,116,1,135,1,116,1,119,1, 96,1, 90,1, 90,1, 90,1, 90,1, + 90,1, 90,1, 90,1, 90,1, 90,1, 0,0, 90,1, 90,1, 90,1, 89,1, 88,1, 59,1, + 132,1,131,1,130,1, 75,1, 74,1, 77,1, 77,1, 20,1, 20,1, 19,1, 8,1, 19,1, + 5,1, 8,1, 10,1, 10,1, 0,0,135,2,120,1,120,1,120,1,120,1, 90,2, 90,2, + 90,2,143,2,139,2, 4,1, 77,2, 77,2, 77,2, 20,2, 20,2, 59,1, 90,1, 0,0, + 8,2, 90,1, 0,0, 0,0,120,2,120,2, 59,1, 77,3, 77,3, 54,1, 35,1, 29,1, + 25,1, 22,1, 23,1, 8,1, 6,3, 0,0, 19,3, 60,1, 28,3, 28,3, 28,3, 77,4, + 77,4, 41,1, 0,0, 29,2, 25,2, 22,2, 23,2, 8,2, 6,4, 19,4, 0,0, 28,4, + 28,4, 59,1, 81,1, 77,5, 22,1, 8,1, 61,1, 27,3, 0,0, 36,3, 22,3, 25,3, + 44,3, 44,3, 59,1, 59,1, 59,1, 59,1, 77,6, 84,1, 84,1, 22,2, 8,2, 0,0, + 6,6, 90,1, 90,1, 90,1, 90,1, 90,1, 90,1, 90,1, 90,1, 90,1, 3,1, 90,1, + 90,1, 90,1, 3,1, 59,1, 86,1, 84,2, 6,7, 84,3, 59,1, 69,1, 6,8, 84,4, + 71,2, 86,1, 71,3, 71,4, 59,1 +}; + +#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_rns(int ag_t, int *ag_sx, int ag_snd) { + while (1) { + int ag_act, ag_k = ag_sbt[ag_snd], ag_lim = ag_sbt[ag_snd+1]; + int ag_p; + + while (ag_k < ag_lim && ag_tstt[ag_k] != ag_t) ag_k++; + if (ag_k == ag_lim) break; + ag_act = ag_astt[ag_k]; + ag_p = ag_pstt[ag_k]; + if (ag_act == ag_action_2) return ag_p; + if (ag_act == ag_action_10 || ag_act == ag_action_11) { + (*ag_sx)--; + return ag_snd; + } + if (ag_act != ag_action_3 && + ag_act != ag_action_4) break; + *ag_sx -= (ag_fl[ag_p] - 1); + ag_snd = (PCB).ss[*ag_sx]; + ag_t = ag_ptt[ag_p]; + } + return 0; +} + +static int ag_jns(int ag_t) { + int ag_k; + + ag_k = ag_sbt[(PCB).sn]; + while (ag_tstt[ag_k] != ag_t && ag_tstt[ag_k]) ag_k++; + while (1) { + int ag_p = ag_pstt[ag_k]; + int ag_sd; + + switch (ag_astt[ag_k]) { + case ag_action_2: + GET_CONTEXT; + (PCB).ss[(PCB).ssx] = (PCB).sn; + return ag_p; + case ag_action_10: + case ag_action_11: + return (PCB).ss[(PCB).ssx--]; + case ag_action_9: + GET_CONTEXT; + (PCB).ss[(PCB).ssx] = (PCB).sn; + (PCB).ssx++; + (PCB).sn = ag_p; + ag_k = ag_sbt[(PCB).sn]; + while (ag_tstt[ag_k] != ag_t && ag_tstt[ag_k]) ag_k++; + continue; + case ag_action_3: + case ag_action_4: + ag_sd = ag_fl[ag_p] - 1; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + else GET_CONTEXT; + (PCB).ss[(PCB).ssx] = (PCB).sn; + ag_t = ag_ptt[ag_p]; + ag_k = ag_sbt[(PCB).sn+1]; + while (ag_tstt[--ag_k] != ag_t); + continue; + case ag_action_5: + case ag_action_6: + if (ag_fl[ag_p]) break; + (PCB).sn = ag_rns(ag_ptt[ag_p],&(PCB).ssx, (PCB).sn); + (PCB).ss[++(PCB).ssx] = (PCB).sn; + ag_k = ag_sbt[(PCB).sn]; + while (ag_tstt[ag_k] != ag_t && ag_tstt[ag_k]) ag_k++; + continue; + } + break; + } + return 0; +} + + +static int ag_atx(int ag_t, int *ag_sx, int ag_snd) { + int ag_k, ag_f; + int ag_save_btsx = (PCB).btsx; + int ag_flag = 1; + + while (1) { + int ag_a; + + (PCB).bts[128 - ++(PCB).btsx] = *ag_sx; + (PCB).ss[128 - (PCB).btsx] = (PCB).ss[*ag_sx]; + (PCB).ss[*ag_sx] = ag_snd; + ag_k = ag_sbt[ag_snd]; + while (ag_tstt[ag_k] != ag_t && ag_tstt[ag_k]) ag_k++; + ag_a = ag_astt[ag_k]; + if (ag_a == ag_action_2 || + ag_a == ag_action_3 || + ag_a == ag_action_10 || + ag_a == ag_action_11 || + ag_a == ag_action_1 || + ag_a == ag_action_4) break; + if ((ag_a == ag_action_5 || + ag_a == ag_action_6) && + (ag_k = ag_fl[ag_f = ag_pstt[ag_k]]) == 0) { + ag_snd = ag_rns(ag_ptt[ag_f],ag_sx, (PCB).ss[*ag_sx]); + (*ag_sx)++; + continue; + } + if (ag_a == ag_action_9) { + ag_snd = ag_pstt[ag_k]; + (*ag_sx)++; + continue; + } + ag_flag = 0; + break; + } + while ((PCB).btsx > ag_save_btsx) { + *ag_sx = (PCB).bts[128 - (PCB).btsx]; + (PCB).ss[*ag_sx] = (PCB).ss[128 - (PCB).btsx--]; + } + return ag_flag; +} + + +static int ag_tst_tkn(void) { + int ag_rk, ag_sx, ag_snd = (PCB).sn; + + if ((PCB).rx < (PCB).fx) { + (PCB).input_code = (PCB).lab[(PCB).rx++]; + (PCB).token_number = (ts_token_type) AG_TCV((PCB).input_code);} + else { + GET_INPUT; + (PCB).lab[(PCB).fx++] = (PCB).input_code; + (PCB).token_number = (ts_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); + } + } + for (ag_rk = 0; ag_rk < (PCB).ag_lrss; ag_rk += 2) { + ag_sx = (PCB).ag_rss[ag_rk]; + if (ag_sx > (PCB).ssx || ag_sx > (PCB).ag_min_depth) continue; + (PCB).sn = (PCB).ag_rss[ag_rk + 1]; + if (ag_atx((PCB).token_number, &ag_sx, (PCB).sn)) break; + } + (PCB).sn = ag_snd; + return ag_rk; +} + +static void ag_set_error_procs(void); + +static void ag_auto_resynch(void) { + int ag_sx, ag_rk; + int ag_rk1, ag_rk2, ag_tk1; + (PCB).ss[(PCB).ssx] = (PCB).sn; + if ((PCB).ag_error_depth && (PCB).ag_min_depth >= (PCB).ag_error_depth) { + (PCB).ssx = (PCB).ag_error_depth; + (PCB).sn = (PCB).ss[(PCB).ssx]; + } + else { + ag_diagnose(); + SYNTAX_ERROR; + if ((PCB).exit_flag != AG_RUNNING_CODE) return; + (PCB).ag_error_depth = (PCB).ag_min_depth = 0; + (PCB).ag_lrss = 0; + (PCB).ss[ag_sx = (PCB).ssx] = (PCB).sn; + (PCB).ag_min_depth = (PCB).ag_rss[(PCB).ag_lrss++] = ag_sx; + (PCB).ag_rss[(PCB).ag_lrss++] = (PCB).sn; + while (ag_sx && (PCB).ag_lrss < 2*128) { + int ag_t = 0, ag_x, ag_s, ag_sxs = ag_sx; + + while (ag_sx && (ag_t = ag_ctn[2*(PCB).sn]) == 0) (PCB).sn = (PCB).ss[--ag_sx]; + if (ag_t) (PCB).sn = (PCB).ss[ag_sx -= ag_ctn[2*(PCB).sn +1]]; + else { + if (ag_sx == 0) (PCB).sn = 0; + ag_t = ag_ptt[0]; + } + if ((ag_s = ag_rns(ag_t, &ag_sx, (PCB).sn)) == 0) break; + for (ag_x = 0; ag_x < (PCB).ag_lrss; ag_x += 2) + if ((PCB).ag_rss[ag_x] == ag_sx + 1 && (PCB).ag_rss[ag_x+1] == ag_s) break; + if (ag_x == (PCB).ag_lrss) { + (PCB).ag_rss[(PCB).ag_lrss++] = ++ag_sx; + (PCB).ag_rss[(PCB).ag_lrss++] = (PCB).sn = ag_s; + } + else if (ag_sx >= ag_sxs) ag_sx--; + } + ag_set_error_procs(); + } + (PCB).rx = 0; + if ((PCB).ssx > (PCB).ag_min_depth) (PCB).ag_min_depth = (PCB).ssx; + while (1) { + ag_rk1 = ag_tst_tkn(); + if ((PCB).token_number == 12) + {(PCB).exit_flag = AG_SYNTAX_ERROR_CODE; return;} + if (ag_rk1 < (PCB).ag_lrss) break; + {(PCB).rx = 1; ag_track();} + } + ag_tk1 = (PCB).token_number; + ag_track(); + ag_rk2 = ag_tst_tkn(); + if (ag_rk2 < ag_rk1) {ag_rk = ag_rk2; ag_track();} + else {ag_rk = ag_rk1; (PCB).token_number = (ts_token_type) ag_tk1; (PCB).rx = 0;} + (PCB).ag_min_depth = (PCB).ssx = (PCB).ag_rss[ag_rk++]; + (PCB).sn = (PCB).ss[(PCB).ssx] = (PCB).ag_rss[ag_rk]; + (PCB).sn = ag_jns((PCB).token_number); + if ((PCB).ag_error_depth == 0 || (PCB).ag_error_depth > (PCB).ssx) + (PCB).ag_error_depth = (PCB).ssx; + if (++(PCB).ssx >= 128) { + ag_trace_error(); + (PCB).exit_flag = AG_STACK_ERROR_CODE; + PARSER_STACK_OVERFLOW; + return; + } + GET_CONTEXT; + (PCB).ss[(PCB).ssx] = (PCB).sn; + (PCB).ag_tmp_depth = (PCB).ag_min_depth; + (PCB).rx = 0; + return; +} + + +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 = (ts_token_type) AG_TCV((PCB).input_code);} + else { + GET_INPUT; + (PCB).lab[(PCB).fx++] = (PCB).input_code; + (PCB).token_number = (ts_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 == (ts_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 { + (*(int *) &(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 = (ts_token_type) AG_TCV((PCB).input_code);} + else { + GET_INPUT; + (PCB).lab[(PCB).fx++] = (PCB).input_code; + (PCB).token_number = (ts_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 == (ts_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 = (ts_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 = (ts_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 = (ts_token_type) ag_ptt[(PCB).ag_ap]; + return 1; +} + +static int ag_action_2_proc(void) { + (PCB).btsx = 0, (PCB).drt = -1; + if ((PCB).ssx >= 128) { + ag_trace_error(); + (PCB).exit_flag = AG_STACK_ERROR_CODE; + PARSER_STACK_OVERFLOW; + } + (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab; + GET_CONTEXT; + (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; + GET_CONTEXT; + (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 = (ts_token_type) ag_ptt[(PCB).ag_ap]; + (PCB).btsx = 0, (PCB).drt = -1; + (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + else GET_CONTEXT; + (PCB).ss[(PCB).ssx] = (PCB).sn; + ag_track(); + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + if (ag_tstt[ag_t1] != (PCB).reduction_token) { + (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; ag_trace_error(); + REDUCTION_TOKEN_ERROR; break;} + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((*(PCB).s_procs[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; + (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + else GET_CONTEXT; + (PCB).ss[(PCB).ssx] = (PCB).sn; + ag_track(); + (PCB).reduction_token = (ts_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(); + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + if (ag_tstt[ag_t1] != (PCB).reduction_token) { + (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; ag_trace_error(); + REDUCTION_TOKEN_ERROR; break;} + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((*(PCB).s_procs[ag_astt[ag_t1]])() == 0) break; + } + return 0; +} + +static int ag_action_8_proc(void) { + ag_undo(); + ag_trace_error(); + (PCB).rx = 0; + ag_auto_resynch(); + 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 { + GET_CONTEXT; + (PCB).ss[(PCB).ssx] = (PCB).sn; + } + (PCB).rx = 0; + (PCB).reduction_token = (ts_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(); + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + if (ag_tstt[ag_t1] != (PCB).reduction_token) { + (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; ag_trace_error(); + REDUCTION_TOKEN_ERROR; break;} + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((*(PCB).r_procs[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 = (ts_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; + GET_CONTEXT; + (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); + if (ag_tstt[ag_t1] != (PCB).reduction_token) { + (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; ag_trace_error(); + REDUCTION_TOKEN_ERROR; break;} + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((*(PCB).r_procs[ag_astt[ag_t1]])() == 0) break; + } + return (PCB).exit_flag == AG_RUNNING_CODE; +} + + +static void ag_check_depth(int ag_fl) { + int ag_sx = (PCB).ssx - ag_fl; + if ((PCB).ag_error_depth && ag_sx < (PCB).ag_tmp_depth) (PCB).ag_tmp_depth = ag_sx; +} + +static int ag_action_3_er_proc(void) { + ag_check_depth(ag_fl[(PCB).ag_ap] - 1); + return ag_action_4_r_proc(); +} + +static int ag_action_2_e_proc(void) { + ag_action_2_proc(); + (PCB).ag_min_depth = (PCB).ag_tmp_depth; + return 0; +} + +static int ag_action_4_e_proc(void) { + ag_check_depth(ag_fl[(PCB).ag_ap] - 1); + (PCB).ag_min_depth = (PCB).ag_tmp_depth; + return ag_action_4_proc(); +} + +static int ag_action_6_e_proc(void) { + ag_check_depth(ag_fl[(PCB).ag_ap]); + return ag_action_6_proc(); +} + +static int ag_action_11_e_proc(void) { + return ag_action_10_proc(); +} + +static int (*ag_r_procs_error[])(void) = { + ag_action_1_r_proc, + ag_action_2_r_proc, + ag_action_3_er_proc, + ag_action_3_er_proc +}; + +static int (*ag_s_procs_error[])(void) = { + ag_action_1_s_proc, + ag_action_2_r_proc, + ag_action_3_er_proc, + ag_action_3_er_proc +}; + +static int (*ag_gt_procs_error[])(void) = { + ag_action_1_proc, + ag_action_2_e_proc, + ag_action_4_e_proc, + ag_action_4_e_proc, + ag_action_6_e_proc, + ag_action_6_e_proc, + ag_action_7_proc, + ag_action_8_proc, + ag_action_9_proc, + ag_action_10_proc, + ag_action_11_e_proc, + ag_action_8_proc +}; + +static void ag_set_error_procs(void) { + (PCB).gt_procs = ag_gt_procs_error; + (PCB).r_procs = ag_r_procs_error; + (PCB).s_procs = ag_s_procs_error; +} + + +void init_ts(void) { + (PCB).rx = (PCB).fx = 0; + (PCB).gt_procs = ag_gt_procs_scan; + (PCB).r_procs = ag_r_procs_scan; + (PCB).s_procs = ag_s_procs_scan; + (PCB).ag_error_depth = (PCB).ag_min_depth = (PCB).ag_tmp_depth = 0; + (PCB).ag_resynch_active = 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 ts(void) { + init_ts(); + (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 = (ts_token_type) AG_TCV((PCB).input_code);} + else { + GET_INPUT; + (PCB).lab[(PCB).fx++] = (PCB).input_code; + (PCB).token_number = (ts_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]; + (*(PCB).gt_procs[ag_astt[ag_t1]])(); + } +} + +