comparison tests/agcl/oldagsrc/good/bciastp.cpp @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 /*
2 BCIAST.SYN
3
4 Compiler for Byte Code Interpreter (using parse tree)
5 Copyright (c) 1997 Parsifal Software, All Rights Reserved.
6
7 The expression syntax is borrowed from C but with the
8 addition of the FORTRAN exponentiation operator (**).
9
10 The cast, increment, and decrement operators are not
11 implemented, nor are operations that are defined only
12 for integers:
13 Bitwise logical operators: &, |, ^, ~, &=, |=, ^=
14 Remainder operators: %, %=
15 Shift operators: <<, >>, >>=, <<=
16
17 The supported operations are:
18 Assignment operators: =, +=, -=, *=, /=
19 Conditional expressions: ? :
20 Logical operators: !, &&, ||
21 Comparison operators: ==, !=, <, <=, >, >=
22 Binary arithmetic operators: +, -, *, /
23 Exponentiation: **
24 Unary arithmetic operators: +, -
25 Parentheses
26 Built-in functions LOG, EXP
27
28 All arithmetic is double precision floating point.
29
30 Statements may include expression statements, blocks, if/else statements
31 or while statements, following the rules of C.
32
33 The statement syntax has been written to avoid the conventional
34 if/else ambiguity.
35
36 There are no declarations. All variables are presumed to be double.
37
38 Input strings may contain any number of statements. White space may be
39 used freely, including both C and C++ style comments.
40
41 vmParse makes the following external calls:
42 void pushChar(int character);
43 Push the specified character onto a character stack.
44
45 int locateVariable(int nameLength);
46 Pop the last nameLength characters from the character stack
47 and, treating them as the name of a variable, return an
48 index into the variable array.
49
50 Overrides for macros defined by AnaGram, such as SYNTAX_ERROR
51 are included in VMDEFS.H
52
53 VMPT.SYN is compiled with the AnaGram parser generator
54 yielding VMPT.H and VMPT.CPP.
55
56 To build VMPT, compile and link VMPT.CPP, VMDEMO.CPP and PTREE.CPP
57 with your C++ compiler.
58
59 For information about AnaGram, visit http://www.parsifalsoft.com.
60 */
61
62 #include "bciast.h"
63 #include "agstk.h" // Defines AgStack<Object>
64 #include "agstr.h" // Defines AgString et al
65 #include <math.h> // for pow()
66 #include "ptree.h"
67
68 //typedef AgStack<Statement *> StatementList;
69
70
71 /*
72 * AnaGram, A System for Syntax Directed Programming
73 * File generated by: ...
74 *
75 * AnaGram Parsing Engine
76 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
77 *
78 * This software is provided 'as-is', without any express or implied
79 * warranty. In no event will the authors be held liable for any damages
80 * arising from the use of this software.
81 *
82 * Permission is granted to anyone to use this software for any purpose,
83 * including commercial applications, and to alter it and redistribute it
84 * freely, subject to the following restrictions:
85 *
86 * 1. The origin of this software must not be misrepresented; you must not
87 * claim that you wrote the original software. If you use this software
88 * in a product, an acknowledgment in the product documentation would be
89 * appreciated but is not required.
90 * 2. Altered source versions must be plainly marked as such, and must not be
91 * misrepresented as being the original software.
92 * 3. This notice may not be removed or altered from any source distribution.
93 */
94
95 #ifndef BCIASTP_H
96 #include "bciastp.h"
97 #endif
98
99 #ifndef BCIASTP_H
100 #error Mismatched header file
101 #endif
102
103 #include <ctype.h>
104 #include <stdio.h>
105
106 #define RULE_CONTEXT (&((PCB).cs[(PCB).ssx]))
107 #define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx])
108 #define CONTEXT ((PCB).cs[(PCB).ssx])
109
110
111 #ifndef PCB_TYPE
112 #define PCB_TYPE astParse_pcb_type
113 #endif
114
115
116 #define PCB (*pcb_pointer)
117 #define PCB_DECL PCB_TYPE *pcb_pointer
118 #define PCB_POINTER pcb_pointer
119
120 Program * astParse_value(PCB_DECL);
121
122 static void ag_delete_wrappers(PCB_DECL);
123 #ifndef DELETE_WRAPPERS
124 #define DELETE_WRAPPERS ag_delete_wrappers(PCB_POINTER)
125 #endif
126
127 /* Line -, bciastp.syn */
128 // begin embedded C
129
130 void ag_delete_wrappers(astParse_pcb_struct *);
131
132 void parseStatements(AbstractSyntaxTree *tree, char *text) {
133 astParse_pcb_struct pcb;
134 pcb.ast = tree;
135 pcb.pointer = (unsigned char *) text;
136 astParse(&pcb);
137 if (pcb.exit_flag == AG_SUCCESS_CODE) tree->setRoot(astParse_value(&pcb));
138 else ag_delete_wrappers(&pcb);
139 }
140
141 #ifndef CONVERT_CASE
142 #define CONVERT_CASE(c) (c)
143 #endif
144 #ifndef TAB_SPACING
145 #define TAB_SPACING 8
146 #endif
147 Program * astParse_value(PCB_DECL) {
148 Program * returnValue;
149 returnValue = (*(Program * *) &(PCB).vs[(PCB).ssx]);
150 return returnValue;
151 }
152
153 static inline Program * ag_rp_1(PCB_DECL, AgStack<Statement *> &s) {
154 /* Line -, bciastp.syn */
155 return PCB.ast->makeProgram(s);
156 }
157
158 static inline AgStack<Statement *> ag_rp_2(PCB_DECL) {
159 /* Line -, bciastp.syn */
160 return AgStack<Statement *>();
161 }
162
163 static inline AgStack<Statement *> ag_rp_3(PCB_DECL, AgStack<Statement *> &s, Statement * x) {
164 /* Line -, bciastp.syn */
165 return s.push(x);
166 }
167
168 static inline Statement * ag_rp_4(PCB_DECL, Expression * x, Statement * s) {
169 /* Line -, bciastp.syn */
170 return PCB.ast->makeIfStatement(x, s);
171 }
172
173 static inline Statement * ag_rp_5(PCB_DECL, Expression * x, Statement * s1, Statement * s2) {
174 /* Line -, bciastp.syn */
175 return PCB.ast->makeIfElseStatement(x,s1,s2);
176 }
177
178 static inline Statement * ag_rp_6(PCB_DECL, Expression * x, Statement * s) {
179 /* Line -, bciastp.syn */
180 return PCB.ast->makeWhileStatement(x,s);
181 }
182
183 static inline Statement * ag_rp_7(PCB_DECL, Expression * init, Expression * cond, Expression * inc, Statement * s) {
184 /* Line -, bciastp.syn */
185 return PCB.ast->makeForStatement(init, cond, inc, s);
186 }
187
188 static inline Statement * ag_rp_8(PCB_DECL, Expression * x, Statement * s1, Statement * s2) {
189 /* Line -, bciastp.syn */
190 return PCB.ast->makeIfElseStatement(x,s1,s2);
191 }
192
193 static inline Statement * ag_rp_9(PCB_DECL, Expression * x, Statement * s) {
194 /* Line -, bciastp.syn */
195 return PCB.ast->makeWhileStatement(x,s);
196 }
197
198 static inline Statement * ag_rp_10(PCB_DECL, Expression * init, Expression * cond, Expression * inc, Statement * s) {
199 /* Line -, bciastp.syn */
200 return PCB.ast->makeForStatement(init, cond, inc, s);
201 }
202
203 static inline Statement * ag_rp_11(PCB_DECL, Statement * x) {
204 /* Line -, bciastp.syn */
205 return x;
206 }
207
208 static inline Statement * ag_rp_12(PCB_DECL, Statement * s, Expression * x) {
209 /* Line -, bciastp.syn */
210 return PCB.ast->makeDoStatement(s,x);
211 }
212
213 static inline Statement * ag_rp_13(PCB_DECL, Expression * x) {
214 /* Line -, bciastp.syn */
215 return PCB.ast->makeExpressionStatement(x);
216 }
217
218 static inline Statement * ag_rp_14(PCB_DECL) {
219 /* Line -, bciastp.syn */
220 return PCB.ast->makeStatement();
221 }
222
223 static inline Statement * ag_rp_15(PCB_DECL, AgStack<Statement *> &s) {
224 /* Line -, bciastp.syn */
225 return PCB.ast->makeStatementBlock(s);
226 }
227
228 static inline Expression * ag_rp_16(PCB_DECL, Expression * x, Expression * y) {
229 /* Line -, bciastp.syn */
230 return PCB.ast->makeCommaExpression(x,y);
231 }
232
233 static inline Expression * ag_rp_17(PCB_DECL, AgString &k, Expression * x) {
234 /* Line -, bciastp.syn */
235 return PCB.ast->makeSimpleAssignment(k, x);
236 }
237
238 static inline Expression * ag_rp_18(PCB_DECL, AgString &k, Expression * x) {
239 /* Line -, bciastp.syn */
240 return PCB.ast->makeAddMemory(k, x);
241 }
242
243 static inline Expression * ag_rp_19(PCB_DECL, AgString &k, Expression * x) {
244 /* Line -, bciastp.syn */
245 return PCB.ast->makeSubMemory(k, x);
246 }
247
248 static inline Expression * ag_rp_20(PCB_DECL, AgString &k, Expression * x) {
249 /* Line -, bciastp.syn */
250 return PCB.ast->makeMulMemory(k, x);
251 }
252
253 static inline Expression * ag_rp_21(PCB_DECL, AgString &k, Expression * x) {
254 /* Line -, bciastp.syn */
255 return PCB.ast->makeDivMemory(k, x);
256 }
257
258 static inline Expression * ag_rp_22(PCB_DECL, Expression * c, Expression * x, Expression * y) {
259 /* Line -, bciastp.syn */
260 return PCB.ast->makeConditionalExpression(c,x,y);
261 }
262
263 static inline Expression * ag_rp_23(PCB_DECL, Expression * x, Expression * y) {
264 /* Line -, bciastp.syn */
265 return PCB.ast->makeLogicalOrExpression(x, y);
266 }
267
268 static inline Expression * ag_rp_24(PCB_DECL, Expression * x, Expression * y) {
269 /* Line -, bciastp.syn */
270 return PCB.ast->makeLogicalAndExpression(x,y);
271 }
272
273 static inline Expression * ag_rp_25(PCB_DECL, Expression * x, Expression * y) {
274 /* Line -, bciastp.syn */
275 return PCB.ast->makeEqExpression(x,y);
276 }
277
278 static inline Expression * ag_rp_26(PCB_DECL, Expression * x, Expression * y) {
279 /* Line -, bciastp.syn */
280 return PCB.ast->makeNeExpression(x,y);
281 }
282
283 static inline Expression * ag_rp_27(PCB_DECL, Expression * x, Expression * y) {
284 /* Line -, bciastp.syn */
285 return PCB.ast->makeLtExpression(x,y);
286 }
287
288 static inline Expression * ag_rp_28(PCB_DECL, Expression * x, Expression * y) {
289 /* Line -, bciastp.syn */
290 return PCB.ast->makeLeExpression(x,y);
291 }
292
293 static inline Expression * ag_rp_29(PCB_DECL, Expression * x, Expression * y) {
294 /* Line -, bciastp.syn */
295 return PCB.ast->makeGtExpression(x,y);
296 }
297
298 static inline Expression * ag_rp_30(PCB_DECL, Expression * x, Expression * y) {
299 /* Line -, bciastp.syn */
300 return PCB.ast->makeGeExpression(x,y);
301 }
302
303 static inline Expression * ag_rp_31(PCB_DECL, Expression * x, Expression * y) {
304 /* Line -, bciastp.syn */
305 return PCB.ast->makeAddExpression(x,y);
306 }
307
308 static inline Expression * ag_rp_32(PCB_DECL, Expression * x, Expression * y) {
309 /* Line -, bciastp.syn */
310 return PCB.ast->makeSubExpression(x,y);
311 }
312
313 static inline Expression * ag_rp_33(PCB_DECL, Expression * x, Expression * y) {
314 /* Line -, bciastp.syn */
315 return PCB.ast->makeMulExpression(x,y);
316 }
317
318 static inline Expression * ag_rp_34(PCB_DECL, Expression * x, Expression * y) {
319 /* Line -, bciastp.syn */
320 return PCB.ast->makeDivExpression(x,y);
321 }
322
323 static inline Expression * ag_rp_35(PCB_DECL, Expression * x) {
324 /* Line -, bciastp.syn */
325 return PCB.ast->makeNegExpression(x);
326 }
327
328 static inline Expression * ag_rp_36(PCB_DECL, Expression * x) {
329 /* Line -, bciastp.syn */
330 return x;
331 }
332
333 static inline Expression * ag_rp_37(PCB_DECL, Expression * x) {
334 /* Line -, bciastp.syn */
335 return PCB.ast->makeNotExpression(x);
336 }
337
338 static inline Expression * ag_rp_38(PCB_DECL, Expression * x, Expression * y) {
339 /* Line -, bciastp.syn */
340 return PCB.ast->makePowExpression(x,y);
341 }
342
343 static inline Expression * ag_rp_39(PCB_DECL, double x) {
344 /* Line -, bciastp.syn */
345 return PCB.ast->makeConstant(x);
346 }
347
348 static inline Expression * ag_rp_40(PCB_DECL, AgString &k) {
349 /* Line -, bciastp.syn */
350 return PCB.ast->makeVariable(k);
351 }
352
353 static inline Expression * ag_rp_41(PCB_DECL, Expression * x) {
354 /* Line -, bciastp.syn */
355 return PCB.ast->makeLogExpression(x);
356 }
357
358 static inline Expression * ag_rp_42(PCB_DECL, Expression * x) {
359 /* Line -, bciastp.syn */
360 return PCB.ast->makeExpExpression(x);
361 }
362
363 static inline Expression * ag_rp_43(PCB_DECL, Expression * x) {
364 /* Line -, bciastp.syn */
365 return PCB.ast->makeSqrtExpression(x);
366 }
367
368 static inline Expression * ag_rp_44(PCB_DECL, Expression * x) {
369 /* Line -, bciastp.syn */
370 return x;
371 }
372
373 static inline double ag_rp_45(PCB_DECL, double x) {
374 /* Line -, bciastp.syn */
375 return x;
376 }
377
378 static inline double ag_rp_46(PCB_DECL, double x, int e) {
379 /* Line -, bciastp.syn */
380 return x*pow(10,e);
381 }
382
383 static inline double ag_rp_47(PCB_DECL, double x, int e) {
384 /* Line -, bciastp.syn */
385 return x*pow(10,-e);
386 }
387
388 static inline double ag_rp_48(PCB_DECL, double i, double f) {
389 /* Line -, bciastp.syn */
390 return i+f;
391 }
392
393 static inline double ag_rp_49(PCB_DECL, double i) {
394 /* Line -, bciastp.syn */
395 return i;
396 }
397
398 static inline double ag_rp_50(PCB_DECL, double f) {
399 /* Line -, bciastp.syn */
400 return f;
401 }
402
403 static inline double ag_rp_51(PCB_DECL, int d) {
404 /* Line -, bciastp.syn */
405 return d-'0';
406 }
407
408 static inline double ag_rp_52(PCB_DECL, double x, int d) {
409 /* Line -, bciastp.syn */
410 return 10*x + d-'0';
411 }
412
413 static inline double ag_rp_53(PCB_DECL, int d) {
414 /* Line -, bciastp.syn */
415 return (d-'0')/10.;
416 }
417
418 static inline double ag_rp_54(PCB_DECL, int d, double f) {
419 /* Line -, bciastp.syn */
420 return (d-'0' + f)/10.;
421 }
422
423 static inline int ag_rp_55(PCB_DECL, int d) {
424 /* Line -, bciastp.syn */
425 return d-'0';
426 }
427
428 static inline int ag_rp_56(PCB_DECL, int x, int d) {
429 /* Line -, bciastp.syn */
430 return 10*x + d-'0';
431 }
432
433 static inline AgString ag_rp_57(PCB_DECL, int c) {
434 /* Line -, bciastp.syn */
435 return AgString().concat(c);
436 }
437
438 static inline AgString ag_rp_58(PCB_DECL, AgString &s, int c) {
439 /* Line -, bciastp.syn */
440 return s.concat(c);
441 }
442
443
444 #define READ_COUNTS
445 #define WRITE_COUNTS
446 #undef V
447 #define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i]))
448 #undef VS
449 #define VS(i) (PCB).vs[(PCB).ssx + i]
450
451 #ifndef GET_CONTEXT
452 #define GET_CONTEXT CONTEXT = (PCB).input_context
453 #endif
454
455 typedef enum {
456 ag_action_1,
457 ag_action_2,
458 ag_action_3,
459 ag_action_4,
460 ag_action_5,
461 ag_action_6,
462 ag_action_7,
463 ag_action_8,
464 ag_action_9,
465 ag_action_10,
466 ag_action_11,
467 ag_action_12
468 } ag_parser_action;
469
470
471 #ifndef NULL_VALUE_INITIALIZER
472 #define NULL_VALUE_INITIALIZER = { 0 }
473 #endif
474
475
476 static const char ag_wdf[] = {
477 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
478 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
479 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
480 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0,
481 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
482 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
483 };
484
485 #undef VW
486 #define VW(i,t) *(t) (&(PCB).vs[(PCB).ssx + (i)])
487 #undef VNO
488 #define VNO new(&(PCB).vs[(PCB).ssx])
489 #undef VRO
490 #define VRO(to,v) ag_replace_object((to) &(PCB).vs[(PCB).ssx], v)
491 #undef VWD
492 #define VWD(i,t) ag_delete_object((t) &(PCB).vs[(PCB).ssx + (i)]);
493 #undef VDO
494 #define VDO(to, v) ag_delete_object((to) &(PCB).vs[(PCB).ssx], v)
495
496 template <class NewObject, class OldObject>
497 static inline void ag_replace_object(AgObjectWrapper<OldObject> *p, const NewObject &o) {
498 delete p;
499 new(p) AgObjectWrapper<NewObject >(o);
500 }
501
502 template <class Object>
503 static inline void ag_delete_object(AgObjectWrapper<Object> *p) {
504 delete p;
505 }
506
507 template <class NewObject, class OldObject>
508 static inline const NewObject &ag_delete_object(AgObjectWrapper<OldObject> *p, const NewObject &o) {
509 delete p;
510 return o;
511 }
512
513
514 #undef AG_WRAP_4
515 #define AG_WRAP_4 AgObjectWrapper<AgStack<Statement *> >
516 #undef AG_WRAP_5
517 #define AG_WRAP_5 AgObjectWrapper<AgString >
518
519 static void ag_delete_wrappers(PCB_DECL) {
520 int sn = (PCB).sn;
521 int sx = (PCB).ssx;
522 while (sx--) {
523 switch (ag_wdf[sn]) {
524 case 4: ag_delete_object((AG_WRAP_4 *) &(PCB).vs[sx]); break;
525 case 5: ag_delete_object((AG_WRAP_5 *) &(PCB).vs[sx]); break;
526 default: break;
527 }
528 sn = (PCB).ss[sx];
529 }
530 }
531
532 static astParse_vs_type const ag_null_value NULL_VALUE_INITIALIZER;
533
534 static const unsigned char ag_rpx[] = {
535 0, 1, 2, 3, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
536 0, 16, 0, 17, 18, 19, 20, 21, 0, 22, 0, 23, 0, 24, 0, 25, 26, 0,
537 27, 28, 29, 30, 0, 31, 32, 0, 33, 34, 0, 35, 36, 37, 0, 38, 39, 40,
538 41, 42, 43, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0,
539 46, 47, 48, 0, 0, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58
540 };
541
542 static const unsigned char ag_key_itt[] = {
543 0
544 };
545
546 static const unsigned short ag_key_pt[] = {
547 0
548 };
549
550 static const unsigned char ag_key_ch[] = {
551 0, 42, 47,255, 47,100,101,102,105,108,115,119,255, 42,255, 42, 61,255,
552 42, 47, 61,255,108,120,255, 33, 38, 42, 43, 45, 47, 60, 61, 62,100,101,
553 102,105,108,115,119,124,255,100,101,102,105,108,115,119,255, 42, 47,255,
554 33, 38, 42, 47, 60, 61, 62,124,255, 42, 47,255, 47,101,108,115,255, 42,
555 47,255, 47,255,101,108,115,255, 33, 38, 42, 60, 61, 62,124,255, 33, 38,
556 60, 61, 62,124,255, 33, 38, 61,124,255, 38,124,255, 42, 61,255, 42, 47,
557 61,255, 33, 38, 42, 43, 45, 47, 60, 61, 62,124,255,124,255, 42, 61,255,
558 33, 38, 42, 43, 45, 47, 60, 61, 62,124,255, 42, 47,255,108,120,255, 47,
559 100,101,102,105,108,115,119,255,119,255, 42, 47,255, 33, 38, 42, 47, 60,
560 61, 62,100,101,102,105,108,115,119,124,255,108,120,255,100,101,102,105,
561 108,115,119,255
562 };
563
564 static const unsigned char ag_key_act[] = {
565 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,
566 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,
567 4,0,0,4,2,4,3,3,3,4,3,3,3,3,3,3,3,4,3,3,3,3,3,3,4,3,3,3,3,4,3,3,4,0,0,
568 4,0,0,0,4,3,3,2,3,3,2,3,3,3,3,4,3,4,0,0,4,3,3,2,3,3,3,3,3,3,3,4,0,0,4,
569 3,3,4,2,3,2,3,3,3,3,3,4,3,4,0,0,4,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,4,3,3,
570 4,3,2,3,3,3,3,3,4
571 };
572
573 static const unsigned char ag_key_parm[] = {
574 0, 59, 64, 0, 0, 92,120, 91, 87,119,121, 89, 0, 63, 0,117,100, 0,
575 59, 64,101, 0, 88,120, 0,107,105, 0, 98, 99, 0,109,106,111, 92, 0,
576 91, 87,119,121, 89,104, 0, 92,120, 91, 87,119,121, 89, 0, 59, 64, 0,
577 107,105,117, 0,109,106,111,104, 0, 59, 64, 0, 0,120,119,121, 0, 59,
578 64, 0, 0, 0,120,119,121, 0,107,105,117,109,106,111,104, 0,107,105,
579 109,106,111,104, 0,107,105,106,104, 0,105,104, 0,117,100, 0, 59, 64,
580 101, 0,107,105, 0, 98, 99, 0,109,106,111,104, 0,104, 0,117,100, 0,
581 107,105, 0, 98, 99,101,109,106,111,104, 0, 59, 64, 0, 88,120, 0, 0,
582 92, 0, 91, 87,119,121, 89, 0, 89, 0, 59, 64, 0,107,105,117, 0,109,
583 106,111, 92,120, 91, 87,119,121, 89,104, 0, 88,120, 0, 92, 0, 91, 87,
584 119,121, 89, 0
585 };
586
587 static const unsigned short ag_key_jmp[] = {
588 0, 0, 0, 0, 1, 0, 2, 5, 8, 10, 13, 17, 0, 22, 0, 0, 0, 0,
589 0, 0, 0, 0, 40, 43, 0, 24, 26, 15, 28, 30, 18, 32, 34, 36, 38, 22,
590 45, 48, 50, 53, 57, 62, 0, 64, 66, 69, 72, 74, 77, 81, 0, 0, 0, 0,
591 86, 88, 90, 51, 92, 94, 96, 98, 0, 0, 0, 0, 63,100,103,106, 0, 0,
592 0, 0, 71, 0,110,113,116, 0,120,122,124,126,128,130,132, 0,134,136,
593 138,140,142,144, 0,146,148,150,152, 0,154,156, 0, 0, 0, 0, 0, 0,
594 0, 0,158,160,103,162,164,106,166,168,170,172, 0,174, 0, 0, 0, 0,
595 176,178,123,180,182,184,186,188,190,192, 0, 0, 0, 0,196,199, 0,137,
596 194,140,201,204,206,209,213, 0,218, 0, 0, 0, 0,223,225,227,154,229,
597 231,233,235,237,240,243,245,248,252,257, 0,261,264, 0,259,173,266,269,
598 271,274,278, 0
599 };
600
601 static const unsigned char ag_key_index[] = {
602 4, 0, 13, 25, 43, 0, 0, 13, 13, 43, 0, 54, 54, 66, 74, 74, 74, 54,
603 76, 0, 0, 0, 66, 66, 66, 80, 76, 76, 76, 88, 88, 88, 95,100,110,121,
604 126, 4,143, 4, 43, 0, 43, 74, 74, 74, 0, 0, 0, 54, 54, 0, 0, 76,
605 76, 76, 66, 76, 66, 76, 66, 76, 76, 76, 66, 76, 66, 76, 66, 76, 66, 76,
606 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76,
607 66, 76, 43, 66, 76,152, 76, 76, 76, 0, 0,157, 0, 0, 0, 88, 88, 88,
608 88, 88, 88, 88, 88, 95,100, 0,143, 0, 0, 0, 0, 54, 54, 66, 76, 76,
609 76, 43, 43, 0, 0,176, 0, 76, 4, 43, 0, 43
610 };
611
612 static const unsigned char ag_key_ends[] = {
613 111,0, 120,112,0, 111,114,0, 102,0, 111,103,0, 113,114,116,0,
614 104,105,108,101,0, 47,0, 61,0, 38,0, 61,0, 61,0, 61,0, 61,0,
615 61,0, 111,0, 115,101,0, 112,0, 111,114,0, 102,0, 111,103,0,
616 113,114,116,0, 104,105,108,101,0, 124,0, 111,0, 120,112,0,
617 111,114,0, 102,0, 111,103,0, 113,114,116,0, 104,105,108,101,0,
618 61,0, 38,0, 42,0, 61,0, 61,0, 61,0, 124,0, 120,112,0,
619 111,103,0, 113,114,116,0, 120,112,0, 111,103,0, 113,114,116,0,
620 61,0, 38,0, 42,0, 61,0, 61,0, 61,0, 124,0, 61,0, 38,0, 61,0,
621 61,0, 61,0, 124,0, 61,0, 38,0, 61,0, 124,0, 38,0, 124,0,
622 61,0, 38,0, 61,0, 61,0, 61,0, 61,0, 61,0, 124,0, 124,0,
623 61,0, 38,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 124,0, 111,0,
624 115,101,0, 112,0, 111,114,0, 102,0, 111,103,0, 113,114,116,0,
625 104,105,108,101,0, 104,105,108,101,0, 61,0, 38,0, 42,0, 61,0,
626 61,0, 61,0, 111,0, 120,112,0, 111,114,0, 102,0, 111,103,0,
627 113,114,116,0, 104,105,108,101,0, 124,0, 111,0, 115,101,0, 112,0,
628 111,114,0, 102,0, 111,103,0, 113,114,116,0, 104,105,108,101,0,
629 };
630
631 #define AG_TCV(x) ag_tcv[(x)]
632
633 static const unsigned char ag_tcv[] = {
634 6, 81, 81, 81, 81, 81, 81, 81, 81, 80, 68, 80, 80, 80, 81, 81, 81, 81,
635 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 80,116, 81, 81,
636 81, 81, 81, 81, 86, 85,114,112, 95,113, 74,115, 77, 77, 77, 77, 77, 77,
637 77, 77, 77, 77,102, 90,108, 96,110,103, 81, 82, 82, 82, 82, 70, 82, 82,
638 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
639 82, 81, 81, 81, 81, 82, 81, 82, 82, 82, 82, 70, 82, 82, 82, 82, 82, 82,
640 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 94, 81, 93,
641 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
642 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
643 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
644 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
645 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
646 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
647 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
648 81, 81, 81, 81
649 };
650
651 #ifndef SYNTAX_ERROR
652 #define SYNTAX_ERROR fprintf(stderr,"%s, line %d, column %d\n", \
653 (PCB).error_message, (PCB).line, (PCB).column)
654 #endif
655
656 #ifndef FIRST_LINE
657 #define FIRST_LINE 1
658 #endif
659
660 #ifndef FIRST_COLUMN
661 #define FIRST_COLUMN 1
662 #endif
663
664 #ifndef PARSER_STACK_OVERFLOW
665 #define PARSER_STACK_OVERFLOW {fprintf(stderr, \
666 "\nParser stack overflow, line %d, column %d\n",\
667 (PCB).line, (PCB).column);}
668 #endif
669
670 #ifndef REDUCTION_TOKEN_ERROR
671 #define REDUCTION_TOKEN_ERROR {fprintf(stderr, \
672 "\nReduction token error, line %d, column %d\n", \
673 (PCB).line, (PCB).column);}
674 #endif
675
676
677 #ifndef INPUT_CODE
678 #define INPUT_CODE(T) (T)
679 #endif
680
681 typedef enum
682 {ag_accept_key, ag_set_key, ag_jmp_key, ag_end_key, ag_no_match_key,
683 ag_cf_accept_key, ag_cf_set_key, ag_cf_end_key} key_words;
684
685 static void ag_get_key_word(PCB_DECL, int ag_k) {
686 int ag_save = (int) ((PCB).la_ptr - (PCB).pointer);
687 const unsigned char *ag_p;
688 int ag_ch;
689 while (1) {
690 switch (ag_key_act[ag_k]) {
691 case ag_cf_end_key: {
692 const unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k];
693 do {
694 if ((ag_ch = *sp++) == 0) {
695 int ag_k1 = ag_key_parm[ag_k];
696 int ag_k2 = ag_key_pt[ag_k1];
697 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) goto ag_fail;
698 (PCB).token_number = (astParse_token_type) ag_key_pt[ag_k1 + 1];
699 return;
700 }
701 } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch);
702 goto ag_fail;
703 }
704 case ag_end_key: {
705 const unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k];
706 do {
707 if ((ag_ch = *sp++) == 0) {
708 (PCB).token_number = (astParse_token_type) ag_key_parm[ag_k];
709 return;
710 }
711 } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch);
712 }
713 case ag_no_match_key:
714 ag_fail:
715 (PCB).la_ptr = (PCB).pointer + ag_save;
716 return;
717 case ag_cf_set_key: {
718 int ag_k1 = ag_key_parm[ag_k];
719 int ag_k2 = ag_key_pt[ag_k1];
720 ag_k = ag_key_jmp[ag_k];
721 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) break;
722 ag_save = (int) ((PCB).la_ptr - (PCB).pointer);
723 (PCB).token_number = (astParse_token_type) ag_key_pt[ag_k1+1];
724 break;
725 }
726 case ag_set_key:
727 ag_save = (int) ((PCB).la_ptr - (PCB).pointer);
728 (PCB).token_number = (astParse_token_type) ag_key_parm[ag_k];
729 case ag_jmp_key:
730 ag_k = ag_key_jmp[ag_k];
731 break;
732 case ag_accept_key:
733 (PCB).token_number = (astParse_token_type) ag_key_parm[ag_k];
734 return;
735 case ag_cf_accept_key: {
736 int ag_k1 = ag_key_parm[ag_k];
737 int ag_k2 = ag_key_pt[ag_k1];
738 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)])
739 (PCB).la_ptr = (PCB).pointer + ag_save;
740 else (PCB).token_number = (astParse_token_type) ag_key_pt[ag_k1+1];
741 return;
742 }
743 }
744 ag_ch = CONVERT_CASE(*(PCB).la_ptr++);
745 ag_p = &ag_key_ch[ag_k];
746 if (ag_ch <= 255) while (*ag_p < ag_ch) ag_p++;
747 if (ag_ch > 255 || *ag_p != ag_ch) {
748 (PCB).la_ptr = (PCB).pointer + ag_save;
749 return;
750 }
751 ag_k = (int) (ag_p - ag_key_ch);
752 }
753 }
754
755
756 #ifndef AG_NEWLINE
757 #define AG_NEWLINE 10
758 #endif
759
760 #ifndef AG_RETURN
761 #define AG_RETURN 13
762 #endif
763
764 #ifndef AG_FORMFEED
765 #define AG_FORMFEED 12
766 #endif
767
768 #ifndef AG_TABCHAR
769 #define AG_TABCHAR 9
770 #endif
771
772 static void ag_track(PCB_DECL) {
773 int ag_k = (int) ((PCB).la_ptr - (PCB).pointer);
774 while (ag_k--) {
775 switch (*(PCB).pointer++) {
776 case AG_NEWLINE:
777 (PCB).column = 1, (PCB).line++;
778 case AG_RETURN:
779 case AG_FORMFEED:
780 break;
781 case AG_TABCHAR:
782 (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING);
783 break;
784 default:
785 (PCB).column++;
786 }
787 }
788 }
789
790
791 static void ag_prot(PCB_DECL) {
792 int ag_k;
793 ag_k = 128 - ++(PCB).btsx;
794 if (ag_k <= (PCB).ssx) {
795 (PCB).exit_flag = AG_STACK_ERROR_CODE;
796 PARSER_STACK_OVERFLOW;
797 return;
798 }
799 (PCB).bts[(PCB).btsx] = (PCB).sn;
800 (PCB).bts[ag_k] = (PCB).ssx;
801 (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx];
802 (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx];
803 }
804
805 static void ag_undo(PCB_DECL) {
806 if ((PCB).drt == -1) return;
807 while ((PCB).btsx) {
808 int ag_k = 128 - (PCB).btsx;
809 (PCB).sn = (PCB).bts[(PCB).btsx--];
810 (PCB).ssx = (PCB).bts[ag_k];
811 (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k];
812 (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k];
813 }
814 (PCB).token_number = (astParse_token_type) (PCB).drt;
815 (PCB).ssx = (PCB).dssx;
816 (PCB).sn = (PCB).dsn;
817 (PCB).drt = -1;
818 }
819
820
821 static const unsigned char ag_tstt[] = {
822 121,120,119,116,113,112,94,92,91,90,89,87,86,82,80,77,74,70,68,64,59,6,0,1,
823 83,84,
824 116,115,114,113,112,110,108,103,102,96,95,94,93,90,86,85,82,81,80,77,74,70,
825 68,0,66,67,
826 116,115,114,113,112,110,108,103,102,96,95,94,93,90,86,85,82,81,80,77,74,70,
827 68,63,0,61,62,
828 80,68,64,59,0,1,
829 121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,74,70,6,0,4,5,
830 116,115,114,113,112,110,108,103,102,96,95,94,93,90,86,85,82,81,80,77,74,70,
831 0,
832 68,0,
833 116,115,114,113,112,110,108,103,102,96,95,94,93,90,86,85,82,81,80,77,74,70,
834 68,0,
835 63,0,
836 121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,74,70,6,0,2,3,7,8,9,10,
837 11,12,15,16,17,18,19,20,22,24,30,33,35,37,40,45,46,47,48,51,52,53,55,56,
838 57,69,73,97,118,
839 77,0,75,
840 117,115,114,113,112,111,110,109,108,107,106,105,104,103,102,95,90,85,80,77,
841 74,70,68,64,59,0,76,
842 70,0,
843 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
844 86,80,68,64,59,0,1,83,84,
845 86,80,68,64,59,0,1,83,84,
846 86,80,68,64,59,0,1,83,84,
847 117,115,114,113,112,111,110,109,108,107,106,105,104,103,102,95,90,85,80,68,
848 64,59,0,1,83,84,
849 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45,
850 46,47,48,51,52,53,55,56,57,69,73,97,118,
851 86,0,11,
852 86,0,11,
853 86,0,11,
854 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
855 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
856 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
857 117,0,54,
858 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,46,47,48,51,52,53,55,56,57,
859 69,73,97,118,
860 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,46,47,48,51,52,53,55,56,57,
861 69,73,97,118,
862 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,46,47,48,51,52,53,55,56,57,
863 69,73,97,118,
864 115,114,0,49,50,
865 113,112,0,46,47,
866 111,110,109,108,0,41,42,43,44,
867 107,106,0,38,39,
868 105,0,36,
869 117,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,99,98,
870 96,95,90,85,82,80,77,70,68,64,59,0,1,83,84,
871 104,103,0,31,34,
872 101,100,99,98,96,0,25,26,27,28,29,
873 121,120,119,116,113,112,94,93,92,91,90,89,87,86,82,80,77,74,70,68,64,59,0,1,
874 83,84,
875 121,120,119,116,113,112,94,93,92,91,90,89,88,87,86,82,80,77,74,70,68,64,59,
876 6,0,1,83,84,
877 121,120,119,116,113,112,94,92,91,90,89,87,86,82,80,77,74,70,68,64,59,0,1,83,
878 84,
879 121,120,119,116,113,112,94,93,92,91,90,89,87,86,82,77,74,70,0,5,
880 95,90,0,17,23,
881 121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,74,70,0,2,3,7,8,9,10,11,
882 12,15,16,17,18,19,20,22,24,30,33,35,37,40,45,46,47,48,51,52,53,55,56,57,
883 69,73,97,118,
884 86,80,68,64,59,0,1,83,84,
885 86,80,68,64,59,0,1,83,84,
886 86,80,68,64,59,0,1,83,84,
887 86,0,11,
888 86,0,11,
889 86,0,11,
890 77,0,75,
891 77,0,75,
892 113,112,77,0,71,
893 95,85,0,13,23,
894 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46,
895 47,48,51,52,53,55,56,57,69,73,97,118,
896 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45,
897 46,47,48,51,52,53,55,56,57,69,73,97,118,
898 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45,
899 46,47,48,51,52,53,55,56,57,69,73,97,118,
900 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
901 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,46,47,48,51,52,53,55,56,57,
902 69,73,97,118,
903 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
904 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,46,47,48,51,52,53,55,56,57,
905 69,73,97,118,
906 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
907 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,46,47,48,51,52,53,55,56,57,
908 69,73,97,118,
909 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,45,46,47,48,51,52,53,55,56,
910 57,69,73,97,118,
911 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,45,46,47,48,51,52,53,55,56,
912 57,69,73,97,118,
913 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
914 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,40,45,46,47,48,51,52,53,55,
915 56,57,69,73,97,118,
916 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
917 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,40,45,46,47,48,51,52,53,55,
918 56,57,69,73,97,118,
919 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
920 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,40,45,46,47,48,51,52,53,55,
921 56,57,69,73,97,118,
922 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
923 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,40,45,46,47,48,51,52,53,55,
924 56,57,69,73,97,118,
925 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
926 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,37,40,45,46,47,48,51,52,53,
927 55,56,57,69,73,97,118,
928 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
929 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,37,40,45,46,47,48,51,52,53,
930 55,56,57,69,73,97,118,
931 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
932 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,35,37,40,45,46,47,48,51,52,
933 53,55,56,57,69,73,97,118,
934 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
935 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,33,35,37,40,45,46,47,48,51,
936 52,53,55,56,57,69,73,97,118,
937 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
938 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45,
939 46,47,48,51,52,53,55,56,57,69,73,97,118,
940 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
941 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46,
942 47,48,51,52,53,55,56,57,69,73,97,118,
943 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
944 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46,
945 47,48,51,52,53,55,56,57,69,73,97,118,
946 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
947 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46,
948 47,48,51,52,53,55,56,57,69,73,97,118,
949 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
950 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46,
951 47,48,51,52,53,55,56,57,69,73,97,118,
952 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
953 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46,
954 47,48,51,52,53,55,56,57,69,73,97,118,
955 121,120,119,116,113,112,94,93,92,91,90,89,87,86,82,77,74,70,0,2,3,7,8,9,10,
956 11,12,15,16,17,18,19,20,21,22,24,30,33,35,37,40,45,46,47,48,51,52,53,55,
957 56,57,69,73,97,118,
958 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
959 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,22,24,30,33,35,37,40,45,46,
960 47,48,51,52,53,55,56,57,69,73,97,118,
961 89,0,15,
962 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45,
963 46,47,48,51,52,53,55,56,57,69,73,97,118,
964 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45,
965 46,47,48,51,52,53,55,56,57,69,73,97,118,
966 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45,
967 46,47,48,51,52,53,55,56,57,69,73,97,118,
968 77,0,72,
969 77,0,72,
970 121,120,119,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,
971 95,94,92,91,90,89,87,86,85,82,80,77,74,70,68,64,59,0,1,83,84,
972 85,0,13,
973 95,85,0,13,23,
974 95,85,0,13,23,
975 115,114,0,49,50,
976 115,114,0,49,50,
977 113,112,0,46,47,
978 113,112,0,46,47,
979 113,112,0,46,47,
980 113,112,0,46,47,
981 111,110,109,108,0,41,42,43,44,
982 111,110,109,108,0,41,42,43,44,
983 107,106,0,38,39,
984 105,0,36,
985 102,95,0,23,32,
986 121,120,119,116,113,112,94,93,92,91,90,89,88,87,86,82,80,77,74,70,68,64,59,
987 6,0,1,83,84,
988 86,0,11,
989 95,90,0,17,23,
990 95,85,0,13,23,
991 95,85,0,13,23,
992 77,0,
993 77,0,
994 121,120,119,116,113,112,86,82,80,77,74,70,68,64,59,0,1,83,84,
995 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,24,30,33,35,37,40,45,46,47,
996 48,51,52,53,55,56,57,69,73,97,118,
997 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45,
998 46,47,48,51,52,53,55,56,57,69,73,97,118,
999 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45,
1000 46,47,48,51,52,53,55,56,57,69,73,97,118,
1001 121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,74,70,0,2,3,8,9,10,11,12,
1002 15,16,17,18,19,20,22,24,30,33,35,37,40,45,46,47,48,51,52,53,55,56,57,69,
1003 73,97,118,
1004 121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,74,70,0,2,3,7,8,9,10,11,
1005 12,15,16,17,18,19,20,22,24,30,33,35,37,40,45,46,47,48,51,52,53,55,56,57,
1006 69,73,97,118,
1007 95,85,0,13,23,
1008 95,90,0,17,23,
1009 88,0,14,
1010 90,0,17,
1011 121,120,119,116,113,112,86,82,77,74,70,0,2,3,11,12,22,24,30,33,35,37,40,45,
1012 46,47,48,51,52,53,55,56,57,69,73,97,118,
1013 121,120,119,116,113,112,94,92,91,90,89,87,86,82,80,77,74,70,68,64,59,0,1,83,
1014 84,
1015 121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,74,70,0,2,3,8,9,10,11,12,
1016 15,16,17,18,19,20,22,24,30,33,35,37,40,45,46,47,48,51,52,53,55,56,57,69,
1017 73,97,118,
1018 95,85,0,13,23,
1019 121,120,119,116,113,112,94,92,91,90,89,87,86,82,77,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1,2,2,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1092 1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1,2,1,2,1,1,1,1,1,2,2,1,1,1,1,1,1,
1093 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,1,1,7,1,1,1,5,1,1,7,2,1,1,1,1,
1094 1,1,1,2,2,1,2,7,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,5,5,5,5,
1095 5,5,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,
1096 2,7,2,1,2,2,1,1,1,1,1,2,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,
1097 1,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1,2,2,1,1,1,1,1,2,2,1,1,1,1,
1098 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1099 };
1100
1101
1102 static const unsigned char ag_pstt[] = {
1103 4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,3,1,2,4,0,3,3,4,
1104 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,
1105 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,
1106 140,140,1,2,142,140,
1107 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,0,9,
1108 65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,67,
1109 68,6,
1110 60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,62,
1111 63,8,
1112 14,15,16,22,24,23,37,39,43,38,44,45,13,85,79,10,85,1,9,52,36,3,3,3,48,18,41,
1113 47,46,16,13,42,40,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20,19,12,
1114 11,34,17,
1115 49,10,78,
1116 75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,80,50,75,75,75,75,
1117 11,77,
1118 51,69,
1119 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,13,3,3,144,
1120 141,3,3,1,2,14,3,3,179,
1121 141,3,3,1,2,15,3,3,178,
1122 141,3,3,1,2,16,3,3,177,
1123 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,3,3,
1124 1,2,17,3,3,176,
1125 14,15,16,22,24,23,13,85,79,10,85,18,52,36,18,52,52,52,35,33,32,31,30,29,27,
1126 28,29,29,26,25,21,20,19,12,11,34,17,
1127 13,19,53,
1128 13,20,54,
1129 13,21,55,
1130 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,22,3,3,174,
1131 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,23,3,3,170,
1132 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,24,3,3,171,
1133 56,50,57,
1134 14,15,16,22,24,23,13,85,79,10,85,26,52,53,18,27,28,49,49,26,25,21,20,19,12,
1135 11,34,17,
1136 14,15,16,22,24,23,13,85,79,10,85,27,52,53,18,27,28,48,48,26,25,21,20,19,12,
1137 11,34,17,
1138 14,15,16,22,24,23,13,85,79,10,85,28,52,53,18,27,28,47,47,26,25,21,20,19,12,
1139 11,34,17,
1140 58,60,40,61,59,
1141 24,23,35,63,62,
1142 64,66,68,70,32,71,69,67,65,
1143 72,74,30,75,73,
1144 76,28,77,
1145 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1146 141,141,141,141,86,3,86,86,3,1,2,34,3,3,155,
1147 78,80,26,81,79,
1148 82,84,86,88,90,53,91,89,87,85,83,
1149 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,3,141,141,141,3,
1150 1,2,37,3,3,152,
1151 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,3,141,141,
1152 141,3,1,2,141,38,3,3,148,
1153 141,141,141,141,141,141,141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,
1154 39,3,3,150,
1155 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,40,92,
1156 93,38,41,15,94,
1157 14,15,16,22,24,23,37,39,43,38,44,45,13,85,79,10,85,42,52,36,95,95,95,48,18,
1158 41,47,46,16,13,42,40,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20,19,
1159 12,11,34,17,
1160 141,3,3,1,2,43,3,3,149,
1161 141,3,3,1,2,44,3,3,147,
1162 141,3,3,1,2,45,3,3,145,
1163 13,46,96,
1164 13,47,97,
1165 13,48,98,
1166 49,81,82,
1167 49,76,74,
1168 99,100,100,51,100,
1169 93,101,52,57,94,
1170 14,15,16,22,24,23,13,85,79,10,85,53,52,36,18,102,102,35,33,32,31,30,29,27,
1171 28,29,29,26,25,21,20,19,12,11,34,17,
1172 14,15,16,22,24,23,13,85,79,10,85,54,52,36,18,103,103,103,35,33,32,31,30,29,
1173 27,28,29,29,26,25,21,20,19,12,11,34,17,
1174 14,15,16,22,24,23,13,85,79,10,85,55,52,36,18,104,104,104,35,33,32,31,30,29,
1175 27,28,29,29,26,25,21,20,19,12,11,34,17,
1176 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,56,3,3,175,
1177 14,15,16,22,24,23,13,85,79,10,85,57,52,53,18,27,28,51,51,26,25,21,20,19,12,
1178 11,34,17,
1179 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,58,3,3,173,
1180 14,15,16,22,24,23,13,85,79,10,85,59,52,53,18,27,28,45,45,26,25,21,20,19,12,
1181 11,34,17,
1182 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,60,3,3,172,
1183 14,15,16,22,24,23,13,85,79,10,85,61,52,53,18,27,28,44,44,26,25,21,20,19,12,
1184 11,34,17,
1185 14,15,16,22,24,23,13,85,79,10,85,62,52,53,18,105,27,28,105,105,26,25,21,20,
1186 19,12,11,34,17,
1187 14,15,16,22,24,23,13,85,79,10,85,63,52,53,18,106,27,28,106,106,26,25,21,20,
1188 19,12,11,34,17,
1189 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,64,3,3,169,
1190 14,15,16,22,24,23,13,85,79,10,85,65,52,53,18,107,29,27,28,29,29,26,25,21,20,
1191 19,12,11,34,17,
1192 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,66,3,3,168,
1193 14,15,16,22,24,23,13,85,79,10,85,67,52,53,18,108,29,27,28,29,29,26,25,21,20,
1194 19,12,11,34,17,
1195 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,68,3,3,167,
1196 14,15,16,22,24,23,13,85,79,10,85,69,52,53,18,109,29,27,28,29,29,26,25,21,20,
1197 19,12,11,34,17,
1198 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,70,3,3,166,
1199 14,15,16,22,24,23,13,85,79,10,85,71,52,53,18,110,29,27,28,29,29,26,25,21,20,
1200 19,12,11,34,17,
1201 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,72,3,3,165,
1202 14,15,16,22,24,23,13,85,79,10,85,73,52,53,18,111,30,29,27,28,29,29,26,25,21,
1203 20,19,12,11,34,17,
1204 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,74,3,3,164,
1205 14,15,16,22,24,23,13,85,79,10,85,75,52,53,18,112,30,29,27,28,29,29,26,25,21,
1206 20,19,12,11,34,17,
1207 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,76,3,3,163,
1208 14,15,16,22,24,23,13,85,79,10,85,77,52,53,18,113,31,30,29,27,28,29,29,26,25,
1209 21,20,19,12,11,34,17,
1210 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,78,3,3,162,
1211 14,15,16,22,24,23,13,85,79,10,85,79,52,53,18,114,32,31,30,29,27,28,29,29,26,
1212 25,21,20,19,12,11,34,17,
1213 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,80,3,3,161,
1214 14,15,16,22,24,23,13,85,79,10,85,81,52,36,18,115,115,115,35,33,32,31,30,29,
1215 27,28,29,29,26,25,21,20,19,12,11,34,17,
1216 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,82,3,3,159,
1217 14,15,16,22,24,23,13,85,79,10,85,83,52,36,18,25,25,35,33,32,31,30,29,27,28,
1218 29,29,26,25,21,20,19,12,11,34,17,
1219 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,84,3,3,158,
1220 14,15,16,22,24,23,13,85,79,10,85,85,52,36,18,24,24,35,33,32,31,30,29,27,28,
1221 29,29,26,25,21,20,19,12,11,34,17,
1222 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,86,3,3,157,
1223 14,15,16,22,24,23,13,85,79,10,85,87,52,36,18,23,23,35,33,32,31,30,29,27,28,
1224 29,29,26,25,21,20,19,12,11,34,17,
1225 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,88,3,3,156,
1226 14,15,16,22,24,23,13,85,79,10,85,89,52,36,18,22,22,35,33,32,31,30,29,27,28,
1227 29,29,26,25,21,20,19,12,11,34,17,
1228 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,90,3,3,154,
1229 14,15,16,22,24,23,13,85,79,10,85,91,52,36,18,21,21,35,33,32,31,30,29,27,28,
1230 29,29,26,25,21,20,19,12,11,34,17,
1231 14,15,16,22,24,23,37,116,39,43,38,44,45,13,85,79,10,85,92,52,36,3,3,3,48,18,
1232 41,47,46,16,13,42,40,17,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20,
1233 19,12,11,34,17,
1234 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,93,3,3,153,
1235 14,15,16,22,24,23,13,85,79,10,85,94,52,36,18,19,19,35,33,32,31,30,29,27,28,
1236 29,29,26,25,21,20,19,12,11,34,17,
1237 44,95,117,
1238 14,15,16,22,24,23,13,85,79,10,85,96,52,36,18,118,118,118,35,33,32,31,30,29,
1239 27,28,29,29,26,25,21,20,19,12,11,34,17,
1240 14,15,16,22,24,23,13,85,79,10,85,97,52,36,18,119,119,119,35,33,32,31,30,29,
1241 27,28,29,29,26,25,21,20,19,12,11,34,17,
1242 14,15,16,22,24,23,13,85,79,10,85,98,52,36,18,120,120,120,35,33,32,31,30,29,
1243 27,28,29,29,26,25,21,20,19,12,11,34,17,
1244 83,99,121,
1245 83,100,122,
1246 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
1247 141,141,141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,101,3,3,143,
1248 101,102,56,
1249 93,101,103,55,94,
1250 93,101,104,54,94,
1251 58,60,42,61,59,
1252 58,60,41,61,59,
1253 24,23,39,63,62,
1254 24,23,38,63,62,
1255 24,23,37,63,62,
1256 24,23,36,63,62,
1257 64,66,68,70,34,71,69,67,65,
1258 64,66,68,70,33,71,69,67,65,
1259 72,74,31,75,73,
1260 76,29,77,
1261 123,93,115,94,124,
1262 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,3,141,141,
1263 141,3,1,2,141,116,3,3,151,
1264 13,117,125,
1265 93,38,118,126,94,
1266 93,101,119,127,94,
1267 93,101,120,128,94,
1268 84,73,
1269 84,72,
1270 141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,123,3,3,160,
1271 14,15,16,22,24,23,13,85,79,10,85,124,52,53,18,27,35,33,32,31,30,29,27,28,29,
1272 29,26,25,21,20,19,12,11,34,17,
1273 14,15,16,22,24,23,13,85,79,10,85,125,52,36,18,129,129,129,35,33,32,31,30,29,
1274 27,28,29,29,26,25,21,20,19,12,11,34,17,
1275 14,15,16,22,24,23,13,85,79,10,85,126,52,36,18,130,130,130,35,33,32,31,30,29,
1276 27,28,29,29,26,25,21,20,19,12,11,34,17,
1277 14,15,16,22,24,23,37,39,43,38,44,45,13,85,79,10,85,127,52,36,11,8,48,18,41,
1278 47,46,16,13,42,40,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20,19,12,
1279 11,34,17,
1280 14,15,16,22,24,23,37,39,43,38,44,45,13,85,79,10,85,128,52,36,6,131,6,48,18,
1281 41,47,46,16,13,42,40,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20,19,
1282 12,11,34,17,
1283 93,101,129,132,94,
1284 93,38,130,133,94,
1285 134,4,135,
1286 38,132,14,
1287 14,15,16,22,24,23,13,85,79,10,85,133,52,36,18,136,136,136,35,33,32,31,30,29,
1288 27,28,29,29,26,25,21,20,19,12,11,34,17,
1289 141,141,141,141,141,141,141,141,141,141,141,141,141,141,3,141,141,141,3,1,2,
1290 134,3,3,146,
1291 14,15,16,22,24,23,37,39,43,38,44,45,13,85,79,10,85,135,52,36,10,7,48,18,41,
1292 47,46,16,13,42,40,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20,19,12,
1293 11,34,17,
1294 93,101,136,137,94,
1295 14,15,16,22,24,23,37,39,43,38,44,45,13,85,79,10,85,137,52,36,12,9,48,18,41,
1296 47,46,16,13,42,40,41,41,35,33,32,31,30,29,27,28,29,29,26,25,21,20,19,12,
1297 11,34,17,
1298
1299 };
1300
1301
1302 static const unsigned short ag_sbt[] = {
1303 0, 26, 52, 79, 85, 106, 129, 131, 155, 157, 211, 214, 241, 243,
1304 262, 271, 280, 289, 315, 352, 355, 358, 361, 380, 399, 418, 421, 449,
1305 477, 505, 510, 515, 524, 529, 532, 566, 571, 582, 608, 636, 661, 681,
1306 686, 739, 748, 757, 766, 769, 772, 775, 778, 781, 786, 791, 827, 864,
1307 901, 920, 948, 967, 995,1014,1042,1071,1100,1119,1149,1168,1198,1217,
1308 1247,1266,1296,1315,1346,1365,1396,1415,1447,1466,1499,1518,1555,1574,
1309 1610,1629,1665,1684,1720,1739,1775,1794,1830,1885,1904,1940,1943,1980,
1310 2017,2054,2057,2060,2100,2103,2108,2113,2118,2123,2128,2133,2138,2143,
1311 2152,2161,2166,2169,2174,2202,2205,2210,2215,2220,2222,2224,2243,2278,
1312 2315,2352,2404,2457,2462,2467,2470,2473,2510,2535,2587,2592,2644
1313 };
1314
1315
1316 static const unsigned short ag_sbe[] = {
1317 22, 49, 76, 83, 103, 128, 130, 154, 156, 175, 212, 239, 242, 258,
1318 267, 276, 285, 311, 326, 353, 356, 359, 376, 395, 414, 419, 432, 460,
1319 488, 507, 512, 519, 526, 530, 562, 568, 576, 604, 632, 657, 679, 683,
1320 703, 744, 753, 762, 767, 770, 773, 776, 779, 784, 788, 802, 838, 875,
1321 916, 931, 963, 978,1010,1025,1053,1082,1115,1130,1164,1179,1213,1228,
1322 1262,1277,1311,1326,1361,1376,1411,1426,1462,1477,1514,1529,1570,1585,
1323 1625,1640,1680,1695,1735,1750,1790,1805,1848,1900,1915,1941,1954,1991,
1324 2028,2055,2058,2096,2101,2105,2110,2115,2120,2125,2130,2135,2140,2147,
1325 2156,2163,2167,2171,2198,2203,2207,2212,2217,2221,2223,2239,2254,2289,
1326 2326,2369,2421,2459,2464,2468,2471,2484,2531,2552,2589,2609,2644
1327 };
1328
1329
1330 static const unsigned char ag_fl[] = {
1331 2,2,0,2,1,1,5,7,5,9,7,5,9,1,7,2,1,3,1,3,1,3,3,3,3,3,1,5,1,3,1,3,1,3,3,
1332 1,3,3,3,3,1,3,3,1,3,3,1,2,2,2,1,3,1,1,4,4,4,3,1,1,2,0,1,3,1,2,0,1,3,1,
1333 0,1,4,4,3,0,1,2,2,1,2,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1334 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,
1335 2,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
1336 2,2,2,2,2
1337 };
1338
1339 static const unsigned char ag_ptt[] = {
1340 0, 4, 5, 5, 7, 7, 9, 9, 9, 9, 8, 8, 8, 8, 18, 18, 18, 18,
1341 12, 12, 22, 22, 22, 22, 22, 22, 24, 24, 30, 30, 33, 33, 35, 35, 35, 37,
1342 37, 37, 37, 37, 40, 40, 40, 45, 45, 45, 48, 48, 48, 48, 51, 51, 53, 53,
1343 53, 53, 53, 53, 1, 61, 61, 62, 62, 1, 66, 66, 67, 67, 1,118, 71, 71,
1344 118,118, 69, 76, 76, 69, 69, 73, 73, 75, 75, 72, 72, 97, 97, 58, 58, 60,
1345 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
1346 60, 60, 60, 60, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
1347 65, 65, 65, 65, 65, 65, 65, 65, 78, 78, 79, 79, 79, 83, 83, 84, 84, 13,
1348 11, 10, 14, 15, 17, 16, 19, 21, 20, 23, 25, 3, 26, 27, 28, 29, 32, 31,
1349 34, 36, 38, 39, 41, 42, 43, 44, 46, 47, 49, 50, 52, 54, 2, 55, 56, 57
1350 };
1351
1352
1353 static void ag_ra(PCB_DECL)
1354 {
1355 switch(ag_rpx[(PCB).ag_ap]) {
1356 case 1: V(0,(Program * *)) = VDO(AG_WRAP_4 *, ag_rp_1(PCB_POINTER, VW(0, AG_WRAP_4 *))); break;
1357 case 2: VNO AG_WRAP_4(ag_rp_2(PCB_POINTER)); break;
1358 case 3: VRO(AG_WRAP_4 *, ag_rp_3(PCB_POINTER, VW(0, AG_WRAP_4 *), V(1,(Statement * *)))); break;
1359 case 4: V(0,(Statement * *)) = ag_rp_4(PCB_POINTER, V(2,(Expression * *)), V(4,(Statement * *))); break;
1360 case 5: V(0,(Statement * *)) = ag_rp_5(PCB_POINTER, V(2,(Expression * *)), V(4,(Statement * *)), V(6,(Statement * *))); break;
1361 case 6: V(0,(Statement * *)) = ag_rp_6(PCB_POINTER, V(2,(Expression * *)), V(4,(Statement * *))); break;
1362 case 7: V(0,(Statement * *)) = ag_rp_7(PCB_POINTER, V(2,(Expression * *)), V(4,(Expression * *)), V(6,(Expression * *)), V(8,(Statement * *))); break;
1363 case 8: V(0,(Statement * *)) = ag_rp_8(PCB_POINTER, V(2,(Expression * *)), V(4,(Statement * *)), V(6,(Statement * *))); break;
1364 case 9: V(0,(Statement * *)) = ag_rp_9(PCB_POINTER, V(2,(Expression * *)), V(4,(Statement * *))); break;
1365 case 10: V(0,(Statement * *)) = ag_rp_10(PCB_POINTER, V(2,(Expression * *)), V(4,(Expression * *)), V(6,(Expression * *)), V(8,(Statement * *))); break;
1366 case 11: V(0,(Statement * *)) = ag_rp_11(PCB_POINTER, V(0,(Statement * *))); break;
1367 case 12: V(0,(Statement * *)) = ag_rp_12(PCB_POINTER, V(1,(Statement * *)), V(4,(Expression * *))); break;
1368 case 13: V(0,(Statement * *)) = ag_rp_13(PCB_POINTER, V(0,(Expression * *))); break;
1369 case 14: V(0,(Statement * *)) = ag_rp_14(PCB_POINTER); break;
1370 case 15: V(0,(Statement * *)) = ag_rp_15(PCB_POINTER, VW(1, AG_WRAP_4 *));
1371 VWD(1, AG_WRAP_4 *); break;
1372 case 16: V(0,(Expression * *)) = ag_rp_16(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1373 case 17: V(0,(Expression * *)) = VDO(AG_WRAP_5 *, ag_rp_17(PCB_POINTER, VW(0, AG_WRAP_5 *), V(2,(Expression * *)))); break;
1374 case 18: V(0,(Expression * *)) = VDO(AG_WRAP_5 *, ag_rp_18(PCB_POINTER, VW(0, AG_WRAP_5 *), V(2,(Expression * *)))); break;
1375 case 19: V(0,(Expression * *)) = VDO(AG_WRAP_5 *, ag_rp_19(PCB_POINTER, VW(0, AG_WRAP_5 *), V(2,(Expression * *)))); break;
1376 case 20: V(0,(Expression * *)) = VDO(AG_WRAP_5 *, ag_rp_20(PCB_POINTER, VW(0, AG_WRAP_5 *), V(2,(Expression * *)))); break;
1377 case 21: V(0,(Expression * *)) = VDO(AG_WRAP_5 *, ag_rp_21(PCB_POINTER, VW(0, AG_WRAP_5 *), V(2,(Expression * *)))); break;
1378 case 22: V(0,(Expression * *)) = ag_rp_22(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *)), V(4,(Expression * *))); break;
1379 case 23: V(0,(Expression * *)) = ag_rp_23(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1380 case 24: V(0,(Expression * *)) = ag_rp_24(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1381 case 25: V(0,(Expression * *)) = ag_rp_25(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1382 case 26: V(0,(Expression * *)) = ag_rp_26(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1383 case 27: V(0,(Expression * *)) = ag_rp_27(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1384 case 28: V(0,(Expression * *)) = ag_rp_28(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1385 case 29: V(0,(Expression * *)) = ag_rp_29(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1386 case 30: V(0,(Expression * *)) = ag_rp_30(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1387 case 31: V(0,(Expression * *)) = ag_rp_31(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1388 case 32: V(0,(Expression * *)) = ag_rp_32(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1389 case 33: V(0,(Expression * *)) = ag_rp_33(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1390 case 34: V(0,(Expression * *)) = ag_rp_34(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1391 case 35: V(0,(Expression * *)) = ag_rp_35(PCB_POINTER, V(1,(Expression * *))); break;
1392 case 36: V(0,(Expression * *)) = ag_rp_36(PCB_POINTER, V(1,(Expression * *))); break;
1393 case 37: V(0,(Expression * *)) = ag_rp_37(PCB_POINTER, V(1,(Expression * *))); break;
1394 case 38: V(0,(Expression * *)) = ag_rp_38(PCB_POINTER, V(0,(Expression * *)), V(2,(Expression * *))); break;
1395 case 39: V(0,(Expression * *)) = ag_rp_39(PCB_POINTER, V(0,(double *))); break;
1396 case 40: V(0,(Expression * *)) = VDO(AG_WRAP_5 *, ag_rp_40(PCB_POINTER, VW(0, AG_WRAP_5 *))); break;
1397 case 41: V(0,(Expression * *)) = ag_rp_41(PCB_POINTER, V(2,(Expression * *))); break;
1398 case 42: V(0,(Expression * *)) = ag_rp_42(PCB_POINTER, V(2,(Expression * *))); break;
1399 case 43: V(0,(Expression * *)) = ag_rp_43(PCB_POINTER, V(2,(Expression * *))); break;
1400 case 44: V(0,(Expression * *)) = ag_rp_44(PCB_POINTER, V(1,(Expression * *))); break;
1401 case 45: V(0,(double *)) = ag_rp_45(PCB_POINTER, V(0,(double *))); break;
1402 case 46: V(0,(double *)) = ag_rp_46(PCB_POINTER, V(0,(double *)), V(3,(int *))); break;
1403 case 47: V(0,(double *)) = ag_rp_47(PCB_POINTER, V(0,(double *)), V(3,(int *))); break;
1404 case 48: V(0,(double *)) = ag_rp_48(PCB_POINTER, V(0,(double *)), V(2,(double *))); break;
1405 case 49: V(0,(double *)) = ag_rp_49(PCB_POINTER, V(0,(double *))); break;
1406 case 50: V(0,(double *)) = ag_rp_50(PCB_POINTER, V(1,(double *))); break;
1407 case 51: V(0,(double *)) = ag_rp_51(PCB_POINTER, V(0,(int *))); break;
1408 case 52: V(0,(double *)) = ag_rp_52(PCB_POINTER, V(0,(double *)), V(1,(int *))); break;
1409 case 53: V(0,(double *)) = ag_rp_53(PCB_POINTER, V(0,(int *))); break;
1410 case 54: V(0,(double *)) = ag_rp_54(PCB_POINTER, V(0,(int *)), V(1,(double *))); break;
1411 case 55: V(0,(int *)) = ag_rp_55(PCB_POINTER, V(0,(int *))); break;
1412 case 56: V(0,(int *)) = ag_rp_56(PCB_POINTER, V(0,(int *)), V(1,(int *))); break;
1413 case 57: VNO AG_WRAP_5(ag_rp_57(PCB_POINTER, V(0,(int *)))); break;
1414 case 58: VRO(AG_WRAP_5 *, ag_rp_58(PCB_POINTER, VW(0, AG_WRAP_5 *), V(1,(int *)))); break;
1415 }
1416 (PCB).la_ptr = (PCB).pointer;
1417 }
1418
1419 #define TOKEN_NAMES astParse_token_names
1420 const char *const astParse_token_names[122] = {
1421 "input string",
1422 "white space",
1423 "real",
1424 "name",
1425 "input string",
1426 "statements",
1427 "eof",
1428 "statement",
1429 "closed statement",
1430 "open statement",
1431 "\"if\"",
1432 "'('",
1433 "expression",
1434 "')'",
1435 "\"else\"",
1436 "\"while\"",
1437 "\"for\"",
1438 "';'",
1439 "simple statement",
1440 "\"do\"",
1441 "'{'",
1442 "'}'",
1443 "assignment expression",
1444 "','",
1445 "conditional expression",
1446 "'='",
1447 "\"+=\"",
1448 "\"-=\"",
1449 "\"*=\"",
1450 "\"/=\"",
1451 "logical or expression",
1452 "'\\?'",
1453 "':'",
1454 "logical and expression",
1455 "\"||\"",
1456 "equality expression",
1457 "\"&&\"",
1458 "relational expression",
1459 "\"==\"",
1460 "\"!=\"",
1461 "additive expression",
1462 "'<'",
1463 "\"<=\"",
1464 "'>'",
1465 "\">=\"",
1466 "multiplicative expression",
1467 "'+'",
1468 "'-'",
1469 "unary expression",
1470 "'*'",
1471 "'/'",
1472 "factor",
1473 "'!'",
1474 "primary",
1475 "\"**\"",
1476 "\"log\"",
1477 "\"exp\"",
1478 "\"sqrt\"",
1479 "",
1480 "\"/*\"",
1481 "",
1482 "",
1483 "",
1484 "\"*/\"",
1485 "\"//\"",
1486 "",
1487 "",
1488 "",
1489 "'\\n'",
1490 "simple real",
1491 "",
1492 "",
1493 "exponent",
1494 "integer part",
1495 "'.'",
1496 "fraction part",
1497 "",
1498 "digit",
1499 "letter",
1500 "",
1501 "",
1502 "",
1503 "",
1504 "",
1505 "",
1506 "')'",
1507 "'('",
1508 "\"if\"",
1509 "\"else\"",
1510 "\"while\"",
1511 "';'",
1512 "\"for\"",
1513 "\"do\"",
1514 "'}'",
1515 "'{'",
1516 "','",
1517 "'='",
1518 "name",
1519 "\"+=\"",
1520 "\"-=\"",
1521 "\"*=\"",
1522 "\"/=\"",
1523 "':'",
1524 "'\\?'",
1525 "\"||\"",
1526 "\"&&\"",
1527 "\"==\"",
1528 "\"!=\"",
1529 "'<'",
1530 "\"<=\"",
1531 "'>'",
1532 "\">=\"",
1533 "'+'",
1534 "'-'",
1535 "'*'",
1536 "'/'",
1537 "'!'",
1538 "\"**\"",
1539 "real",
1540 "\"log\"",
1541 "\"exp\"",
1542 "\"sqrt\"",
1543
1544 };
1545
1546 #ifndef MISSING_FORMAT
1547 #define MISSING_FORMAT "Missing %s"
1548 #endif
1549 #ifndef UNEXPECTED_FORMAT
1550 #define UNEXPECTED_FORMAT "Unexpected %s"
1551 #endif
1552 #ifndef UNNAMED_TOKEN
1553 #define UNNAMED_TOKEN "input"
1554 #endif
1555
1556
1557 static void ag_diagnose(PCB_DECL) {
1558 int ag_snd = (PCB).sn;
1559 int ag_k = ag_sbt[ag_snd];
1560
1561 if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) {
1562 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]);
1563 }
1564 else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8
1565 && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1
1566 && *TOKEN_NAMES[ag_tstt[ag_k]]) {
1567 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]);
1568 }
1569 else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) {
1570 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]);
1571 }
1572 else if (isprint(INPUT_CODE((*(PCB).pointer))) && INPUT_CODE((*(PCB).pointer)) != '\\') {
1573 char buf[20];
1574 sprintf(buf, "\'%c\'", (char) INPUT_CODE((*(PCB).pointer)));
1575 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf);
1576 }
1577 else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN);
1578 (PCB).error_message = (PCB).ag_msg;
1579
1580
1581 }
1582 static int ag_action_1_r_proc(PCB_DECL);
1583 static int ag_action_2_r_proc(PCB_DECL);
1584 static int ag_action_3_r_proc(PCB_DECL);
1585 static int ag_action_4_r_proc(PCB_DECL);
1586 static int ag_action_1_s_proc(PCB_DECL);
1587 static int ag_action_3_s_proc(PCB_DECL);
1588 static int ag_action_1_proc(PCB_DECL);
1589 static int ag_action_2_proc(PCB_DECL);
1590 static int ag_action_3_proc(PCB_DECL);
1591 static int ag_action_4_proc(PCB_DECL);
1592 static int ag_action_5_proc(PCB_DECL);
1593 static int ag_action_6_proc(PCB_DECL);
1594 static int ag_action_7_proc(PCB_DECL);
1595 static int ag_action_8_proc(PCB_DECL);
1596 static int ag_action_9_proc(PCB_DECL);
1597 static int ag_action_10_proc(PCB_DECL);
1598 static int ag_action_11_proc(PCB_DECL);
1599 static int ag_action_8_proc(PCB_DECL);
1600
1601
1602 static int (*const ag_r_procs_scan[])(PCB_DECL) = {
1603 ag_action_1_r_proc,
1604 ag_action_2_r_proc,
1605 ag_action_3_r_proc,
1606 ag_action_4_r_proc
1607 };
1608
1609 static int (*const ag_s_procs_scan[])(PCB_DECL) = {
1610 ag_action_1_s_proc,
1611 ag_action_2_r_proc,
1612 ag_action_3_s_proc,
1613 ag_action_4_r_proc
1614 };
1615
1616 static int (*const ag_gt_procs_scan[])(PCB_DECL) = {
1617 ag_action_1_proc,
1618 ag_action_2_proc,
1619 ag_action_3_proc,
1620 ag_action_4_proc,
1621 ag_action_5_proc,
1622 ag_action_6_proc,
1623 ag_action_7_proc,
1624 ag_action_8_proc,
1625 ag_action_9_proc,
1626 ag_action_10_proc,
1627 ag_action_11_proc,
1628 ag_action_8_proc
1629 };
1630
1631
1632 static int ag_action_10_proc(PCB_DECL) {
1633 int ag_t = (PCB).token_number;
1634 (PCB).btsx = 0, (PCB).drt = -1;
1635 do {
1636 ag_track(PCB_POINTER);
1637 (PCB).token_number = (astParse_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr));
1638 (PCB).la_ptr++;
1639 if (ag_key_index[(PCB).sn]) {
1640 unsigned ag_k = ag_key_index[(PCB).sn];
1641 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer));
1642 if (ag_ch <= 255) {
1643 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
1644 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k);
1645 }
1646 }
1647 } while ((PCB).token_number == (astParse_token_type) ag_t);
1648 (PCB).la_ptr = (PCB).pointer;
1649 return 1;
1650 }
1651
1652 static int ag_action_11_proc(PCB_DECL) {
1653 int ag_t = (PCB).token_number;
1654
1655 (PCB).btsx = 0, (PCB).drt = -1;
1656 do {
1657 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer;
1658 (PCB).ssx--;
1659 ag_track(PCB_POINTER);
1660 ag_ra(PCB_POINTER);
1661 if ((PCB).exit_flag != AG_RUNNING_CODE) return 0;
1662 (PCB).ssx++;
1663 (PCB).token_number = (astParse_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr));
1664 (PCB).la_ptr++;
1665 if (ag_key_index[(PCB).sn]) {
1666 unsigned ag_k = ag_key_index[(PCB).sn];
1667 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer));
1668 if (ag_ch <= 255) {
1669 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
1670 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k);
1671 }
1672 }
1673 }
1674 while ((PCB).token_number == (astParse_token_type) ag_t);
1675 (PCB).la_ptr = (PCB).pointer;
1676 return 1;
1677 }
1678
1679 static int ag_action_3_r_proc(PCB_DECL) {
1680 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
1681 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1682 (PCB).btsx = 0, (PCB).drt = -1;
1683 (PCB).reduction_token = (astParse_token_type) ag_ptt[(PCB).ag_ap];
1684 ag_ra(PCB_POINTER);
1685 return (PCB).exit_flag == AG_RUNNING_CODE;
1686 }
1687
1688 static int ag_action_3_s_proc(PCB_DECL) {
1689 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
1690 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1691 (PCB).btsx = 0, (PCB).drt = -1;
1692 (PCB).reduction_token = (astParse_token_type) ag_ptt[(PCB).ag_ap];
1693 ag_ra(PCB_POINTER);
1694 return (PCB).exit_flag == AG_RUNNING_CODE;
1695 }
1696
1697 static int ag_action_4_r_proc(PCB_DECL) {
1698 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
1699 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1700 (PCB).reduction_token = (astParse_token_type) ag_ptt[(PCB).ag_ap];
1701 return 1;
1702 }
1703
1704 static int ag_action_2_proc(PCB_DECL) {
1705 (PCB).btsx = 0, (PCB).drt = -1;
1706 if ((PCB).ssx >= 128) {
1707 (PCB).exit_flag = AG_STACK_ERROR_CODE;
1708 PARSER_STACK_OVERFLOW;
1709 }
1710 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer;
1711 (PCB).ss[(PCB).ssx] = (PCB).sn;
1712 (PCB).ssx++;
1713 (PCB).sn = (PCB).ag_ap;
1714 ag_track(PCB_POINTER);
1715 return 0;
1716 }
1717
1718 static int ag_action_9_proc(PCB_DECL) {
1719 if ((PCB).drt == -1) {
1720 (PCB).drt=(PCB).token_number;
1721 (PCB).dssx=(PCB).ssx;
1722 (PCB).dsn=(PCB).sn;
1723 }
1724 ag_prot(PCB_POINTER);
1725 (PCB).vs[(PCB).ssx] = ag_null_value;
1726 (PCB).ss[(PCB).ssx] = (PCB).sn;
1727 (PCB).ssx++;
1728 (PCB).sn = (PCB).ag_ap;
1729 (PCB).la_ptr = (PCB).pointer;
1730 return (PCB).exit_flag == AG_RUNNING_CODE;
1731 }
1732
1733 static int ag_action_2_r_proc(PCB_DECL) {
1734 (PCB).ssx++;
1735 (PCB).sn = (PCB).ag_ap;
1736 return 0;
1737 }
1738
1739 static int ag_action_7_proc(PCB_DECL) {
1740 --(PCB).ssx;
1741 (PCB).la_ptr = (PCB).pointer;
1742 (PCB).exit_flag = AG_SUCCESS_CODE;
1743 return 0;
1744 }
1745
1746 static int ag_action_1_proc(PCB_DECL) {
1747 ag_track(PCB_POINTER);
1748 (PCB).exit_flag = AG_SUCCESS_CODE;
1749 return 0;
1750 }
1751
1752 static int ag_action_1_r_proc(PCB_DECL) {
1753 (PCB).exit_flag = AG_SUCCESS_CODE;
1754 return 0;
1755 }
1756
1757 static int ag_action_1_s_proc(PCB_DECL) {
1758 (PCB).exit_flag = AG_SUCCESS_CODE;
1759 return 0;
1760 }
1761
1762 static int ag_action_4_proc(PCB_DECL) {
1763 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
1764 (PCB).reduction_token = (astParse_token_type) ag_ptt[(PCB).ag_ap];
1765 (PCB).btsx = 0, (PCB).drt = -1;
1766 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer;
1767 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1768 else (PCB).ss[(PCB).ssx] = (PCB).sn;
1769 ag_track(PCB_POINTER);
1770 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1771 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
1772 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
1773 do {
1774 unsigned ag_tx = (ag_t1 + ag_t2)/2;
1775 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
1776 else ag_t2 = ag_tx;
1777 } while (ag_t1 < ag_t2);
1778 (PCB).ag_ap = ag_pstt[ag_t1];
1779 if ((ag_s_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break;
1780 }
1781 return 0;
1782 }
1783
1784 static int ag_action_3_proc(PCB_DECL) {
1785 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
1786 (PCB).btsx = 0, (PCB).drt = -1;
1787 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer;
1788 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1789 else (PCB).ss[(PCB).ssx] = (PCB).sn;
1790 ag_track(PCB_POINTER);
1791 (PCB).reduction_token = (astParse_token_type) ag_ptt[(PCB).ag_ap];
1792 ag_ra(PCB_POINTER);
1793 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1794 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
1795 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
1796 do {
1797 unsigned ag_tx = (ag_t1 + ag_t2)/2;
1798 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
1799 else ag_t2 = ag_tx;
1800 } while (ag_t1 < ag_t2);
1801 (PCB).ag_ap = ag_pstt[ag_t1];
1802 if ((ag_s_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break;
1803 }
1804 return 0;
1805 }
1806
1807 static int ag_action_8_proc(PCB_DECL) {
1808 ag_undo(PCB_POINTER);
1809 (PCB).la_ptr = (PCB).pointer;
1810 (PCB).exit_flag = AG_SYNTAX_ERROR_CODE;
1811 ag_diagnose(PCB_POINTER);
1812 SYNTAX_ERROR;
1813 {(PCB).la_ptr = (PCB).pointer + 1; ag_track(PCB_POINTER);}
1814 return (PCB).exit_flag == AG_RUNNING_CODE;
1815 }
1816
1817 static int ag_action_5_proc(PCB_DECL) {
1818 int ag_sd = ag_fl[(PCB).ag_ap];
1819 (PCB).btsx = 0, (PCB).drt = -1;
1820 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1821 else {
1822 (PCB).ss[(PCB).ssx] = (PCB).sn;
1823 }
1824 (PCB).la_ptr = (PCB).pointer;
1825 (PCB).reduction_token = (astParse_token_type) ag_ptt[(PCB).ag_ap];
1826 ag_ra(PCB_POINTER);
1827 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1828 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
1829 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
1830 do {
1831 unsigned ag_tx = (ag_t1 + ag_t2)/2;
1832 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
1833 else ag_t2 = ag_tx;
1834 } while (ag_t1 < ag_t2);
1835 (PCB).ag_ap = ag_pstt[ag_t1];
1836 if ((ag_r_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break;
1837 }
1838 return (PCB).exit_flag == AG_RUNNING_CODE;
1839 }
1840
1841 static int ag_action_6_proc(PCB_DECL) {
1842 int ag_sd = ag_fl[(PCB).ag_ap];
1843 (PCB).reduction_token = (astParse_token_type) ag_ptt[(PCB).ag_ap];
1844 if ((PCB).drt == -1) {
1845 (PCB).drt=(PCB).token_number;
1846 (PCB).dssx=(PCB).ssx;
1847 (PCB).dsn=(PCB).sn;
1848 }
1849 if (ag_sd) {
1850 (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1851 }
1852 else {
1853 ag_prot(PCB_POINTER);
1854 (PCB).vs[(PCB).ssx] = ag_null_value;
1855 (PCB).ss[(PCB).ssx] = (PCB).sn;
1856 }
1857 (PCB).la_ptr = (PCB).pointer;
1858 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1859 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
1860 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
1861 do {
1862 unsigned ag_tx = (ag_t1 + ag_t2)/2;
1863 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
1864 else ag_t2 = ag_tx;
1865 } while (ag_t1 < ag_t2);
1866 (PCB).ag_ap = ag_pstt[ag_t1];
1867 if ((ag_r_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break;
1868 }
1869 return (PCB).exit_flag == AG_RUNNING_CODE;
1870 }
1871
1872
1873 void init_astParse(astParse_pcb_type *PCB_POINTER) {
1874 (PCB).la_ptr = (PCB).pointer;
1875 (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0;
1876 (PCB).exit_flag = AG_RUNNING_CODE;
1877 (PCB).line = FIRST_LINE;
1878 (PCB).column = FIRST_COLUMN;
1879 (PCB).btsx = 0, (PCB).drt = -1;
1880 }
1881
1882 void astParse(astParse_pcb_type *PCB_POINTER) {
1883 init_astParse(PCB_POINTER);
1884 (PCB).exit_flag = AG_RUNNING_CODE;
1885 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1886 unsigned ag_t1 = ag_sbt[(PCB).sn];
1887 if (ag_tstt[ag_t1]) {
1888 unsigned ag_t2 = ag_sbe[(PCB).sn] - 1;
1889 (PCB).token_number = (astParse_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr));
1890 (PCB).la_ptr++;
1891 if (ag_key_index[(PCB).sn]) {
1892 unsigned ag_k = ag_key_index[(PCB).sn];
1893 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer));
1894 if (ag_ch <= 255) {
1895 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
1896 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k);
1897 }
1898 }
1899 do {
1900 unsigned ag_tx = (ag_t1 + ag_t2)/2;
1901 if (ag_tstt[ag_tx] > (unsigned char)(PCB).token_number)
1902 ag_t1 = ag_tx + 1;
1903 else ag_t2 = ag_tx;
1904 } while (ag_t1 < ag_t2);
1905 if (ag_tstt[ag_t1] != (unsigned char)(PCB).token_number)
1906 ag_t1 = ag_sbe[(PCB).sn];
1907 }
1908 (PCB).ag_ap = ag_pstt[ag_t1];
1909 (ag_gt_procs_scan[ag_astt[ag_t1]])((PCB_TYPE *)PCB_POINTER);
1910 }
1911 }
1912
1913