Mercurial > ~dholland > hg > ag > index.cgi
comparison tests/agcl/oldagsrc/good/asiwdp.cpp @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 /* | |
2 asiwdp.syn | |
3 | |
4 ASI -- A Simple Interpreter | |
5 Copyright (c) 1999 Parsifal Software, All Rights Reserved. | |
6 | |
7 This implementation of ASI uses C++ and was developed | |
8 as part of the ASI Windows Demonstration program to | |
9 illustrate the use of the "reentrant parser" switch | |
10 and the "extend pcb" statement to create a thread-safe | |
11 parser. The example program uses a Microsoft Foundation | |
12 Class program to demonstrate multiple instances of an | |
13 AnaGram parser running concurrently on separate threads. | |
14 | |
15 The expression syntax is borrowed from C but with the | |
16 addition of the FORTRAN exponentiation operator (**). | |
17 | |
18 The cast, increment, and decrement operators are not | |
19 implemented, nor are operations that are defined only | |
20 for integers: | |
21 Bitwise logical operators: &, |, ^, ~, &=, |=, ^= | |
22 Remainder operators: %, %= | |
23 Shift operators: <<, >>, >>=, <<= | |
24 | |
25 The supported operations are: | |
26 Assignment operators: =, +=, -=, *=, /= | |
27 Conditional expressions: ? : | |
28 Logical operators: !, &&, || | |
29 Comparison operators: ==, !=, <, <=, >, >= | |
30 Binary arithmetic operators: +, -, *, / | |
31 Exponentiation: ** | |
32 Unary arithmetic operators: +, - | |
33 Parentheses | |
34 Function calls | |
35 | |
36 All arithmetic is double precision floating point. | |
37 | |
38 Statements may include expression statements, blocks, if/else statements | |
39 or while statements, following the rules of C. | |
40 | |
41 The statement syntax has been written to avoid the conventional | |
42 if/else ambiguity. | |
43 | |
44 There are no declarations. All variables are presumed to be double. | |
45 | |
46 Input strings may contain any number of statements. White space may be | |
47 used freely, including both C and C++ style comments. | |
48 | |
49 asiwd uses the following classes, defined in asiwdef.h: | |
50 CharStack // Used to accumulate variable names | |
51 SymbolTable // Maintains variable names and values | |
52 WhileStack // Maintains state of active while loops | |
53 Location // Records location in source text | |
54 | |
55 The AnaGram parser generator uses asiwdp.syn as a specification to | |
56 create a C++ parser file asiwdp.cpp and a companion header file, | |
57 asiwdp.h. | |
58 | |
59 For information about AnaGram, visit http://www.parsifalsoft.com. | |
60 */ | |
61 | |
62 #include "asiwdef.h" | |
63 | |
64 | |
65 /* | |
66 * AnaGram, A System for Syntax Directed Programming | |
67 * File generated by: ... | |
68 * | |
69 * AnaGram Parsing Engine | |
70 * Copyright 1993-2002 Parsifal Software. All Rights Reserved. | |
71 * | |
72 * This software is provided 'as-is', without any express or implied | |
73 * warranty. In no event will the authors be held liable for any damages | |
74 * arising from the use of this software. | |
75 * | |
76 * Permission is granted to anyone to use this software for any purpose, | |
77 * including commercial applications, and to alter it and redistribute it | |
78 * freely, subject to the following restrictions: | |
79 * | |
80 * 1. The origin of this software must not be misrepresented; you must not | |
81 * claim that you wrote the original software. If you use this software | |
82 * in a product, an acknowledgment in the product documentation would be | |
83 * appreciated but is not required. | |
84 * 2. Altered source versions must be plainly marked as such, and must not be | |
85 * misrepresented as being the original software. | |
86 * 3. This notice may not be removed or altered from any source distribution. | |
87 */ | |
88 | |
89 #ifndef ASIWDP_H | |
90 #include "asiwdp.h" | |
91 #endif | |
92 | |
93 #ifndef ASIWDP_H | |
94 #error Mismatched header file | |
95 #endif | |
96 | |
97 #include <ctype.h> | |
98 #include <stdio.h> | |
99 | |
100 #define RULE_CONTEXT (&((PCB).cs[(PCB).ssx])) | |
101 #define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx]) | |
102 #define CONTEXT ((PCB).cs[(PCB).ssx]) | |
103 | |
104 | |
105 #ifndef PCB_TYPE | |
106 #define PCB_TYPE asi_pcb_type | |
107 #endif | |
108 | |
109 | |
110 #define PCB (*pcb_pointer) | |
111 #define PCB_DECL PCB_TYPE *pcb_pointer | |
112 #define PCB_POINTER pcb_pointer | |
113 #define CHANGE_REDUCTION(x) asi_change_reduction(PCB_POINTER, asi_##x##_token) | |
114 int asi_change_reduction(PCB_DECL, asi_token_type); | |
115 | |
116 | |
117 #line - "asiwdp.syn" | |
118 // begin embedded C | |
119 | |
120 #include <math.h> | |
121 | |
122 // Check for division by zero | |
123 double asi_pcb_type::checkZero(double value) { | |
124 if (value) return value; | |
125 error_message = "Divide by Zero"; | |
126 exit_flag = AG_SEMANTIC_ERROR_CODE; | |
127 return 1; | |
128 } | |
129 | |
130 // external interface to the parser | |
131 int asi_pcb_type::interpret(char *text, SymbolTable *st) { | |
132 symbolTable = st; | |
133 charStack.reset(); | |
134 pointer = (unsigned char *) text; | |
135 asi(this); | |
136 return exit_flag != AG_SUCCESS_CODE; | |
137 } | |
138 | |
139 /* | |
140 locate value of variable whose name is given by the top k characters on the | |
141 character stack. | |
142 Return a pointer so the value can be either fetched or stored | |
143 */ | |
144 | |
145 double *asi_pcb_type::locateValue(int k) { | |
146 double *pointer = &symbolTable->locate(charStack.popString(k)).value; | |
147 if (symbolTable->overflow()) { | |
148 error_message = "Symbol table overflow"; | |
149 exit_flag = AG_SEMANTIC_ERROR_CODE; | |
150 } | |
151 return pointer; | |
152 } | |
153 | |
154 // Encapsulate current location in source text | |
155 Location asi_pcb_type::location() { | |
156 return Location(pointer, line, column); | |
157 } | |
158 | |
159 // Set source file location for loop continuation | |
160 void asi_pcb_type::loopContinue() { | |
161 setLocation(whileStack.continueLocation()); | |
162 } | |
163 | |
164 // Set source file location for loop exit | |
165 void asi_pcb_type::loopExit() { | |
166 setLocation(whileStack.exitLocation()); | |
167 whileStack.pop(); | |
168 } | |
169 | |
170 // Push character onto character stack | |
171 void asi_pcb_type::pushChar(int c) { | |
172 if (charStack.push(c)) { | |
173 error_message = "Name is too long"; | |
174 exit_flag = AG_SEMANTIC_ERROR_CODE; | |
175 } | |
176 } | |
177 | |
178 // Set parse location in source text | |
179 void asi_pcb_type::setLocation(const Location &l) { | |
180 pointer = l.pointer; | |
181 line = l.line; | |
182 column = l.column; | |
183 } | |
184 | |
185 // Save currently active loop, if any, and init nested loop | |
186 void asi_pcb_type::stackLoop(const Location &c) { | |
187 // Current source location is exit location for loop | |
188 // c is the continue location | |
189 if (whileStack.push(c, location())) { | |
190 error_message = "While stack overflow"; | |
191 exit_flag = AG_SEMANTIC_ERROR_CODE; | |
192 } | |
193 setLocation(c); // Set location to loop condition | |
194 } | |
195 | |
196 #line - "asiwdp.cpp" | |
197 | |
198 #ifndef CONVERT_CASE | |
199 #define CONVERT_CASE(c) (c) | |
200 #endif | |
201 #ifndef TAB_SPACING | |
202 #define TAB_SPACING 8 | |
203 #endif | |
204 | |
205 static void ag_rp_1(PCB_DECL, double x) { | |
206 #line - "asiwdp.syn" | |
207 if (x == 0) CHANGE_REDUCTION(false_if_condition); | |
208 #line - "asiwdp.cpp" | |
209 } | |
210 | |
211 #define ag_rp_2(PCB_POINTER, c) (PCB.stackLoop(c)) | |
212 | |
213 #define ag_rp_3(PCB_POINTER, c) (PCB.stackLoop(c)) | |
214 | |
215 #define ag_rp_4(PCB_POINTER) (PCB.location()) | |
216 | |
217 #define ag_rp_5(PCB_POINTER) (PCB.loopExit()) | |
218 | |
219 #define ag_rp_6(PCB_POINTER) (PCB.loopContinue()) | |
220 | |
221 #define ag_rp_7(PCB_POINTER, x) (x == 0 ? CHANGE_REDUCTION(false_while_condition) : 0) | |
222 | |
223 #define ag_rp_8(PCB_POINTER, pointer, x) (*pointer = x) | |
224 | |
225 #define ag_rp_9(PCB_POINTER, pointer, x) (*pointer += x) | |
226 | |
227 #define ag_rp_10(PCB_POINTER, pointer, x) (*pointer -= x) | |
228 | |
229 #define ag_rp_11(PCB_POINTER, pointer, x) (*pointer *= x) | |
230 | |
231 #define ag_rp_12(PCB_POINTER, pointer, x) (*pointer /= x) | |
232 | |
233 #define ag_rp_13(PCB_POINTER, c, x, y) (c ? x : y) | |
234 | |
235 #define ag_rp_14(PCB_POINTER, x, y) (x ? x : y) | |
236 | |
237 #define ag_rp_15(PCB_POINTER, x, y) (x ? y : x) | |
238 | |
239 #define ag_rp_16(PCB_POINTER, x, y) (x == y) | |
240 | |
241 #define ag_rp_17(PCB_POINTER, x, y) (x != y) | |
242 | |
243 #define ag_rp_18(PCB_POINTER, x, y) (x < y) | |
244 | |
245 #define ag_rp_19(PCB_POINTER, x, y) (x <= y) | |
246 | |
247 #define ag_rp_20(PCB_POINTER, x, y) (x > y) | |
248 | |
249 #define ag_rp_21(PCB_POINTER, x, y) (x >= y) | |
250 | |
251 #define ag_rp_22(PCB_POINTER, x, y) (x + y) | |
252 | |
253 #define ag_rp_23(PCB_POINTER, x, y) (x - y) | |
254 | |
255 #define ag_rp_24(PCB_POINTER, x, y) (x * y) | |
256 | |
257 #define ag_rp_25(PCB_POINTER, x, y) (x/PCB.checkZero(y)) | |
258 | |
259 #define ag_rp_26(PCB_POINTER, x) (-x) | |
260 | |
261 #define ag_rp_27(PCB_POINTER, x) (x) | |
262 | |
263 #define ag_rp_28(PCB_POINTER, x, y) (pow(x,y)) | |
264 | |
265 #define ag_rp_29(PCB_POINTER, valuePointer) (*valuePointer) | |
266 | |
267 #define ag_rp_30(PCB_POINTER, x) (log(x)) | |
268 | |
269 #define ag_rp_31(PCB_POINTER, x) (exp(x)) | |
270 | |
271 #define ag_rp_32(PCB_POINTER, x) (sin(x)) | |
272 | |
273 #define ag_rp_33(PCB_POINTER, x) (cos(x)) | |
274 | |
275 #define ag_rp_34(PCB_POINTER, x) (tan(x)) | |
276 | |
277 #define ag_rp_35(PCB_POINTER, x) (x) | |
278 | |
279 #define ag_rp_36(PCB_POINTER, x) (x == 0) | |
280 | |
281 #define ag_rp_37(PCB_POINTER, c) (PCB.charStack.push(c), 1) | |
282 | |
283 #define ag_rp_38(PCB_POINTER, k, c) (PCB.charStack.push(c), k+1) | |
284 | |
285 #define ag_rp_39(PCB_POINTER, k) (PCB.locateValue(k)) | |
286 | |
287 #define ag_rp_40(PCB_POINTER, x, e) (x*pow(10,e)) | |
288 | |
289 #define ag_rp_41(PCB_POINTER, x, e) (x*pow(10,-e)) | |
290 | |
291 #define ag_rp_42(PCB_POINTER, i, f) (i+f) | |
292 | |
293 #define ag_rp_43(PCB_POINTER, f) (f) | |
294 | |
295 #define ag_rp_44(PCB_POINTER, d) (d-'0') | |
296 | |
297 #define ag_rp_45(PCB_POINTER, x, d) (10*x + d-'0') | |
298 | |
299 #define ag_rp_46(PCB_POINTER, d) ((d-'0')/10.) | |
300 | |
301 #define ag_rp_47(PCB_POINTER, d, f) ((d-'0' + f)/10.) | |
302 | |
303 #define ag_rp_48(PCB_POINTER, d) (d-'0') | |
304 | |
305 #define ag_rp_49(PCB_POINTER, x, d) (10*x + d-'0') | |
306 | |
307 | |
308 #define READ_COUNTS | |
309 #define WRITE_COUNTS | |
310 #undef V | |
311 #define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i])) | |
312 #undef VS | |
313 #define VS(i) (PCB).vs[(PCB).ssx + i] | |
314 | |
315 #ifndef GET_CONTEXT | |
316 #define GET_CONTEXT CONTEXT = (PCB).input_context | |
317 #endif | |
318 | |
319 typedef enum { | |
320 ag_action_1, | |
321 ag_action_2, | |
322 ag_action_3, | |
323 ag_action_4, | |
324 ag_action_5, | |
325 ag_action_6, | |
326 ag_action_7, | |
327 ag_action_8, | |
328 ag_action_9, | |
329 ag_action_10, | |
330 ag_action_11, | |
331 ag_action_12 | |
332 } ag_parser_action; | |
333 | |
334 | |
335 #ifndef NULL_VALUE_INITIALIZER | |
336 #define NULL_VALUE_INITIALIZER = { 0 } | |
337 #endif | |
338 | |
339 static asi_vs_type const ag_null_value NULL_VALUE_INITIALIZER; | |
340 | |
341 static const unsigned char ag_rpx[] = { | |
342 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
343 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, | |
344 0, 6, 7, 0, 8, 9, 10, 11, 12, 0, 13, 0, 14, 0, 15, 0, 16, 17, | |
345 0, 18, 19, 20, 21, 0, 22, 23, 0, 24, 25, 0, 26, 27, 0, 28, 0, 29, | |
346 30, 31, 32, 33, 34, 35, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
347 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 38, 39, 0, 0, | |
348 0, 40, 41, 42, 0, 0, 0, 43, 44, 45, 46, 47, 48, 49 | |
349 }; | |
350 | |
351 static const unsigned char ag_key_itt[] = { | |
352 0 | |
353 }; | |
354 | |
355 static const unsigned short ag_key_pt[] = { | |
356 0 | |
357 }; | |
358 | |
359 static const unsigned char ag_key_ch[] = { | |
360 0, 42, 47,255, 47, 99,101,105,108,115,116,119,255, 42,255, 42, 61,255, | |
361 42, 47, 61,255,108,120,255, 33, 38, 42, 43, 45, 47, 60, 61, 62, 99,101, | |
362 105,108,115,116,119,124,255, 99,101,105,108,115,116,119,255, 42, 47,255, | |
363 33, 38, 42, 47, 60, 61, 62,124,255, 42, 47,255, 47, 99,101,108,115,116, | |
364 255, 42, 47,255, 47,255, 99,101,108,115,116,255, 33, 38, 42, 60, 61, 62, | |
365 124,255, 33, 38, 60, 61, 62,124,255, 33, 38, 61,124,255, 42, 61,255, 42, | |
366 47, 61,255, 33, 38, 42, 43, 45, 47, 60, 61, 62,124,255, 38,124,255,124, | |
367 255, 42, 47,255,108,120,255, 47, 99,101,105,108,115,116,119,255, 42, 61, | |
368 255, 33, 38, 42, 43, 45, 47, 60, 61, 62,124,255,105,119,255,108,120,255, | |
369 99,101,105,108,115,116,119,255, 42, 47,255,108,120,255, 33, 38, 42, 47, | |
370 60, 61, 62, 99,101,105,108,115,116,119,124,255 | |
371 }; | |
372 | |
373 static const unsigned char ag_key_act[] = { | |
374 0,0,0,4,2,3,3,3,3,3,3,3,4,3,4,0,0,4,0,0,0,4,3,3,4,3,3,2,3,3,2,3,3,3,3, | |
375 2,3,3,3,3,3,3,4,3,3,3,3,3,3,3,4,0,0,4,3,3,3,2,3,3,3,3,4,0,0,4,2,3,3,3, | |
376 3,3,4,0,0,4,2,4,3,3,3,3,3,4,3,3,3,3,3,3,3,4,3,3,3,3,3,3,4,3,3,3,3,4,0, | |
377 0,4,0,0,0,4,3,3,2,3,3,2,3,3,3,3,4,3,3,4,3,4,0,0,4,3,3,4,2,3,2,3,3,3,3, | |
378 3,4,0,0,4,3,3,2,3,3,3,3,3,3,3,4,3,3,4,3,3,4,3,2,3,3,3,3,3,4,0,0,4,3,3, | |
379 4,3,3,3,2,3,3,3,3,2,3,3,3,3,3,3,4 | |
380 }; | |
381 | |
382 static const unsigned char ag_key_parm[] = { | |
383 0, 73, 78, 0, 0,138,136,107,135,137,139,108, 0, 77, 0,133,117, 0, | |
384 73, 78,118, 0,106,136, 0,124,122, 0,115,116, 0,126,123,128,138, 0, | |
385 107,135,137,139,108,121, 0,138,136,107,135,137,139,108, 0, 73, 78, 0, | |
386 124,122,133, 0,126,123,128,121, 0, 73, 78, 0, 0,138,136,135,137,139, | |
387 0, 73, 78, 0, 0, 0,138,136,135,137,139, 0,124,122,133,126,123,128, | |
388 121, 0,124,122,126,123,128,121, 0,124,122,123,121, 0,133,117, 0, 73, | |
389 78,118, 0,124,122, 0,115,116, 0,126,123,128,121, 0,122,121, 0,121, | |
390 0, 73, 78, 0,106,136, 0, 0,138, 0,107,135,137,139,108, 0,133,117, | |
391 0,124,122, 0,115,116,118,126,123,128,121, 0,107,108, 0,106,136, 0, | |
392 138, 0,107,135,137,139,108, 0, 73, 78, 0,106,136, 0,124,122,133, 0, | |
393 126,123,128,138, 0,107,135,137,139,108,121, 0 | |
394 }; | |
395 | |
396 static const unsigned short ag_key_jmp[] = { | |
397 0, 0, 0, 0, 1, 0, 3, 6, 8, 11, 14, 17, 0, 22, 0, 0, 0, 0, | |
398 0, 0, 0, 0, 41, 44, 0, 24, 26, 15, 28, 30, 18, 32, 34, 36, 38, 22, | |
399 46, 48, 51, 54, 57, 62, 0, 64, 67, 70, 72, 75, 78, 81, 0, 0, 0, 0, | |
400 86, 88, 90, 51, 92, 94, 96, 98, 0, 0, 0, 0, 63,100,103,106,109,112, | |
401 0, 0, 0, 0, 73, 0,115,118,121,124,127, 0,130,132,134,136,138,140, | |
402 142, 0,144,146,148,150,152,154, 0,156,158,160,162, 0, 0, 0, 0, 0, | |
403 0, 0, 0,164,166,104,168,170,107,172,174,176,178, 0,180,182, 0,184, | |
404 0, 0, 0, 0,189,192, 0,127,186,130,194,196,199,202,205, 0, 0, 0, | |
405 0,210,212,142,214,216,218,220,222,224,226, 0,228,230, 0,238,241, 0, | |
406 235,159,243,245,248,251,254, 0, 0, 0, 0,274,277, 0,259,261,263,170, | |
407 265,267,269,271,173,279,281,284,287,290,295, 0 | |
408 }; | |
409 | |
410 static const unsigned char ag_key_index[] = { | |
411 4, 0, 13, 25, 43, 0, 0, 13, 13, 0, 54, 54, 66, 66, 76, 76, 76, 76, | |
412 76, 54, 78, 78, 0, 0, 0, 0, 0, 66, 66, 84, 78, 78, 92, 92, 92, 99, | |
413 111,122, 76,111,125, 76, 4,133,145, 0, 0, 0, 43, 0, 0,156, 43, 43, | |
414 0, 54, 54, 0, 0, 78, 78, 78, 78, 78, 66, 78, 66, 78, 66, 78, 78, 78, | |
415 66, 78, 66, 78, 66, 78, 66, 78, 66, 78, 66, 78, 66, 78, 66, 78, 66, 78, | |
416 66, 78, 66, 78, 66, 78, 66, 78, 66, 78, 0,156, 78, 0, 43,133, 76, 76, | |
417 66, 76, 76, 76, 0, 0, 0, 0, 0,162,162, 0, 0,176, 0, 0, 0, 0, | |
418 0, 92, 92, 92, 92, 92, 92, 92, 92, 99,122, 0, 0, 0, 43, 78, 0, 0, | |
419 0, 0,156,156, 4, 43,156, 54, 54, 78, 0,162,156 | |
420 }; | |
421 | |
422 static const unsigned char ag_key_ends[] = { | |
423 111,115,0, 120,112,0, 102,0, 111,103,0, 105,110,0, 97,110,0, | |
424 104,105,108,101,0, 47,0, 61,0, 38,0, 61,0, 61,0, 61,0, 61,0, | |
425 61,0, 111,115,0, 115,101,0, 112,0, 102,0, 111,103,0, 105,110,0, | |
426 97,110,0, 104,105,108,101,0, 124,0, 111,115,0, 120,112,0, 102,0, | |
427 111,103,0, 105,110,0, 97,110,0, 104,105,108,101,0, 61,0, 38,0, | |
428 42,0, 61,0, 61,0, 61,0, 124,0, 111,115,0, 120,112,0, 111,103,0, | |
429 105,110,0, 97,110,0, 111,115,0, 120,112,0, 111,103,0, 105,110,0, | |
430 97,110,0, 61,0, 38,0, 42,0, 61,0, 61,0, 61,0, 124,0, 61,0, | |
431 38,0, 61,0, 61,0, 61,0, 124,0, 61,0, 38,0, 61,0, 124,0, | |
432 61,0, 38,0, 61,0, 61,0, 61,0, 61,0, 61,0, 124,0, 38,0, 124,0, | |
433 124,0, 111,115,0, 115,101,0, 112,0, 102,0, 111,103,0, 105,110,0, | |
434 97,110,0, 104,105,108,101,0, 61,0, 38,0, 61,0, 61,0, 61,0, | |
435 61,0, 61,0, 61,0, 124,0, 102,0, 104,105,108,101,0, 111,115,0, | |
436 115,101,0, 112,0, 102,0, 111,103,0, 105,110,0, 97,110,0, | |
437 104,105,108,101,0, 61,0, 38,0, 42,0, 61,0, 61,0, 61,0, | |
438 111,115,0, 115,101,0, 112,0, 102,0, 111,103,0, 105,110,0, | |
439 97,110,0, 104,105,108,101,0, 124,0, | |
440 }; | |
441 | |
442 #define AG_TCV(x) ag_tcv[(x)] | |
443 | |
444 static const unsigned char ag_tcv[] = { | |
445 7,100,100,100,100,100,100,100,100, 99, 82, 99, 99, 99,100,100,100,100, | |
446 100,100,100,100,100,100,100,100,100,100,100,100,100,100, 99,140,141,141, | |
447 141,141,141,141,112,111,131,129,141,130,142,132,143,143,143,143,143,143, | |
448 143,143,143,143,119,105,125,113,127,120,141,144,144,144,144,145,144,144, | |
449 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, | |
450 144,141,141,141,141,144,141,144,144,144,144,145,144,144,144,144,144,144, | |
451 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,110,141,109, | |
452 141,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, | |
453 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, | |
454 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, | |
455 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, | |
456 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, | |
457 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, | |
458 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, | |
459 100,100,100,100 | |
460 }; | |
461 | |
462 #ifndef SYNTAX_ERROR | |
463 #define SYNTAX_ERROR fprintf(stderr,"%s, line %d, column %d\n", \ | |
464 (PCB).error_message, (PCB).line, (PCB).column) | |
465 #endif | |
466 | |
467 #ifndef FIRST_LINE | |
468 #define FIRST_LINE 1 | |
469 #endif | |
470 | |
471 #ifndef FIRST_COLUMN | |
472 #define FIRST_COLUMN 1 | |
473 #endif | |
474 | |
475 #ifndef PARSER_STACK_OVERFLOW | |
476 #define PARSER_STACK_OVERFLOW {fprintf(stderr, \ | |
477 "\nParser stack overflow, line %d, column %d\n",\ | |
478 (PCB).line, (PCB).column);} | |
479 #endif | |
480 | |
481 #ifndef REDUCTION_TOKEN_ERROR | |
482 #define REDUCTION_TOKEN_ERROR {fprintf(stderr, \ | |
483 "\nReduction token error, line %d, column %d\n", \ | |
484 (PCB).line, (PCB).column);} | |
485 #endif | |
486 | |
487 | |
488 #ifndef INPUT_CODE | |
489 #define INPUT_CODE(T) (T) | |
490 #endif | |
491 | |
492 typedef enum | |
493 {ag_accept_key, ag_set_key, ag_jmp_key, ag_end_key, ag_no_match_key, | |
494 ag_cf_accept_key, ag_cf_set_key, ag_cf_end_key} key_words; | |
495 | |
496 static void ag_get_key_word(PCB_DECL, int ag_k) { | |
497 int ag_save = (int) ((PCB).la_ptr - (PCB).pointer); | |
498 const unsigned char *ag_p; | |
499 int ag_ch; | |
500 while (1) { | |
501 switch (ag_key_act[ag_k]) { | |
502 case ag_cf_end_key: { | |
503 const unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k]; | |
504 do { | |
505 if ((ag_ch = *sp++) == 0) { | |
506 int ag_k1 = ag_key_parm[ag_k]; | |
507 int ag_k2 = ag_key_pt[ag_k1]; | |
508 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) goto ag_fail; | |
509 (PCB).token_number = (asi_token_type) ag_key_pt[ag_k1 + 1]; | |
510 return; | |
511 } | |
512 } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch); | |
513 goto ag_fail; | |
514 } | |
515 case ag_end_key: { | |
516 const unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k]; | |
517 do { | |
518 if ((ag_ch = *sp++) == 0) { | |
519 (PCB).token_number = (asi_token_type) ag_key_parm[ag_k]; | |
520 return; | |
521 } | |
522 } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch); | |
523 } | |
524 case ag_no_match_key: | |
525 ag_fail: | |
526 (PCB).la_ptr = (PCB).pointer + ag_save; | |
527 return; | |
528 case ag_cf_set_key: { | |
529 int ag_k1 = ag_key_parm[ag_k]; | |
530 int ag_k2 = ag_key_pt[ag_k1]; | |
531 ag_k = ag_key_jmp[ag_k]; | |
532 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) break; | |
533 ag_save = (int) ((PCB).la_ptr - (PCB).pointer); | |
534 (PCB).token_number = (asi_token_type) ag_key_pt[ag_k1+1]; | |
535 break; | |
536 } | |
537 case ag_set_key: | |
538 ag_save = (int) ((PCB).la_ptr - (PCB).pointer); | |
539 (PCB).token_number = (asi_token_type) ag_key_parm[ag_k]; | |
540 case ag_jmp_key: | |
541 ag_k = ag_key_jmp[ag_k]; | |
542 break; | |
543 case ag_accept_key: | |
544 (PCB).token_number = (asi_token_type) ag_key_parm[ag_k]; | |
545 return; | |
546 case ag_cf_accept_key: { | |
547 int ag_k1 = ag_key_parm[ag_k]; | |
548 int ag_k2 = ag_key_pt[ag_k1]; | |
549 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) | |
550 (PCB).la_ptr = (PCB).pointer + ag_save; | |
551 else (PCB).token_number = (asi_token_type) ag_key_pt[ag_k1+1]; | |
552 return; | |
553 } | |
554 } | |
555 ag_ch = CONVERT_CASE(*(PCB).la_ptr++); | |
556 ag_p = &ag_key_ch[ag_k]; | |
557 if (ag_ch <= 255) while (*ag_p < ag_ch) ag_p++; | |
558 if (ag_ch > 255 || *ag_p != ag_ch) { | |
559 (PCB).la_ptr = (PCB).pointer + ag_save; | |
560 return; | |
561 } | |
562 ag_k = (int) (ag_p - ag_key_ch); | |
563 } | |
564 } | |
565 | |
566 | |
567 #ifndef AG_NEWLINE | |
568 #define AG_NEWLINE 10 | |
569 #endif | |
570 | |
571 #ifndef AG_RETURN | |
572 #define AG_RETURN 13 | |
573 #endif | |
574 | |
575 #ifndef AG_FORMFEED | |
576 #define AG_FORMFEED 12 | |
577 #endif | |
578 | |
579 #ifndef AG_TABCHAR | |
580 #define AG_TABCHAR 9 | |
581 #endif | |
582 | |
583 static void ag_track(PCB_DECL) { | |
584 int ag_k = (int) ((PCB).la_ptr - (PCB).pointer); | |
585 while (ag_k--) { | |
586 switch (*(PCB).pointer++) { | |
587 case AG_NEWLINE: | |
588 (PCB).column = 1, (PCB).line++; | |
589 case AG_RETURN: | |
590 case AG_FORMFEED: | |
591 break; | |
592 case AG_TABCHAR: | |
593 (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING); | |
594 break; | |
595 default: | |
596 (PCB).column++; | |
597 } | |
598 } | |
599 } | |
600 | |
601 | |
602 static void ag_prot(PCB_DECL) { | |
603 int ag_k; | |
604 ag_k = 128 - ++(PCB).btsx; | |
605 if (ag_k <= (PCB).ssx) { | |
606 (PCB).exit_flag = AG_STACK_ERROR_CODE; | |
607 PARSER_STACK_OVERFLOW; | |
608 return; | |
609 } | |
610 (PCB).bts[(PCB).btsx] = (PCB).sn; | |
611 (PCB).bts[ag_k] = (PCB).ssx; | |
612 (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx]; | |
613 (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx]; | |
614 } | |
615 | |
616 static void ag_undo(PCB_DECL) { | |
617 if ((PCB).drt == -1) return; | |
618 while ((PCB).btsx) { | |
619 int ag_k = 128 - (PCB).btsx; | |
620 (PCB).sn = (PCB).bts[(PCB).btsx--]; | |
621 (PCB).ssx = (PCB).bts[ag_k]; | |
622 (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k]; | |
623 (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k]; | |
624 } | |
625 (PCB).token_number = (asi_token_type) (PCB).drt; | |
626 (PCB).ssx = (PCB).dssx; | |
627 (PCB).sn = (PCB).dsn; | |
628 (PCB).drt = -1; | |
629 } | |
630 | |
631 | |
632 | |
633 static const int ag_rtt[] = { | |
634 25, 26, 0, 35, 34, 0 | |
635 }; | |
636 | |
637 static const unsigned char ag_tstt[] = { | |
638 145,144,143,142,140,139,138,137,136,135,130,129,112,110,108,107,105,99,82, | |
639 78,73,7,0,1,103,104, | |
640 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,109, | |
641 105,100,99,82,0,80,81, | |
642 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,109, | |
643 105,100,99,82,77,0,75,76, | |
644 99,82,78,73,0,1, | |
645 145,144,143,142,140,139,138,137,136,135,130,129,112,110,108,107,105,7,0,2,3, | |
646 4,5,6,8,14,16,19,20,21,22,23,25,26,27,29,30,32,36,42,45,47,49,52,57,58, | |
647 59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
648 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,109, | |
649 105,100,99,0, | |
650 82,0, | |
651 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,109, | |
652 105,100,99,82,0, | |
653 77,0, | |
654 143,0,96, | |
655 145,143,142,133,132,131,130,129,128,127,126,125,124,123,122,121,120,119,111, | |
656 105,99,82,78,73,0,97, | |
657 145,0, | |
658 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
659 113,112,111,110,105,99,82,78,73,0,1,103,104, | |
660 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
661 113,112,111,99,82,78,73,0,1,103,104, | |
662 112,99,82,78,73,0,1,103,104, | |
663 112,99,82,78,73,0,1,103,104, | |
664 112,99,82,78,73,0,1,103,104, | |
665 112,99,82,78,73,0,1,103,104, | |
666 112,99,82,78,73,0,1,103,104, | |
667 133,132,131,130,129,128,127,126,125,124,123,122,121,120,119,111,105,99,82, | |
668 78,73,0,1,103,104, | |
669 145,144,143,142,140,139,138,137,136,135,112,0,2,3,30,64,66,67,68,69,70,71, | |
670 87,90,94,114,134, | |
671 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
672 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
673 112,0,30, | |
674 112,0,30, | |
675 112,0,30, | |
676 112,0,30, | |
677 112,0,30, | |
678 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
679 113,112,111,110,105,99,82,78,73,0,1,103,104, | |
680 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
681 113,112,111,110,105,99,82,78,73,0,1,103,104, | |
682 133,0,65, | |
683 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,58,59,60,63,64, | |
684 66,67,68,69,70,71,87,90,94,114,134, | |
685 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,58,59,60,63,64, | |
686 66,67,68,69,70,71,87,90,94,114,134, | |
687 132,131,0,61,62, | |
688 130,129,0,58,59, | |
689 128,127,126,125,0,53,54,55,56, | |
690 124,123,0,50,51, | |
691 145,144,143,0, | |
692 122,0,48, | |
693 112,99,82,78,73,0,1,103,104, | |
694 133,132,131,130,129,128,127,126,125,124,123,122,121,120,119,118,117,116,115, | |
695 113,111,105,99,82,78,73,0,1,103,104, | |
696 121,120,0,43,46, | |
697 112,99,82,78,73,0,1,103,104, | |
698 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
699 113,112,110,109,108,107,105,99,82,78,73,0,1,103,104, | |
700 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
701 113,112,110,109,108,107,106,105,99,82,78,73,7,0,1,103,104, | |
702 118,117,116,115,113,0,37,38,39,40,41, | |
703 112,0,17,30, | |
704 112,0,30, | |
705 112,0,28,33, | |
706 145,144,143,142,140,139,138,137,136,135,130,129,112,110,109,108,107,105,0,2, | |
707 3,5,8,14,16,19,20,21,22,23,24,25,26,27,29,30,32,36,42,45,47,49,52,57,58, | |
708 59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
709 105,0,14, | |
710 112,0,28,33, | |
711 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,108,107, | |
712 105,0,9,10,11,12,13,15,16,17,19,23,30,37,43,44,53,55,58,59,61,62,71,91, | |
713 95,98,101,102, | |
714 145,144,143,142,140,139,138,137,136,135,130,129,112,110,108,107,105,0,2,3,8, | |
715 14,16,19,20,21,22,23,25,26,27,29,30,32,36,42,45,47,49,52,57,58,59,60,63, | |
716 64,66,67,68,69,70,71,87,90,94,114,134, | |
717 145,144,143,142,140,139,138,137,136,135,130,129,112,110,108,107,105,0,2,3,8, | |
718 14,16,19,20,21,22,23,25,26,27,29,30,32,36,42,45,47,49,52,57,58,59,60,63, | |
719 64,66,67,68,69,70,71,87,90,94,114,134, | |
720 7,0, | |
721 143,0,96, | |
722 143,0,96, | |
723 143,130,129,0,92, | |
724 111,0,31, | |
725 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
726 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
727 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
728 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
729 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
730 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
731 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
732 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
733 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
734 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
735 145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, | |
736 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,58,59,60,63,64, | |
737 66,67,68,69,70,71,87,90,94,114,134, | |
738 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
739 113,112,111,110,105,99,82,78,73,0,1,103,104, | |
740 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,58,59,60,63,64, | |
741 66,67,68,69,70,71,87,90,94,114,134, | |
742 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
743 113,112,111,110,105,99,82,78,73,0,1,103,104, | |
744 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,58,59,60,63,64, | |
745 66,67,68,69,70,71,87,90,94,114,134, | |
746 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,57,58,59,60,63, | |
747 64,66,67,68,69,70,71,87,90,94,114,134, | |
748 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,57,58,59,60,63, | |
749 64,66,67,68,69,70,71,87,90,94,114,134, | |
750 145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, | |
751 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,52,57,58,59,60, | |
752 63,64,66,67,68,69,70,71,87,90,94,114,134, | |
753 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
754 113,112,111,110,105,99,82,78,73,0,1,103,104, | |
755 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,52,57,58,59,60, | |
756 63,64,66,67,68,69,70,71,87,90,94,114,134, | |
757 145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, | |
758 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,52,57,58,59,60, | |
759 63,64,66,67,68,69,70,71,87,90,94,114,134, | |
760 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
761 113,112,111,110,105,99,82,78,73,0,1,103,104, | |
762 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,52,57,58,59,60, | |
763 63,64,66,67,68,69,70,71,87,90,94,114,134, | |
764 145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, | |
765 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,49,52,57,58,59, | |
766 60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
767 145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, | |
768 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,49,52,57,58,59, | |
769 60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
770 145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, | |
771 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,47,49,52,57,58, | |
772 59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
773 145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, | |
774 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,45,47,49,52,57, | |
775 58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
776 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
777 113,112,111,110,105,99,82,78,73,0,1,103,104, | |
778 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
779 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
780 145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, | |
781 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
782 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
783 145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, | |
784 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
785 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
786 145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, | |
787 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
788 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
789 145,144,143,142,140,139,138,137,136,135,130,129,112,99,82,78,73,0,1,103,104, | |
790 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
791 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
792 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
793 113,112,111,110,105,99,82,78,73,0,1,103,104, | |
794 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
795 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
796 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,0,12,13, | |
797 17,30,37,43,44,53,55,58,59,61,62,71,91,95,98,101,102, | |
798 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,108,107, | |
799 105,0,10,11,12,13,15,16,17,19,23,30,37,43,44,53,55,58,59,61,62,71,91,95, | |
800 98,101,102, | |
801 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
802 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
803 112,0,30,34,35, | |
804 145,144,143,142,140,139,138,137,136,135,130,129,112,110,109,108,107,105,0,2, | |
805 3,8,14,16,19,20,21,22,23,24,25,26,27,29,30,32,36,42,45,47,49,52,57,58, | |
806 59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
807 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
808 113,112,111,110,109,108,107,106,105,99,82,78,73,7,0,1,103,104, | |
809 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,105, | |
810 99,82,78,73,0,1,103,104, | |
811 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,105, | |
812 99,82,78,73,0,1,103,104, | |
813 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
814 113,112,111,110,105,99,82,78,73,0,1,103,104, | |
815 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,105, | |
816 99,82,78,73,0,1,103,104, | |
817 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,105, | |
818 99,82,78,73,0,1,103,104, | |
819 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,105, | |
820 99,82,78,73,0,1,103,104, | |
821 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,110,109, | |
822 105,0,12,13,15,17,23,30,37,43,44,53,55,58,59,61,62,71,84,85,86,91,95,98, | |
823 101,102, | |
824 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,0,15,17, | |
825 23,30,37,43,44,53,55,58,59,61,62,71,91,95,98,101,102, | |
826 112,0,17,30, | |
827 112,0,17,30, | |
828 105,0,14, | |
829 106,0,18, | |
830 106,0,18, | |
831 143,0,93, | |
832 143,0,93, | |
833 145,144,143,142,141,140,139,138,137,136,135,133,132,131,130,129,128,127,126, | |
834 125,124,123,122,121,120,119,113,112,111,110,109,108,107,106,105,99,82, | |
835 78,73,7,0,1,103,104, | |
836 111,0,31, | |
837 111,0,31, | |
838 111,0,31, | |
839 111,0,31, | |
840 111,0,31, | |
841 132,131,0,61,62, | |
842 132,131,0,61,62, | |
843 130,129,0,58,59, | |
844 130,129,0,58,59, | |
845 130,129,0,58,59, | |
846 130,129,0,58,59, | |
847 128,127,126,125,0,53,54,55,56, | |
848 128,127,126,125,0,53,54,55,56, | |
849 124,123,0,50,51, | |
850 122,0,48, | |
851 119,0,44, | |
852 111,0,31, | |
853 111,0,31, | |
854 145,144,143,142,140,139,138,137,136,135,130,129,112,110,108,107,105,0,2,3,8, | |
855 14,16,19,20,21,22,23,25,26,27,29,30,32,36,42,45,47,49,52,57,58,59,60,63, | |
856 64,66,67,68,69,70,71,87,90,94,114,134, | |
857 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,22,30,36,42,45,47, | |
858 49,52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
859 109,0,24, | |
860 105,0,14, | |
861 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,111,109,105, | |
862 0,12,13,17,30,37,43,44,53,55,58,59,61,62,71,84,91,95,98,101,102, | |
863 109,0,24, | |
864 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,108,107, | |
865 105,0,10,11,12,13,15,16,17,19,23,30,37,43,44,53,55,58,59,61,62,71,91,95, | |
866 98,101,102, | |
867 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,108,107, | |
868 105,0,9,10,11,12,13,15,16,17,19,23,30,37,43,44,53,55,58,59,61,62,71,91, | |
869 95,98,101,102, | |
870 145,144,143,142,141,140,139,138,137,136,135,132,131,130,129,127,125,120,119, | |
871 113,112,110,108,107,105,99,82,78,73,0,1,103,104, | |
872 145,144,143,142,140,139,138,137,136,135,130,129,112,110,108,107,105,0,2,3, | |
873 14,16,19,20,21,22,23,25,26,27,29,30,32,36,42,45,47,49,52,57,58,59,60,63, | |
874 64,66,67,68,69,70,71,87,90,94,114,134, | |
875 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,108,107, | |
876 105,0,10,11,12,13,15,16,17,19,23,30,37,43,44,53,55,58,59,61,62,71,91,95, | |
877 98,101,102, | |
878 143,0, | |
879 143,0, | |
880 145,144,143,142,140,139,138,137,136,135,130,129,112,0,2,3,30,36,42,45,47,49, | |
881 52,57,58,59,60,63,64,66,67,68,69,70,71,87,90,94,114,134, | |
882 111,0,31, | |
883 106,0,18, | |
884 145,144,143,142,141,140,132,131,130,129,127,125,120,119,113,112,110,108,107, | |
885 105,0,10,11,12,13,15,16,17,19,23,30,37,43,44,53,55,58,59,61,62,71,91,95, | |
886 98,101,102, | |
887 | |
888 }; | |
889 | |
890 | |
891 static unsigned const char ag_astt[3416] = { | |
892 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,1,1,1,1,8,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
893 1,1,1,1,1,1,1,1,1,1,1,8,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
894 1,8,7,1,1,9,9,1,1,5,3,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8,7,1,1,0,1,1,1,1, | |
895 1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9, | |
896 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,5,3,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9, | |
897 9,9,9,9,9,9,9,9,9,5,3,7,1,7,2,5,10,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, | |
898 5,5,7,3,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
977 1,1,1,1,1,1,1,1,1,1,1,1,1,8,7,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
978 1,1,1,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,1,1,1,7,1,1,3, | |
979 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,3,1,2,3,3,1,1,1,1,1,1,1,1,1,1,1,1, | |
980 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
981 1,8,7,3,3,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,10,4,10,4,2,2,2,1, | |
982 1,1,1,1,1,1,1,1,1,7,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
983 7,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8,7,3,3,1,1,3,1,1,1,1,1,1, | |
984 1,1,1,1,1,1,1,1,1,1,1,1,1,1 | |
985 }; | |
986 | |
987 | |
988 static const unsigned char ag_pstt[] = { | |
989 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,1,2,4,0,3,3,4, | |
990 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,1,5,6, | |
991 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,2,7,8, | |
992 190,190,1,2,192,190, | |
993 103,103,116,9,12,14,15,16,17,18,28,27,13,42,38,41,43,54,4,29,44,0,53,54,53, | |
994 53,46,34,53,53,49,48,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31,32,32, | |
995 29,26,25,24,23,22,20,36,11,10,39,19, | |
996 86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,88, | |
997 89,6, | |
998 81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,83, | |
999 84,8, | |
1000 55,9,115, | |
1001 112,117,56,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, | |
1002 112,112,112,112,112,10,114, | |
1003 57,106, | |
1004 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1005 191,191,191,191,191,3,3,1,2,12,3,3,228, | |
1006 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1007 191,191,191,3,3,1,2,13,3,3,200, | |
1008 191,3,3,1,2,14,3,3,227, | |
1009 191,3,3,1,2,15,3,3,226, | |
1010 191,3,3,1,2,16,3,3,225, | |
1011 191,3,3,1,2,17,3,3,224, | |
1012 191,3,3,1,2,18,3,3,223, | |
1013 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2, | |
1014 19,3,3,222, | |
1015 103,103,116,9,12,14,15,16,17,18,13,20,78,71,21,78,26,25,24,23,22,20,36,11, | |
1016 10,39,19, | |
1017 103,103,116,9,12,14,15,16,17,18,28,27,13,21,29,44,58,21,58,40,37,35,34,33, | |
1018 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1019 13,22,59, | |
1020 13,23,60, | |
1021 13,24,61, | |
1022 13,25,62, | |
1023 13,26,63, | |
1024 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1025 191,191,191,191,191,3,3,1,2,27,3,3,217, | |
1026 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1027 191,191,191,191,191,3,3,1,2,28,3,3,218, | |
1028 64,68,65, | |
1029 103,103,116,9,12,14,15,16,17,18,28,27,13,30,29,71,21,30,31,67,67,29,26,25, | |
1030 24,23,22,20,36,11,10,39,19, | |
1031 103,103,116,9,12,14,15,16,17,18,28,27,13,31,29,71,21,30,31,66,66,29,26,25, | |
1032 24,23,22,20,36,11,10,39,19, | |
1033 66,68,59,69,67, | |
1034 28,27,54,71,70, | |
1035 72,74,76,78,51,79,77,75,73, | |
1036 80,82,49,83,81, | |
1037 104,104,104,105, | |
1038 84,47,85, | |
1039 191,3,3,1,2,38,3,3,196, | |
1040 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1041 191,191,191,3,3,1,2,39,3,3,202, | |
1042 86,88,45,89,87, | |
1043 191,3,3,1,2,41,3,3,195, | |
1044 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1045 191,191,191,191,191,191,191,3,3,1,2,42,3,3,198, | |
1046 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1047 191,191,191,191,191,191,191,191,3,3,1,2,191,43,3,3,193, | |
1048 90,92,94,96,98,71,99,97,95,93,91, | |
1049 13,45,101,100, | |
1050 13,46,102, | |
1051 103,47,25,103, | |
1052 103,103,116,9,12,14,15,16,17,18,28,27,13,42,105,38,41,43,48,29,44,104,104, | |
1053 104,46,34,104,104,49,48,21,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31, | |
1054 32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1055 43,49,19, | |
1056 103,50,30,103, | |
1057 106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,38,41,116,51,27,27, | |
1058 117,113,116,117,115,113,114,112,100,113,113,113,113,113,113,113,113,113, | |
1059 113,113,113,113,113,113, | |
1060 103,103,116,9,12,14,15,16,17,18,28,27,13,42,38,41,43,52,29,44,26,118,46,34, | |
1061 26,118,49,48,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31,32,32,29,26, | |
1062 25,24,23,22,20,36,11,10,39,19, | |
1063 103,103,116,9,12,14,15,16,17,18,28,27,13,42,38,41,43,2,29,44,5,5,46,34,5,5, | |
1064 49,48,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31,32,32,29,26,25,24,23, | |
1065 22,20,36,11,10,39,19, | |
1066 3,54, | |
1067 55,118,119, | |
1068 55,113,111, | |
1069 120,119,120,57,120, | |
1070 121,58,77, | |
1071 103,103,116,9,12,14,15,16,17,18,28,27,13,59,29,44,122,21,122,40,37,35,34,33, | |
1072 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1073 103,103,116,9,12,14,15,16,17,18,28,27,13,60,29,44,123,21,123,40,37,35,34,33, | |
1074 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1075 103,103,116,9,12,14,15,16,17,18,28,27,13,61,29,44,124,21,124,40,37,35,34,33, | |
1076 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1077 103,103,116,9,12,14,15,16,17,18,28,27,13,62,29,44,125,21,125,40,37,35,34,33, | |
1078 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1079 103,103,116,9,12,14,15,16,17,18,28,27,13,63,29,44,126,21,126,40,37,35,34,33, | |
1080 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1081 191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,64,3,3,221, | |
1082 103,103,116,9,12,14,15,16,17,18,28,27,13,65,29,71,21,30,31,69,69,29,26,25, | |
1083 24,23,22,20,36,11,10,39,19, | |
1084 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1085 191,191,191,191,191,3,3,1,2,66,3,3,220, | |
1086 103,103,116,9,12,14,15,16,17,18,28,27,13,67,29,71,21,30,31,64,64,29,26,25, | |
1087 24,23,22,20,36,11,10,39,19, | |
1088 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1089 191,191,191,191,191,3,3,1,2,68,3,3,219, | |
1090 103,103,116,9,12,14,15,16,17,18,28,27,13,69,29,71,21,30,31,63,63,29,26,25, | |
1091 24,23,22,20,36,11,10,39,19, | |
1092 103,103,116,9,12,14,15,16,17,18,28,27,13,70,29,71,21,127,30,31,127,127,29, | |
1093 26,25,24,23,22,20,36,11,10,39,19, | |
1094 103,103,116,9,12,14,15,16,17,18,28,27,13,71,29,71,21,128,30,31,128,128,29, | |
1095 26,25,24,23,22,20,36,11,10,39,19, | |
1096 191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,72,3,3,216, | |
1097 103,103,116,9,12,14,15,16,17,18,28,27,13,73,29,71,21,129,32,30,31,32,32,29, | |
1098 26,25,24,23,22,20,36,11,10,39,19, | |
1099 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1100 191,191,191,191,191,3,3,1,2,74,3,3,215, | |
1101 103,103,116,9,12,14,15,16,17,18,28,27,13,75,29,71,21,130,32,30,31,32,32,29, | |
1102 26,25,24,23,22,20,36,11,10,39,19, | |
1103 191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,76,3,3,214, | |
1104 103,103,116,9,12,14,15,16,17,18,28,27,13,77,29,71,21,131,32,30,31,32,32,29, | |
1105 26,25,24,23,22,20,36,11,10,39,19, | |
1106 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1107 191,191,191,191,191,3,3,1,2,78,3,3,213, | |
1108 103,103,116,9,12,14,15,16,17,18,28,27,13,79,29,71,21,132,32,30,31,32,32,29, | |
1109 26,25,24,23,22,20,36,11,10,39,19, | |
1110 191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,80,3,3,212, | |
1111 103,103,116,9,12,14,15,16,17,18,28,27,13,81,29,71,21,133,33,32,30,31,32,32, | |
1112 29,26,25,24,23,22,20,36,11,10,39,19, | |
1113 191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,82,3,3,211, | |
1114 103,103,116,9,12,14,15,16,17,18,28,27,13,83,29,71,21,134,33,32,30,31,32,32, | |
1115 29,26,25,24,23,22,20,36,11,10,39,19, | |
1116 191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,84,3,3,210, | |
1117 103,103,116,9,12,14,15,16,17,18,28,27,13,85,29,71,21,135,34,33,32,30,31,32, | |
1118 32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1119 191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,86,3,3,209, | |
1120 103,103,116,9,12,14,15,16,17,18,28,27,13,87,29,71,21,136,35,34,33,32,30,31, | |
1121 32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1122 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1123 191,191,191,191,191,3,3,1,2,88,3,3,208, | |
1124 103,103,116,9,12,14,15,16,17,18,28,27,13,89,29,44,137,21,137,40,37,35,34,33, | |
1125 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1126 191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,90,3,3,206, | |
1127 103,103,116,9,12,14,15,16,17,18,28,27,13,91,29,44,44,21,44,40,37,35,34,33, | |
1128 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1129 191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,92,3,3,205, | |
1130 103,103,116,9,12,14,15,16,17,18,28,27,13,93,29,44,43,21,43,40,37,35,34,33, | |
1131 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1132 191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,94,3,3,204, | |
1133 103,103,116,9,12,14,15,16,17,18,28,27,13,95,29,44,42,21,42,40,37,35,34,33, | |
1134 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1135 191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2,96,3,3,203, | |
1136 103,103,116,9,12,14,15,16,17,18,28,27,13,97,29,44,41,21,41,40,37,35,34,33, | |
1137 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1138 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1139 191,191,191,191,191,3,3,1,2,98,3,3,201, | |
1140 103,103,116,9,12,14,15,16,17,18,28,27,13,99,29,44,40,21,40,40,37,35,34,33, | |
1141 32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1142 106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,138,100,113,138,113, | |
1143 100,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, | |
1144 106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,38,41,116,101,33, | |
1145 32,113,116,32,115,113,114,112,100,113,113,113,113,113,113,113,113,113, | |
1146 113,113,113,113,113,113, | |
1147 103,103,116,9,12,14,15,16,17,18,28,27,13,102,29,44,139,21,139,40,37,35,34, | |
1148 33,32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1149 13,103,141,35,140, | |
1150 103,103,116,9,12,14,15,16,17,18,28,27,13,42,105,38,41,43,104,29,44,5,5,46, | |
1151 34,5,5,49,48,22,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31,32,32,29, | |
1152 26,25,24,23,22,20,36,11,10,39,19, | |
1153 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1154 191,191,191,191,191,191,191,191,191,3,3,1,2,191,105,3,3,197, | |
1155 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1156 3,3,1,2,106,3,3,233, | |
1157 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1158 3,3,1,2,107,3,3,232, | |
1159 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1160 191,191,191,191,191,3,3,1,2,108,3,3,207, | |
1161 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1162 3,3,1,2,109,3,3,231, | |
1163 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1164 3,3,1,2,110,3,3,230, | |
1165 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1166 3,3,1,2,111,3,3,229, | |
1167 106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,8,42,145,143,112,113, | |
1168 143,142,113,112,100,113,113,113,113,113,113,113,113,113,113,144,144,145, | |
1169 113,113,113,113,113, | |
1170 106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,9,94,93,112,100,92, | |
1171 92,92,92,92,92,92,92,92,92,92,92,92,92,92, | |
1172 13,114,146,100, | |
1173 13,115,147,100, | |
1174 43,116,10, | |
1175 148,7,149, | |
1176 148,18,150, | |
1177 120,119,151, | |
1178 120,120,152, | |
1179 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1180 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,3,3,1,2, | |
1181 191,121,3,3,199, | |
1182 121,122,76, | |
1183 121,123,75, | |
1184 121,124,74, | |
1185 121,125,73, | |
1186 121,126,72, | |
1187 66,68,61,69,67, | |
1188 66,68,60,69,67, | |
1189 28,27,58,71,70, | |
1190 28,27,57,71,70, | |
1191 28,27,56,71,70, | |
1192 28,27,55,71,70, | |
1193 72,74,76,78,53,79,77,75,73, | |
1194 72,74,76,78,52,79,77,75,73, | |
1195 80,82,50,83,81, | |
1196 84,48,85, | |
1197 108,137,153, | |
1198 121,138,95, | |
1199 121,139,31, | |
1200 103,103,116,9,12,14,15,16,17,18,28,27,13,42,38,41,43,140,29,44,37,37,46,34, | |
1201 37,37,49,48,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31,32,32,29,26,25, | |
1202 24,23,22,20,36,11,10,39,19, | |
1203 103,103,116,9,12,14,15,16,17,18,28,27,13,141,29,44,154,21,154,40,37,35,34, | |
1204 33,32,30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1205 105,142,102, | |
1206 43,143,96, | |
1207 106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,8,100,143,144,113,143, | |
1208 113,100,113,113,113,113,113,113,113,113,113,113,98,113,113,113,113,113, | |
1209 105,145,101, | |
1210 106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,38,41,116,146,16, | |
1211 13,113,116,13,115,113,114,112,100,113,113,113,113,113,113,113,113,113, | |
1212 113,113,113,113,113,113, | |
1213 106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,38,41,116,147,14, | |
1214 14,155,113,116,155,115,113,114,112,100,113,113,113,113,113,113,113,113, | |
1215 113,113,113,113,113,113,113, | |
1216 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, | |
1217 191,191,191,191,191,191,3,3,1,2,148,3,3,194, | |
1218 103,103,116,9,12,14,15,16,17,18,28,27,13,42,38,41,43,149,29,44,24,46,34,29, | |
1219 24,49,48,52,51,47,50,21,45,49,40,37,35,34,33,32,30,31,32,32,29,26,25,24, | |
1220 23,22,20,36,11,10,39,19, | |
1221 106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,38,41,116,150,28, | |
1222 23,113,116,23,115,113,114,112,100,113,113,113,113,113,113,113,113,113, | |
1223 113,113,113,113,113,113, | |
1224 121,110, | |
1225 121,109, | |
1226 103,103,116,9,12,14,15,16,17,18,28,27,13,153,29,71,21,46,40,37,35,34,33,32, | |
1227 30,31,32,32,29,26,25,24,23,22,20,36,11,10,39,19, | |
1228 121,154,38, | |
1229 148,7,156, | |
1230 106,107,109,110,111,12,66,68,28,27,74,78,88,108,98,13,42,38,41,116,156,15, | |
1231 12,113,116,12,115,113,114,112,100,113,113,113,113,113,113,113,113,113, | |
1232 113,113,113,113,113,113, | |
1233 | |
1234 }; | |
1235 | |
1236 | |
1237 static const unsigned short ag_sbt[] = { | |
1238 0, 26, 52, 79, 85, 146, 169, 171, 195, 197, 200, 226, 228, 260, | |
1239 290, 299, 308, 317, 326, 335, 360, 387, 428, 431, 434, 437, 440, 443, | |
1240 475, 507, 510, 543, 576, 581, 586, 595, 600, 604, 607, 616, 646, 651, | |
1241 660, 694, 730, 741, 745, 748, 752, 812, 815, 819, 866, 923, 980, 982, | |
1242 985, 988, 993, 996,1037,1078,1119,1160,1201,1222,1255,1287,1320,1352, | |
1243 1385,1419,1453,1474,1509,1541,1576,1597,1632,1664,1699,1720,1756,1777, | |
1244 1813,1834,1871,1892,1930,1962,2003,2024,2065,2086,2127,2148,2189,2210, | |
1245 2251,2283,2324,2361,2407,2448,2453,2512,2549,2576,2603,2635,2662,2689, | |
1246 2716,2761,2798,2802,2806,2809,2812,2815,2818,2821,2865,2868,2871,2874, | |
1247 2877,2880,2885,2890,2895,2900,2905,2910,2919,2928,2933,2936,2939,2942, | |
1248 2945,3002,3043,3046,3049,3089,3092,3138,3185,3218,3274,3320,3322,3324, | |
1249 3364,3367,3370,3416 | |
1250 }; | |
1251 | |
1252 | |
1253 static const unsigned short ag_sbe[] = { | |
1254 22, 49, 76, 83, 103, 168, 170, 194, 196, 198, 224, 227, 256, 286, | |
1255 295, 304, 313, 322, 331, 356, 371, 400, 429, 432, 435, 438, 441, 471, | |
1256 503, 508, 523, 556, 578, 583, 590, 597, 603, 605, 612, 642, 648, 656, | |
1257 690, 726, 735, 742, 746, 749, 770, 813, 816, 839, 883, 940, 981, 983, | |
1258 986, 991, 994,1009,1050,1091,1132,1173,1218,1235,1283,1300,1348,1365, | |
1259 1398,1432,1470,1487,1537,1554,1593,1610,1660,1677,1716,1733,1773,1790, | |
1260 1830,1847,1888,1905,1958,1975,2020,2037,2082,2099,2144,2161,2206,2223, | |
1261 2279,2296,2341,2381,2420,2449,2471,2545,2572,2599,2631,2658,2685,2712, | |
1262 2736,2778,2799,2803,2807,2810,2813,2816,2819,2861,2866,2869,2872,2875, | |
1263 2878,2882,2887,2892,2897,2902,2907,2914,2923,2930,2934,2937,2940,2943, | |
1264 2962,3015,3044,3047,3068,3090,3112,3158,3214,3235,3294,3321,3323,3337, | |
1265 3365,3368,3390,3416 | |
1266 }; | |
1267 | |
1268 | |
1269 static const unsigned char ag_fl[] = { | |
1270 2,0,1,2,1,2,1,1,0,1,2,1,5,3,3,5,3,1,1,2,1,2,3,4,4,2,2,2,4,4,2,4,3,3,1, | |
1271 2,0,3,3,1,3,3,3,3,3,1,5,1,3,1,3,1,3,3,1,3,3,3,3,1,3,3,1,3,3,1,2,2,1,3, | |
1272 1,1,4,4,4,4,4,3,2,1,1,2,0,1,3,1,2,0,1,3,1,1,2,2,2,3,2,1,2,0,1,3,3,1,2, | |
1273 1,1,0,1,4,4,3,0,1,2,2,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1274 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1275 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, | |
1276 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 | |
1277 }; | |
1278 | |
1279 static const unsigned char ag_ptt[] = { | |
1280 0, 6, 6, 4, 5, 5, 9, 9, 13, 13, 11, 11, 11, 11, 10, 10, 10, 8, | |
1281 8, 21, 21, 21, 21, 21, 21, 21, 20, 20, 20, 20, 20, 25, 27, 29, 32, 28, | |
1282 33, 33, 35, 22, 22, 22, 22, 22, 22, 36, 36, 42, 42, 45, 45, 47, 47, 47, | |
1283 49, 49, 49, 49, 49, 52, 52, 52, 57, 57, 57, 60, 60, 60, 63, 63, 64, 64, | |
1284 64, 64, 64, 64, 64, 64, 64, 1, 75, 75, 76, 76, 1, 80, 80, 81, 81, 1, | |
1285 12, 12, 12, 12, 12, 17, 84, 85, 85, 86, 86, 15, 15, 87, 87,114,134, 92, | |
1286 92,134,134, 90, 97, 97, 90, 90, 94, 94, 96, 96, 93, 93, 72, 72, 74, 74, | |
1287 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | |
1288 74, 74, 74, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, | |
1289 79, 79, 79, 79, 79, 79, 79, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, | |
1290 83, 83, 83, 83, 88, 88, 89, 89, 89,103,103,104,104, 14, 18, 16, 19, 24, | |
1291 23, 31, 30, 37, 3, 38, 39, 40, 41, 44, 43, 46, 48, 50, 51, 53, 54, 55, | |
1292 56, 58, 59, 61, 62, 65, 2, 66, 67, 68, 69, 70, 71,101, 95, 98,102, 91 | |
1293 }; | |
1294 | |
1295 static const unsigned char *ag_valid(PCB_DECL, int ag_k) { | |
1296 const unsigned char *ag_tp = &ag_tstt[ag_sbt[(PCB).sn+1]]; | |
1297 while (*--ag_tp != (unsigned char) ag_k) if (*ag_tp == 0) return NULL; | |
1298 return ag_tp; | |
1299 } | |
1300 | |
1301 int asi_change_reduction(PCB_DECL, asi_token_type ag_k) { | |
1302 if (!ag_valid(PCB_POINTER, ag_k)) return 0; | |
1303 (PCB).reduction_token = ag_k; | |
1304 return 1; | |
1305 } | |
1306 | |
1307 static void ag_default(PCB_DECL, const int *ag_tp) { | |
1308 (PCB).ag_dsn = (PCB).sn; | |
1309 (PCB).ag_dtl = ag_tp; | |
1310 while (!ag_valid(PCB_POINTER, (asi_token_type) *ag_tp)) ag_tp++; | |
1311 (PCB).reduction_token = (asi_token_type) *ag_tp; | |
1312 } | |
1313 | |
1314 | |
1315 | |
1316 static void ag_ra(PCB_DECL) | |
1317 { | |
1318 switch(ag_rpx[(PCB).ag_ap]) { | |
1319 case 1: ag_default(PCB_POINTER, &ag_rtt[0]); ag_rp_1(PCB_POINTER, V(2,(double *))); break; | |
1320 case 2: ag_rp_2(PCB_POINTER, V(0,(Location *))); break; | |
1321 case 3: ag_rp_3(PCB_POINTER, V(0,(Location *))); break; | |
1322 case 4: V(0,(Location *)) = ag_rp_4(PCB_POINTER); break; | |
1323 case 5: ag_rp_5(PCB_POINTER); break; | |
1324 case 6: ag_rp_6(PCB_POINTER); break; | |
1325 case 7: ag_default(PCB_POINTER, &ag_rtt[3]); ag_rp_7(PCB_POINTER, V(1,(double *))); break; | |
1326 case 8: V(0,(double *)) = ag_rp_8(PCB_POINTER, V(0,(double * *)), V(2,(double *))); break; | |
1327 case 9: V(0,(double *)) = ag_rp_9(PCB_POINTER, V(0,(double * *)), V(2,(double *))); break; | |
1328 case 10: V(0,(double *)) = ag_rp_10(PCB_POINTER, V(0,(double * *)), V(2,(double *))); break; | |
1329 case 11: V(0,(double *)) = ag_rp_11(PCB_POINTER, V(0,(double * *)), V(2,(double *))); break; | |
1330 case 12: V(0,(double *)) = ag_rp_12(PCB_POINTER, V(0,(double * *)), V(2,(double *))); break; | |
1331 case 13: V(0,(double *)) = ag_rp_13(PCB_POINTER, V(0,(double *)), V(2,(double *)), V(4,(double *))); break; | |
1332 case 14: V(0,(double *)) = ag_rp_14(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1333 case 15: V(0,(double *)) = ag_rp_15(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1334 case 16: V(0,(double *)) = ag_rp_16(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1335 case 17: V(0,(double *)) = ag_rp_17(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1336 case 18: V(0,(double *)) = ag_rp_18(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1337 case 19: V(0,(double *)) = ag_rp_19(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1338 case 20: V(0,(double *)) = ag_rp_20(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1339 case 21: V(0,(double *)) = ag_rp_21(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1340 case 22: V(0,(double *)) = ag_rp_22(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1341 case 23: V(0,(double *)) = ag_rp_23(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1342 case 24: V(0,(double *)) = ag_rp_24(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1343 case 25: V(0,(double *)) = ag_rp_25(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1344 case 26: V(0,(double *)) = ag_rp_26(PCB_POINTER, V(1,(double *))); break; | |
1345 case 27: V(0,(double *)) = ag_rp_27(PCB_POINTER, V(1,(double *))); break; | |
1346 case 28: V(0,(double *)) = ag_rp_28(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1347 case 29: V(0,(double *)) = ag_rp_29(PCB_POINTER, V(0,(double * *))); break; | |
1348 case 30: V(0,(double *)) = ag_rp_30(PCB_POINTER, V(2,(double *))); break; | |
1349 case 31: V(0,(double *)) = ag_rp_31(PCB_POINTER, V(2,(double *))); break; | |
1350 case 32: V(0,(double *)) = ag_rp_32(PCB_POINTER, V(2,(double *))); break; | |
1351 case 33: V(0,(double *)) = ag_rp_33(PCB_POINTER, V(2,(double *))); break; | |
1352 case 34: V(0,(double *)) = ag_rp_34(PCB_POINTER, V(2,(double *))); break; | |
1353 case 35: V(0,(double *)) = ag_rp_35(PCB_POINTER, V(1,(double *))); break; | |
1354 case 36: V(0,(double *)) = ag_rp_36(PCB_POINTER, V(1,(double *))); break; | |
1355 case 37: V(0,(int *)) = ag_rp_37(PCB_POINTER, V(0,(int *))); break; | |
1356 case 38: V(0,(int *)) = ag_rp_38(PCB_POINTER, V(0,(int *)), V(1,(int *))); break; | |
1357 case 39: V(0,(double * *)) = ag_rp_39(PCB_POINTER, V(0,(int *))); break; | |
1358 case 40: V(0,(double *)) = ag_rp_40(PCB_POINTER, V(0,(double *)), V(3,(int *))); break; | |
1359 case 41: V(0,(double *)) = ag_rp_41(PCB_POINTER, V(0,(double *)), V(3,(int *))); break; | |
1360 case 42: V(0,(double *)) = ag_rp_42(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1361 case 43: V(0,(double *)) = ag_rp_43(PCB_POINTER, V(1,(double *))); break; | |
1362 case 44: V(0,(double *)) = ag_rp_44(PCB_POINTER, V(0,(int *))); break; | |
1363 case 45: V(0,(double *)) = ag_rp_45(PCB_POINTER, V(0,(double *)), V(1,(int *))); break; | |
1364 case 46: V(0,(double *)) = ag_rp_46(PCB_POINTER, V(0,(int *))); break; | |
1365 case 47: V(0,(double *)) = ag_rp_47(PCB_POINTER, V(0,(int *)), V(1,(double *))); break; | |
1366 case 48: V(0,(int *)) = ag_rp_48(PCB_POINTER, V(0,(int *))); break; | |
1367 case 49: V(0,(int *)) = ag_rp_49(PCB_POINTER, V(0,(int *)), V(1,(int *))); break; | |
1368 } | |
1369 (PCB).la_ptr = (PCB).pointer; | |
1370 } | |
1371 | |
1372 #define TOKEN_NAMES asi_token_names | |
1373 const char *const asi_token_names[146] = { | |
1374 "input string", | |
1375 "white space", | |
1376 "real", | |
1377 "name", | |
1378 "input string", | |
1379 "statements", | |
1380 "", | |
1381 "eof", | |
1382 "statement", | |
1383 "skip statement", | |
1384 "skip open statement", | |
1385 "skip closed statement", | |
1386 "statement text", | |
1387 "", | |
1388 "';'", | |
1389 "balanced braces", | |
1390 "\"if\"", | |
1391 "balanced parens", | |
1392 "\"else\"", | |
1393 "\"while\"", | |
1394 "open statement", | |
1395 "closed statement", | |
1396 "expression", | |
1397 "'{'", | |
1398 "'}'", | |
1399 "true if condition", | |
1400 "false if condition", | |
1401 "closed while", | |
1402 "execute while", | |
1403 "open while", | |
1404 "'('", | |
1405 "')'", | |
1406 "while", | |
1407 "while loop", | |
1408 "false while condition", | |
1409 "true while condition", | |
1410 "conditional expression", | |
1411 "'='", | |
1412 "\"+=\"", | |
1413 "\"-=\"", | |
1414 "\"*=\"", | |
1415 "\"/=\"", | |
1416 "logical or expression", | |
1417 "'\\?'", | |
1418 "':'", | |
1419 "logical and expression", | |
1420 "\"||\"", | |
1421 "equality expression", | |
1422 "\"&&\"", | |
1423 "relational expression", | |
1424 "\"==\"", | |
1425 "\"!=\"", | |
1426 "additive expression", | |
1427 "'<'", | |
1428 "\"<=\"", | |
1429 "'>'", | |
1430 "\">=\"", | |
1431 "multiplicative expression", | |
1432 "'+'", | |
1433 "'-'", | |
1434 "unary expression", | |
1435 "'*'", | |
1436 "'/'", | |
1437 "factor", | |
1438 "primary", | |
1439 "\"**\"", | |
1440 "\"log\"", | |
1441 "\"exp\"", | |
1442 "\"sin\"", | |
1443 "\"cos\"", | |
1444 "\"tan\"", | |
1445 "'!'", | |
1446 "blank", | |
1447 "\"/*\"", | |
1448 "", | |
1449 "", | |
1450 "", | |
1451 "\"*/\"", | |
1452 "\"//\"", | |
1453 "", | |
1454 "", | |
1455 "", | |
1456 "'\\n'", | |
1457 "statement char", | |
1458 "", | |
1459 "", | |
1460 "", | |
1461 "name string", | |
1462 "letter", | |
1463 "", | |
1464 "simple real", | |
1465 "", | |
1466 "", | |
1467 "exponent", | |
1468 "integer part", | |
1469 "'.'", | |
1470 "fraction part", | |
1471 "", | |
1472 "digit", | |
1473 "", | |
1474 "", | |
1475 "", | |
1476 "", | |
1477 "", | |
1478 "", | |
1479 "';'", | |
1480 "\"else\"", | |
1481 "\"if\"", | |
1482 "\"while\"", | |
1483 "'}'", | |
1484 "'{'", | |
1485 "')'", | |
1486 "'('", | |
1487 "'='", | |
1488 "name", | |
1489 "\"+=\"", | |
1490 "\"-=\"", | |
1491 "\"*=\"", | |
1492 "\"/=\"", | |
1493 "':'", | |
1494 "'\\?'", | |
1495 "\"||\"", | |
1496 "\"&&\"", | |
1497 "\"==\"", | |
1498 "\"!=\"", | |
1499 "'<'", | |
1500 "\"<=\"", | |
1501 "'>'", | |
1502 "\">=\"", | |
1503 "'+'", | |
1504 "'-'", | |
1505 "'*'", | |
1506 "'/'", | |
1507 "\"**\"", | |
1508 "real", | |
1509 "\"log\"", | |
1510 "\"exp\"", | |
1511 "\"sin\"", | |
1512 "\"cos\"", | |
1513 "\"tan\"", | |
1514 "'!'", | |
1515 "", | |
1516 "'.'", | |
1517 "digit", | |
1518 "", | |
1519 "", | |
1520 | |
1521 }; | |
1522 | |
1523 #ifndef MISSING_FORMAT | |
1524 #define MISSING_FORMAT "Missing %s" | |
1525 #endif | |
1526 #ifndef UNEXPECTED_FORMAT | |
1527 #define UNEXPECTED_FORMAT "Unexpected %s" | |
1528 #endif | |
1529 #ifndef UNNAMED_TOKEN | |
1530 #define UNNAMED_TOKEN "input" | |
1531 #endif | |
1532 | |
1533 | |
1534 static void ag_diagnose(PCB_DECL) { | |
1535 int ag_snd = (PCB).sn; | |
1536 int ag_k = ag_sbt[ag_snd]; | |
1537 | |
1538 if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) { | |
1539 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); | |
1540 } | |
1541 else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8 | |
1542 && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1 | |
1543 && *TOKEN_NAMES[ag_tstt[ag_k]]) { | |
1544 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); | |
1545 } | |
1546 else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) { | |
1547 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]); | |
1548 } | |
1549 else if (isprint(INPUT_CODE((*(PCB).pointer))) && INPUT_CODE((*(PCB).pointer)) != '\\') { | |
1550 char buf[20]; | |
1551 sprintf(buf, "\'%c\'", (char) INPUT_CODE((*(PCB).pointer))); | |
1552 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf); | |
1553 } | |
1554 else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN); | |
1555 (PCB).error_message = (PCB).ag_msg; | |
1556 | |
1557 | |
1558 } | |
1559 static int ag_action_1_r_proc(PCB_DECL); | |
1560 static int ag_action_2_r_proc(PCB_DECL); | |
1561 static int ag_action_3_r_proc(PCB_DECL); | |
1562 static int ag_action_4_r_proc(PCB_DECL); | |
1563 static int ag_action_1_s_proc(PCB_DECL); | |
1564 static int ag_action_3_s_proc(PCB_DECL); | |
1565 static int ag_action_1_proc(PCB_DECL); | |
1566 static int ag_action_2_proc(PCB_DECL); | |
1567 static int ag_action_3_proc(PCB_DECL); | |
1568 static int ag_action_4_proc(PCB_DECL); | |
1569 static int ag_action_5_proc(PCB_DECL); | |
1570 static int ag_action_6_proc(PCB_DECL); | |
1571 static int ag_action_7_proc(PCB_DECL); | |
1572 static int ag_action_8_proc(PCB_DECL); | |
1573 static int ag_action_9_proc(PCB_DECL); | |
1574 static int ag_action_10_proc(PCB_DECL); | |
1575 static int ag_action_11_proc(PCB_DECL); | |
1576 static int ag_action_8_proc(PCB_DECL); | |
1577 | |
1578 | |
1579 static int (*const ag_r_procs_scan[])(PCB_DECL) = { | |
1580 ag_action_1_r_proc, | |
1581 ag_action_2_r_proc, | |
1582 ag_action_3_r_proc, | |
1583 ag_action_4_r_proc | |
1584 }; | |
1585 | |
1586 static int (*const ag_s_procs_scan[])(PCB_DECL) = { | |
1587 ag_action_1_s_proc, | |
1588 ag_action_2_r_proc, | |
1589 ag_action_3_s_proc, | |
1590 ag_action_4_r_proc | |
1591 }; | |
1592 | |
1593 static int (*const ag_gt_procs_scan[])(PCB_DECL) = { | |
1594 ag_action_1_proc, | |
1595 ag_action_2_proc, | |
1596 ag_action_3_proc, | |
1597 ag_action_4_proc, | |
1598 ag_action_5_proc, | |
1599 ag_action_6_proc, | |
1600 ag_action_7_proc, | |
1601 ag_action_8_proc, | |
1602 ag_action_9_proc, | |
1603 ag_action_10_proc, | |
1604 ag_action_11_proc, | |
1605 ag_action_8_proc | |
1606 }; | |
1607 | |
1608 | |
1609 static int ag_action_10_proc(PCB_DECL) { | |
1610 int ag_t = (PCB).token_number; | |
1611 (PCB).btsx = 0, (PCB).drt = -1; | |
1612 do { | |
1613 ag_track(PCB_POINTER); | |
1614 (PCB).token_number = (asi_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr)); | |
1615 (PCB).la_ptr++; | |
1616 if (ag_key_index[(PCB).sn]) { | |
1617 unsigned ag_k = ag_key_index[(PCB).sn]; | |
1618 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer)); | |
1619 if (ag_ch <= 255) { | |
1620 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
1621 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k); | |
1622 } | |
1623 } | |
1624 } while ((PCB).token_number == (asi_token_type) ag_t); | |
1625 (PCB).la_ptr = (PCB).pointer; | |
1626 return 1; | |
1627 } | |
1628 | |
1629 static int ag_action_11_proc(PCB_DECL) { | |
1630 int ag_t = (PCB).token_number; | |
1631 | |
1632 (PCB).btsx = 0, (PCB).drt = -1; | |
1633 do { | |
1634 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; | |
1635 (PCB).ssx--; | |
1636 ag_track(PCB_POINTER); | |
1637 ag_ra(PCB_POINTER); | |
1638 if ((PCB).exit_flag != AG_RUNNING_CODE) return 0; | |
1639 (PCB).ssx++; | |
1640 (PCB).token_number = (asi_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr)); | |
1641 (PCB).la_ptr++; | |
1642 if (ag_key_index[(PCB).sn]) { | |
1643 unsigned ag_k = ag_key_index[(PCB).sn]; | |
1644 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer)); | |
1645 if (ag_ch <= 255) { | |
1646 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
1647 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k); | |
1648 } | |
1649 } | |
1650 } | |
1651 while ((PCB).token_number == (asi_token_type) ag_t); | |
1652 (PCB).la_ptr = (PCB).pointer; | |
1653 return 1; | |
1654 } | |
1655 | |
1656 static int ag_action_3_r_proc(PCB_DECL) { | |
1657 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1658 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1659 (PCB).btsx = 0, (PCB).drt = -1; | |
1660 (PCB).reduction_token = (asi_token_type) ag_ptt[(PCB).ag_ap]; | |
1661 ag_ra(PCB_POINTER); | |
1662 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1663 } | |
1664 | |
1665 static int ag_action_3_s_proc(PCB_DECL) { | |
1666 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1667 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1668 (PCB).btsx = 0, (PCB).drt = -1; | |
1669 (PCB).reduction_token = (asi_token_type) ag_ptt[(PCB).ag_ap]; | |
1670 ag_ra(PCB_POINTER); | |
1671 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1672 } | |
1673 | |
1674 static int ag_action_4_r_proc(PCB_DECL) { | |
1675 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1676 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1677 (PCB).reduction_token = (asi_token_type) ag_ptt[(PCB).ag_ap]; | |
1678 return 1; | |
1679 } | |
1680 | |
1681 static int ag_action_2_proc(PCB_DECL) { | |
1682 (PCB).btsx = 0, (PCB).drt = -1; | |
1683 if ((PCB).ssx >= 128) { | |
1684 (PCB).exit_flag = AG_STACK_ERROR_CODE; | |
1685 PARSER_STACK_OVERFLOW; | |
1686 } | |
1687 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; | |
1688 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1689 (PCB).ssx++; | |
1690 (PCB).sn = (PCB).ag_ap; | |
1691 ag_track(PCB_POINTER); | |
1692 return 0; | |
1693 } | |
1694 | |
1695 static int ag_action_9_proc(PCB_DECL) { | |
1696 if ((PCB).drt == -1) { | |
1697 (PCB).drt=(PCB).token_number; | |
1698 (PCB).dssx=(PCB).ssx; | |
1699 (PCB).dsn=(PCB).sn; | |
1700 } | |
1701 ag_prot(PCB_POINTER); | |
1702 (PCB).vs[(PCB).ssx] = ag_null_value; | |
1703 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1704 (PCB).ssx++; | |
1705 (PCB).sn = (PCB).ag_ap; | |
1706 (PCB).la_ptr = (PCB).pointer; | |
1707 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1708 } | |
1709 | |
1710 static int ag_action_2_r_proc(PCB_DECL) { | |
1711 (PCB).ssx++; | |
1712 (PCB).sn = (PCB).ag_ap; | |
1713 return 0; | |
1714 } | |
1715 | |
1716 static int ag_action_7_proc(PCB_DECL) { | |
1717 --(PCB).ssx; | |
1718 (PCB).la_ptr = (PCB).pointer; | |
1719 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1720 return 0; | |
1721 } | |
1722 | |
1723 static int ag_action_1_proc(PCB_DECL) { | |
1724 ag_track(PCB_POINTER); | |
1725 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1726 return 0; | |
1727 } | |
1728 | |
1729 static int ag_action_1_r_proc(PCB_DECL) { | |
1730 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1731 return 0; | |
1732 } | |
1733 | |
1734 static int ag_action_1_s_proc(PCB_DECL) { | |
1735 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1736 return 0; | |
1737 } | |
1738 | |
1739 static int ag_action_4_proc(PCB_DECL) { | |
1740 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1741 (PCB).reduction_token = (asi_token_type) ag_ptt[(PCB).ag_ap]; | |
1742 (PCB).btsx = 0, (PCB).drt = -1; | |
1743 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; | |
1744 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1745 else (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1746 ag_track(PCB_POINTER); | |
1747 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1748 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1749 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1750 do { | |
1751 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1752 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1753 else ag_t2 = ag_tx; | |
1754 } while (ag_t1 < ag_t2); | |
1755 if (ag_tstt[ag_t1] != (PCB).reduction_token) { | |
1756 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; | |
1757 REDUCTION_TOKEN_ERROR; break;} | |
1758 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1759 if ((ag_s_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; | |
1760 } | |
1761 return 0; | |
1762 } | |
1763 | |
1764 static int ag_action_3_proc(PCB_DECL) { | |
1765 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1766 (PCB).btsx = 0, (PCB).drt = -1; | |
1767 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; | |
1768 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1769 else (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1770 ag_track(PCB_POINTER); | |
1771 (PCB).reduction_token = (asi_token_type) ag_ptt[(PCB).ag_ap]; | |
1772 ag_ra(PCB_POINTER); | |
1773 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1774 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1775 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1776 do { | |
1777 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1778 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1779 else ag_t2 = ag_tx; | |
1780 } while (ag_t1 < ag_t2); | |
1781 if (ag_tstt[ag_t1] != (PCB).reduction_token) { | |
1782 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; | |
1783 REDUCTION_TOKEN_ERROR; break;} | |
1784 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1785 if ((ag_s_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; | |
1786 } | |
1787 return 0; | |
1788 } | |
1789 | |
1790 static int ag_action_8_proc(PCB_DECL) { | |
1791 ag_undo(PCB_POINTER); | |
1792 (PCB).la_ptr = (PCB).pointer; | |
1793 (PCB).exit_flag = AG_SYNTAX_ERROR_CODE; | |
1794 ag_diagnose(PCB_POINTER); | |
1795 SYNTAX_ERROR; | |
1796 {(PCB).la_ptr = (PCB).pointer + 1; ag_track(PCB_POINTER);} | |
1797 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1798 } | |
1799 | |
1800 static int ag_action_5_proc(PCB_DECL) { | |
1801 int ag_sd = ag_fl[(PCB).ag_ap]; | |
1802 (PCB).btsx = 0, (PCB).drt = -1; | |
1803 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1804 else { | |
1805 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1806 } | |
1807 (PCB).la_ptr = (PCB).pointer; | |
1808 (PCB).reduction_token = (asi_token_type) ag_ptt[(PCB).ag_ap]; | |
1809 ag_ra(PCB_POINTER); | |
1810 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1811 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1812 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1813 do { | |
1814 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1815 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1816 else ag_t2 = ag_tx; | |
1817 } while (ag_t1 < ag_t2); | |
1818 if (ag_tstt[ag_t1] != (PCB).reduction_token) { | |
1819 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; | |
1820 REDUCTION_TOKEN_ERROR; break;} | |
1821 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1822 if ((ag_r_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; | |
1823 } | |
1824 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1825 } | |
1826 | |
1827 static int ag_action_6_proc(PCB_DECL) { | |
1828 int ag_sd = ag_fl[(PCB).ag_ap]; | |
1829 (PCB).reduction_token = (asi_token_type) ag_ptt[(PCB).ag_ap]; | |
1830 if ((PCB).drt == -1) { | |
1831 (PCB).drt=(PCB).token_number; | |
1832 (PCB).dssx=(PCB).ssx; | |
1833 (PCB).dsn=(PCB).sn; | |
1834 } | |
1835 if (ag_sd) { | |
1836 (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1837 } | |
1838 else { | |
1839 ag_prot(PCB_POINTER); | |
1840 (PCB).vs[(PCB).ssx] = ag_null_value; | |
1841 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1842 } | |
1843 (PCB).la_ptr = (PCB).pointer; | |
1844 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1845 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1846 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1847 do { | |
1848 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1849 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1850 else ag_t2 = ag_tx; | |
1851 } while (ag_t1 < ag_t2); | |
1852 if (ag_tstt[ag_t1] != (PCB).reduction_token) { | |
1853 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; | |
1854 REDUCTION_TOKEN_ERROR; break;} | |
1855 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1856 if ((ag_r_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; | |
1857 } | |
1858 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1859 } | |
1860 | |
1861 | |
1862 void init_asi(asi_pcb_type *PCB_POINTER) { | |
1863 (PCB).la_ptr = (PCB).pointer; | |
1864 (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0; | |
1865 (PCB).exit_flag = AG_RUNNING_CODE; | |
1866 (PCB).line = FIRST_LINE; | |
1867 (PCB).column = FIRST_COLUMN; | |
1868 (PCB).btsx = 0, (PCB).drt = -1; | |
1869 } | |
1870 | |
1871 void asi(asi_pcb_type *PCB_POINTER) { | |
1872 init_asi(PCB_POINTER); | |
1873 (PCB).exit_flag = AG_RUNNING_CODE; | |
1874 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1875 unsigned ag_t1 = ag_sbt[(PCB).sn]; | |
1876 if (ag_tstt[ag_t1]) { | |
1877 unsigned ag_t2 = ag_sbe[(PCB).sn] - 1; | |
1878 (PCB).token_number = (asi_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr)); | |
1879 (PCB).la_ptr++; | |
1880 if (ag_key_index[(PCB).sn]) { | |
1881 unsigned ag_k = ag_key_index[(PCB).sn]; | |
1882 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer)); | |
1883 if (ag_ch <= 255) { | |
1884 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
1885 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k); | |
1886 } | |
1887 } | |
1888 do { | |
1889 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1890 if (ag_tstt[ag_tx] > (unsigned char)(PCB).token_number) | |
1891 ag_t1 = ag_tx + 1; | |
1892 else ag_t2 = ag_tx; | |
1893 } while (ag_t1 < ag_t2); | |
1894 if (ag_tstt[ag_t1] != (unsigned char)(PCB).token_number) | |
1895 ag_t1 = ag_sbe[(PCB).sn]; | |
1896 } | |
1897 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1898 (ag_gt_procs_scan[ag_astt[ag_t1]])((PCB_TYPE *)PCB_POINTER); | |
1899 } | |
1900 } | |
1901 | |
1902 |