comparison tests/agcl/ffcalc/good/ffcx-t.c @ 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 /* FOUR FUNCTION CALCULATOR: FFCALCX.SYN */
2 /*
3 * AnaGram, A System for Syntax Directed Programming
4 * File generated by: ...
5 *
6 * AnaGram Parsing Engine
7 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
8 *
9 * This software is provided 'as-is', without any express or implied
10 * warranty. In no event will the authors be held liable for any damages
11 * arising from the use of this software.
12 *
13 * Permission is granted to anyone to use this software for any purpose,
14 * including commercial applications, and to alter it and redistribute it
15 * freely, subject to the following restrictions:
16 *
17 * 1. The origin of this software must not be misrepresented; you must not
18 * claim that you wrote the original software. If you use this software
19 * in a product, an acknowledgment in the product documentation would be
20 * appreciated but is not required.
21 * 2. Altered source versions must be plainly marked as such, and must not be
22 * misrepresented as being the original software.
23 * 3. This notice may not be removed or altered from any source distribution.
24 */
25
26 #ifndef FFCX-T_H
27 #include "ffcx-t.h"
28 #endif
29
30 #ifndef FFCX-T_H
31 #error Mismatched header file
32 #endif
33
34 #include <ctype.h>
35 #include <stdio.h>
36
37 #define RULE_CONTEXT (&((PCB).cs[(PCB).ssx]))
38 #define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx])
39 #define CONTEXT ((PCB).cs[(PCB).ssx])
40
41
42
43 ffcx-t_pcb_type ffcx-t_pcb;
44 #define PCB ffcx-t_pcb
45
46 /* Line -, ffcx-t.syn */
47 /* -- EMBEDDED C ---------------------------------- */
48 double value[64]; /* registers */
49 int main(void) {
50 ffcalcx();
51 return 0;
52 }
53
54 #ifndef CONVERT_CASE
55 #define CONVERT_CASE(c) (c)
56 #endif
57 #ifndef TAB_SPACING
58 #define TAB_SPACING 8
59 #endif
60
61 #define ag_rp_1(x) (printf("%g\n",x))
62
63 static void ag_rp_2(int n, double x) {
64 /* Line -, ffcx-t.syn */
65 printf("%c = %g\n",n+'A',value[n]=x);
66 }
67
68 #define ag_rp_3(n) (value[n])
69
70 #define ag_rp_4(x) (x)
71
72 #define ag_rp_5(x, t) (x+t)
73
74 #define ag_rp_6(x, t) (x-t)
75
76 #define ag_rp_7(t, f) (t*f)
77
78 #define ag_rp_8(t, f) (t/f)
79
80 #define ag_rp_9(f) (-f)
81
82 #define ag_rp_10(c) (c-'A')
83
84 #define ag_rp_11(i, f) (i+f)
85
86 #define ag_rp_12(f) (f)
87
88 #define ag_rp_13(d) (d-'0')
89
90 #define ag_rp_14(x, d) (10*x + d-'0')
91
92 #define ag_rp_15(d) ((d-'0')/10.)
93
94 #define ag_rp_16(d, f) ((d-'0' + f)/10.)
95
96
97 #define READ_COUNTS
98 #define WRITE_COUNTS
99 #undef V
100 #define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i]))
101 #undef VS
102 #define VS(i) (PCB).vs[(PCB).ssx + i]
103
104 #ifndef GET_CONTEXT
105 #define GET_CONTEXT CONTEXT = (PCB).input_context
106 #endif
107
108 typedef enum {
109 ag_action_1,
110 ag_action_2,
111 ag_action_3,
112 ag_action_4,
113 ag_action_5,
114 ag_action_6,
115 ag_action_7,
116 ag_action_8,
117 ag_action_9,
118 ag_action_10,
119 ag_action_11,
120 ag_action_12
121 } ag_parser_action;
122
123
124 #ifndef NULL_VALUE_INITIALIZER
125 #define NULL_VALUE_INITIALIZER = { 0 }
126 #endif
127
128 static ffcx-t_vs_type const ag_null_value NULL_VALUE_INITIALIZER;
129
130 static const unsigned char ag_rpx[] = {
131 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 3, 0, 4, 5, 6, 7,
132 8, 9, 0, 0, 0, 0, 0, 0, 10, 11, 0, 0, 0, 12, 13, 14, 15, 16
133 };
134
135 static const unsigned char ag_key_itt[] = {
136 0
137 };
138
139 static const unsigned short ag_key_pt[] = {
140 0
141 };
142
143 static const unsigned char ag_key_ch[] = {
144 0, 47,255, 42,255
145 };
146
147 static const unsigned char ag_key_act[] = {
148 0,3,4,3,4
149 };
150
151 static const unsigned char ag_key_parm[] = {
152 0, 23, 0, 27, 0
153 };
154
155 static const unsigned char ag_key_jmp[] = {
156 0, 0, 0, 2, 0
157 };
158
159 static const unsigned char ag_key_index[] = {
160 1, 3, 1, 1, 1, 0, 3, 3, 3, 1, 1, 1, 0, 1, 1, 0, 1, 1,
161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 1, 1, 1,
162 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1,
163 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
164 };
165
166 static const unsigned char ag_key_ends[] = {
167 42,0, 47,0,
168 };
169 #define AG_TCV(x) (((int)(x) >= -1 && (int)(x) <= 255) ? ag_tcv[(x) + 1] : 0)
170
171 static const unsigned char ag_tcv[] = {
172 15, 34, 34, 34, 34, 34, 34, 34, 34, 34, 22, 37, 22, 22, 22, 34, 34, 34,
173 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 22, 34, 34,
174 34, 34, 34, 34, 34, 41, 40, 44, 42, 34, 43, 30, 45, 33, 33, 33, 33, 33,
175 33, 33, 33, 33, 33, 34, 34, 34, 38, 34, 34, 34, 46, 46, 46, 46, 46, 46,
176 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
177 46, 46, 34, 34, 34, 34, 34, 34, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
178 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 34, 34,
179 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
180 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
181 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
182 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
183 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
184 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
185 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
186 34, 34, 34, 34, 34
187 };
188
189 #ifndef SYNTAX_ERROR
190 #define SYNTAX_ERROR fprintf(stderr,"%s, line %d, column %d\n", \
191 (PCB).error_message, (PCB).line, (PCB).column)
192 #endif
193
194 #ifndef FIRST_LINE
195 #define FIRST_LINE 1
196 #endif
197
198 #ifndef FIRST_COLUMN
199 #define FIRST_COLUMN 1
200 #endif
201
202 #ifndef PARSER_STACK_OVERFLOW
203 #define PARSER_STACK_OVERFLOW {fprintf(stderr, \
204 "\nParser stack overflow, line %d, column %d\n",\
205 (PCB).line, (PCB).column);}
206 #endif
207
208 #ifndef REDUCTION_TOKEN_ERROR
209 #define REDUCTION_TOKEN_ERROR {fprintf(stderr, \
210 "\nReduction token error, line %d, column %d\n", \
211 (PCB).line, (PCB).column);}
212 #endif
213
214
215 typedef enum
216 {ag_accept_key, ag_set_key, ag_jmp_key, ag_end_key, ag_no_match_key,
217 ag_cf_accept_key, ag_cf_set_key, ag_cf_end_key} key_words;
218
219 #ifndef GET_INPUT
220 #define GET_INPUT ((PCB).input_code = getchar())
221 #endif
222
223
224 static int ag_look_ahead(void) {
225 if ((PCB).rx < (PCB).fx) {
226 return CONVERT_CASE((PCB).lab[(PCB).rx++]);
227 }
228 GET_INPUT;
229 (PCB).fx++;
230 return CONVERT_CASE((PCB).lab[(PCB).rx++] = (PCB).input_code);
231 }
232
233 static void ag_get_key_word(int ag_k) {
234 int save_index = (PCB).rx;
235 const unsigned char *sp;
236 int ag_ch;
237 while (1) {
238 switch (ag_key_act[ag_k]) {
239 case ag_cf_end_key:
240 sp = ag_key_ends + ag_key_jmp[ag_k];
241 do {
242 if ((ag_ch = *sp++) == 0) {
243 int ag_k1 = ag_key_parm[ag_k];
244 int ag_k2 = ag_key_pt[ag_k1];
245 if (ag_key_itt[ag_k2 + ag_look_ahead()]) goto ag_fail;
246 (PCB).rx--;
247 (PCB).token_number = (ffcx-t_token_type) ag_key_pt[ag_k1 + 1];
248 return;
249 }
250 } while (ag_look_ahead() == ag_ch);
251 goto ag_fail;
252 case ag_end_key:
253 sp = ag_key_ends + ag_key_jmp[ag_k];
254 do {
255 if ((ag_ch = *sp++) == 0) {
256 (PCB).token_number = (ffcx-t_token_type) ag_key_parm[ag_k];
257 return;
258 }
259 } while (ag_look_ahead() == ag_ch);
260 case ag_no_match_key:
261 ag_fail:
262 (PCB).rx = save_index;
263 return;
264 case ag_cf_set_key: {
265 int ag_k1 = ag_key_parm[ag_k];
266 int ag_k2 = ag_key_pt[ag_k1];
267 ag_k = ag_key_jmp[ag_k];
268 if (ag_key_itt[ag_k2 + (ag_ch = ag_look_ahead())]) break;
269 save_index = --(PCB).rx;
270 (PCB).token_number = (ffcx-t_token_type) ag_key_pt[ag_k1+1];
271 break;
272 }
273 case ag_set_key:
274 save_index = (PCB).rx;
275 (PCB).token_number = (ffcx-t_token_type) ag_key_parm[ag_k];
276 case ag_jmp_key:
277 ag_k = ag_key_jmp[ag_k];
278 ag_ch = ag_look_ahead();
279 break;
280 case ag_accept_key:
281 (PCB).token_number = (ffcx-t_token_type) ag_key_parm[ag_k];
282 return;
283 case ag_cf_accept_key: {
284 int ag_k1 = ag_key_parm[ag_k];
285 int ag_k2 = ag_key_pt[ag_k1];
286 if (ag_key_itt[ag_k2 + ag_look_ahead()]) (PCB).rx = save_index;
287 else {
288 (PCB).rx--;
289 (PCB).token_number = (ffcx-t_token_type) ag_key_pt[ag_k1+1];
290 }
291 return;
292 }
293 default:
294 /* not reachable; here to suppress compiler warnings */
295 goto ag_fail;
296 }
297 if (ag_ch <= 255) while (ag_key_ch[ag_k] < ag_ch) ag_k++;
298 if (ag_ch > 255 || ag_key_ch[ag_k] != ag_ch) {
299 (PCB).rx = save_index;
300 return;
301 }
302 }
303 }
304
305
306 #ifndef AG_NEWLINE
307 #define AG_NEWLINE 10
308 #endif
309
310 #ifndef AG_RETURN
311 #define AG_RETURN 13
312 #endif
313
314 #ifndef AG_FORMFEED
315 #define AG_FORMFEED 12
316 #endif
317
318 #ifndef AG_TABCHAR
319 #define AG_TABCHAR 9
320 #endif
321
322 static void ag_track(void) {
323 int ag_k = 0;
324 while (ag_k < (PCB).rx) {
325 int ag_ch = (PCB).lab[ag_k++];
326 switch (ag_ch) {
327 case AG_NEWLINE:
328 (PCB).column = 1, (PCB).line++;
329 case AG_RETURN:
330 case AG_FORMFEED:
331 break;
332 case AG_TABCHAR:
333 (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING);
334 break;
335 default:
336 (PCB).column++;
337 }
338 }
339 ag_k = 0;
340 while ((PCB).rx < (PCB).fx) (PCB).lab[ag_k++] = (PCB).lab[(PCB).rx++];
341 (PCB).fx = ag_k;
342 (PCB).rx = 0;
343 }
344
345
346 static void ag_prot(void) {
347 int ag_k;
348 ag_k = 128 - ++(PCB).btsx;
349 if (ag_k <= (PCB).ssx) {
350 (PCB).exit_flag = AG_STACK_ERROR_CODE;
351 PARSER_STACK_OVERFLOW;
352 return;
353 }
354 (PCB).bts[(PCB).btsx] = (PCB).sn;
355 (PCB).bts[ag_k] = (PCB).ssx;
356 (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx];
357 (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx];
358 }
359
360 static void ag_undo(void) {
361 if ((PCB).drt == -1) return;
362 while ((PCB).btsx) {
363 int ag_k = 128 - (PCB).btsx;
364 (PCB).sn = (PCB).bts[(PCB).btsx--];
365 (PCB).ssx = (PCB).bts[ag_k];
366 (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k];
367 (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k];
368 }
369 (PCB).token_number = (ffcx-t_token_type) (PCB).drt;
370 (PCB).ssx = (PCB).dssx;
371 (PCB).sn = (PCB).dsn;
372 (PCB).drt = -1;
373 }
374
375
376 static const unsigned char ag_tstt[] = {
377 46,43,41,37,33,30,23,22,15,0,1,35,36,
378 46,45,44,43,42,41,40,38,37,34,33,30,27,22,0,25,26,
379 46,45,44,43,42,41,40,38,37,33,30,23,22,15,0,
380 46,45,44,43,42,41,40,38,37,33,30,23,22,15,0,
381 46,45,44,43,42,41,40,38,37,33,30,23,22,15,0,1,
382 46,43,41,37,33,30,19,15,0,2,4,7,8,9,10,12,13,14,16,17,20,28,29,39,
383 46,45,44,43,42,41,40,38,37,34,33,30,27,22,0,
384 46,45,44,43,42,41,40,38,37,34,33,30,27,22,0,
385 27,0,
386 46,45,44,43,42,41,40,38,37,33,30,23,22,15,0,
387 45,44,43,42,40,37,33,30,23,22,0,
388 46,43,41,33,30,23,22,0,1,35,36,
389 33,0,31,
390 45,44,43,42,40,37,33,30,23,22,0,32,
391 45,44,43,42,40,38,37,23,22,0,1,35,36,
392 46,43,41,33,30,0,
393 46,43,41,33,30,23,22,0,1,35,36,
394 45,44,43,42,40,37,23,22,0,1,35,36,
395 45,44,43,42,40,38,37,0,
396 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
397 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
398 45,44,43,42,40,37,0,
399 37,0,
400 45,44,43,42,38,37,0,18,
401 45,44,43,42,37,0,3,4,5,6,
402 37,0,
403 37,0,11,
404 46,43,41,37,33,30,15,0,
405 46,43,41,37,33,30,19,15,0,2,4,7,9,10,12,16,17,20,28,29,39,
406 15,0,
407 46,45,44,43,42,41,40,38,37,34,33,30,27,22,0,
408 46,45,44,43,42,41,40,38,37,33,30,23,22,15,0,
409 46,43,41,33,30,0,
410 45,44,43,42,40,37,33,23,22,0,31,
411 45,44,43,42,40,37,23,22,0,
412 45,44,43,42,40,37,33,30,23,22,0,
413 45,44,43,42,40,37,23,22,0,
414 45,44,43,42,40,37,33,23,22,0,31,
415 45,44,43,42,40,38,37,0,
416 46,43,41,33,30,0,
417 45,44,43,42,40,37,0,
418 45,44,43,42,40,37,0,
419 45,44,43,42,40,37,0,3,4,5,6,
420 45,44,43,42,40,0,3,4,5,6,21,
421 46,43,41,33,30,23,22,0,1,35,36,
422 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
423 46,43,41,33,30,23,22,0,1,35,36,
424 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
425 46,43,41,33,30,23,22,0,1,35,36,
426 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
427 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
428 46,43,41,33,30,23,22,0,1,35,36,
429 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
430 46,43,41,37,33,30,23,22,15,0,1,35,36,
431 46,43,41,37,33,30,15,0,
432 46,43,41,37,33,30,15,0,
433 45,44,43,42,40,37,23,22,0,
434 45,44,43,42,40,37,23,22,0,
435 45,44,43,42,40,37,23,22,0,1,35,36,
436 45,44,43,42,40,37,0,
437 46,43,41,33,30,0,
438 45,44,43,42,37,0,3,4,5,6,
439 46,43,41,33,30,0,
440 45,44,43,42,40,37,0,3,4,5,6,
441 46,43,41,33,30,0,
442 45,44,43,42,40,37,0,3,4,5,6,
443 45,44,43,42,40,37,0,3,4,5,6,
444 46,43,41,33,30,0,
445 45,44,43,42,40,37,0,3,4,5,6,
446 46,43,41,37,33,30,15,0,
447 45,44,43,42,40,37,0,
448
449 };
450
451
452 static unsigned const char ag_astt[742] = {
453 5,5,5,5,5,5,1,1,5,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,7,1,1,5,5,5,5,5,5,5,
454 5,5,5,5,5,5,5,7,5,5,5,5,5,5,5,5,5,5,5,5,5,5,7,5,5,5,5,5,5,5,5,5,5,5,1,1,5,
455 7,1,1,1,1,5,1,1,1,5,7,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,5,5,5,
456 5,5,5,7,1,1,1,1,1,1,1,1,1,1,1,1,5,1,7,1,7,5,5,5,5,5,5,5,5,5,5,5,5,5,5,7,4,
457 4,4,4,4,4,4,4,4,4,7,5,5,5,5,5,1,1,7,1,1,1,1,7,1,5,5,5,5,5,5,1,1,5,5,7,1,5,
458 5,5,5,5,5,5,1,1,7,1,1,1,5,5,5,5,5,7,5,5,5,5,5,1,1,7,1,1,1,5,5,5,5,5,5,1,1,
459 7,1,1,1,4,4,4,4,4,4,4,7,1,1,1,1,1,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,1,1,
460 1,1,1,1,1,5,5,5,5,5,5,7,5,7,4,4,4,4,1,4,7,1,1,1,1,1,4,7,1,1,1,1,5,7,1,7,1,
461 5,5,5,5,5,5,5,7,1,1,1,5,1,1,1,5,7,1,1,1,1,1,1,1,1,1,1,1,1,3,7,5,5,5,5,5,5,
462 5,5,5,5,5,5,5,5,7,5,5,5,5,5,5,5,5,5,5,5,5,5,5,7,5,5,5,5,5,7,4,4,4,4,4,4,1,
463 4,4,7,1,4,4,4,4,4,4,4,4,7,4,4,4,4,4,4,4,4,4,4,7,5,5,5,5,5,5,5,5,7,5,5,5,5,
464 5,5,1,5,5,7,1,5,5,5,5,5,5,5,7,5,5,5,5,5,7,5,5,5,5,5,5,7,4,4,4,4,4,4,7,4,4,
465 4,4,4,4,7,1,1,1,1,1,1,1,1,1,7,1,1,1,1,1,5,5,5,5,5,1,1,7,1,1,1,1,1,1,1,1,7,
466 1,1,1,1,1,1,1,1,1,5,5,5,5,5,1,1,7,1,1,1,1,1,1,1,1,7,1,1,1,1,1,1,1,1,1,5,5,
467 5,5,5,1,1,7,1,1,1,1,1,1,1,1,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,1,1,1,1,1,
468 1,1,5,5,5,5,5,1,1,7,1,1,1,1,1,1,1,1,7,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,1,1,5,
469 7,1,1,1,5,5,5,5,5,5,5,7,5,5,5,5,5,5,5,7,4,4,4,4,4,4,4,4,7,4,4,4,4,4,4,4,4,
470 7,5,5,5,5,5,5,1,1,7,1,1,1,4,4,4,4,4,4,7,5,5,5,5,5,7,1,1,1,1,4,7,1,1,1,1,5,
471 5,5,5,5,7,4,4,4,4,4,4,7,1,1,1,1,5,5,5,5,5,7,4,4,4,4,4,4,7,1,1,1,1,1,1,4,4,
472 4,4,7,1,1,1,1,5,5,5,5,5,7,1,1,4,4,4,4,7,1,1,1,1,5,5,5,5,5,5,5,7,5,5,5,5,5,
473 5,7
474 };
475
476
477 static const unsigned char ag_pstt[] = {
478 52,52,52,52,52,52,1,2,52,0,3,4,5,
479 6,6,6,6,6,6,6,6,6,6,6,6,23,6,1,7,8,
480 20,20,20,20,20,20,20,20,20,20,20,20,20,20,2,
481 50,50,50,50,50,50,50,50,50,50,50,50,50,50,3,
482 53,53,53,53,53,53,53,53,53,53,53,1,2,53,4,9,
483 14,11,16,1,10,12,22,6,5,21,15,19,0,25,26,27,28,29,24,23,20,18,13,17,
484 21,21,21,21,21,21,21,21,21,21,21,21,21,21,6,
485 30,30,30,30,30,30,30,30,30,30,30,30,24,30,7,
486 31,8,
487 51,51,51,51,51,51,51,51,51,51,51,51,51,51,9,
488 32,32,32,32,32,32,32,32,32,32,10,
489 52,52,52,52,52,1,2,11,3,4,32,
490 33,12,34,
491 28,28,28,28,28,28,35,37,28,28,13,36,
492 52,52,52,52,52,52,52,1,2,14,3,4,38,
493 36,36,36,36,36,15,
494 52,52,52,52,52,1,2,16,3,4,39,
495 52,52,52,52,52,52,1,2,17,3,4,40,
496 26,26,26,26,26,26,26,18,
497 14,11,16,10,12,19,21,15,19,42,41,20,18,13,17,
498 14,11,16,10,12,20,21,15,19,43,41,20,18,13,17,
499 13,13,13,13,13,13,21,
500 11,22,
501 12,12,12,12,44,12,23,45,
502 46,48,11,51,9,24,52,50,49,47,
503 2,25,
504 53,26,54,
505 4,4,4,4,4,4,4,27,
506 14,11,16,1,10,12,22,7,28,21,15,19,25,26,55,24,23,20,18,13,17,
507 8,29,
508 22,22,22,22,22,22,22,22,22,22,22,22,22,22,30,
509 25,25,25,25,25,25,25,25,25,25,25,25,25,25,31,
510 60,60,60,60,60,32,
511 34,34,34,34,34,34,33,34,34,33,56,
512 31,31,31,31,31,31,31,31,34,
513 33,33,33,33,33,33,33,33,33,33,35,
514 30,30,30,30,30,30,30,30,36,
515 29,29,29,29,29,29,33,29,29,37,57,
516 63,63,63,63,63,63,63,38,
517 58,58,58,58,58,39,
518 56,56,56,56,56,56,40,
519 12,12,12,12,12,12,41,
520 19,19,19,19,19,19,42,52,50,49,47,
521 46,48,11,51,58,43,52,50,49,47,59,
522 52,52,52,52,52,1,2,44,3,4,60,
523 14,11,16,10,12,45,21,15,19,61,41,20,18,13,17,
524 52,52,52,52,52,1,2,46,3,4,62,
525 14,11,16,10,12,47,21,15,19,63,41,20,18,13,17,
526 52,52,52,52,52,1,2,48,3,4,64,
527 14,11,16,10,12,49,21,15,19,65,41,20,18,13,17,
528 14,11,16,10,12,50,21,15,19,66,41,20,18,13,17,
529 52,52,52,52,52,1,2,51,3,4,67,
530 14,11,16,10,12,52,21,15,19,68,41,20,18,13,17,
531 52,52,52,52,52,52,1,2,52,53,3,4,69,
532 3,3,3,3,3,3,3,54,
533 5,5,5,5,5,5,5,55,
534 35,35,35,35,35,35,35,35,56,
535 27,27,27,27,27,27,27,27,57,
536 52,52,52,52,52,52,1,2,58,3,4,70,
537 14,14,14,14,14,14,59,
538 55,55,55,55,55,60,
539 46,48,11,51,10,61,52,50,49,47,
540 62,62,62,62,62,62,
541 18,18,18,18,18,18,63,52,50,49,47,
542 61,61,61,61,61,64,
543 17,17,17,17,17,17,65,52,50,49,47,
544 46,48,16,16,16,16,66,52,50,49,47,
545 59,59,59,59,59,67,
546 46,48,15,15,15,15,68,52,50,49,47,
547 54,54,54,54,54,54,54,69,
548 57,57,57,57,57,57,70,
549
550 };
551
552
553 static const unsigned short ag_sbt[] = {
554 0, 13, 30, 45, 60, 76, 100, 115, 130, 132, 147, 158, 169, 172,
555 184, 197, 203, 214, 226, 234, 249, 264, 271, 273, 281, 291, 293, 296,
556 304, 325, 327, 342, 357, 363, 374, 383, 394, 403, 414, 422, 428, 435,
557 442, 453, 464, 475, 490, 501, 516, 527, 542, 557, 568, 583, 596, 604,
558 612, 621, 630, 642, 649, 655, 665, 671, 682, 688, 699, 710, 716, 727,
559 735, 742
560 };
561
562
563 static const unsigned short ag_sbe[] = {
564 9, 27, 44, 59, 74, 84, 114, 129, 131, 146, 157, 165, 170, 182,
565 193, 202, 210, 222, 233, 239, 254, 270, 272, 279, 286, 292, 294, 303,
566 312, 326, 341, 356, 362, 372, 382, 393, 402, 412, 421, 427, 434, 441,
567 448, 458, 471, 480, 497, 506, 523, 532, 547, 564, 573, 592, 603, 611,
568 620, 629, 638, 648, 654, 660, 670, 677, 687, 694, 705, 715, 722, 734,
569 741, 742
570 };
571
572
573 static const unsigned char ag_fl[] = {
574 2,0,1,2,1,2,0,1,2,1,3,1,1,1,3,3,3,3,3,2,1,1,2,0,1,3,1,3,0,1,2,2,1,2,1,
575 2,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
576 };
577
578 static const unsigned char ag_ptt[] = {
579 0, 10, 10, 12, 13, 13, 14, 14, 8, 9, 9, 9, 16, 16, 16, 16, 16, 16,
580 16, 16, 1, 25, 25, 26, 26, 1, 17, 39, 32, 32, 39, 39, 29, 29, 31, 31,
581 7, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 35, 35, 36, 36,
582 11, 18, 2, 21, 20, 3, 4, 5, 6, 28
583 };
584
585
586 static void ag_ra(void)
587 {
588 switch(ag_rpx[(PCB).ag_ap]) {
589 case 1: ag_rp_1(V(0,(double *))); break;
590 case 2: ag_rp_2(V(0,(int *)), V(2,(double *))); break;
591 case 3: V(0,(double *)) = ag_rp_3(V(0,(int *))); break;
592 case 4: V(0,(double *)) = ag_rp_4(V(1,(double *))); break;
593 case 5: V(0,(double *)) = ag_rp_5(V(0,(double *)), V(2,(double *))); break;
594 case 6: V(0,(double *)) = ag_rp_6(V(0,(double *)), V(2,(double *))); break;
595 case 7: V(0,(double *)) = ag_rp_7(V(0,(double *)), V(2,(double *))); break;
596 case 8: V(0,(double *)) = ag_rp_8(V(0,(double *)), V(2,(double *))); break;
597 case 9: V(0,(double *)) = ag_rp_9(V(1,(double *))); break;
598 case 10: V(0,(int *)) = ag_rp_10(V(0,(int *))); break;
599 case 11: V(0,(double *)) = ag_rp_11(V(0,(double *)), V(2,(double *))); break;
600 case 12: V(0,(double *)) = ag_rp_12(V(1,(double *))); break;
601 case 13: V(0,(double *)) = ag_rp_13(V(0,(int *))); break;
602 case 14: V(0,(double *)) = ag_rp_14(V(0,(double *)), V(1,(int *))); break;
603 case 15: V(0,(double *)) = ag_rp_15(V(0,(int *))); break;
604 case 16: V(0,(double *)) = ag_rp_16(V(0,(int *)), V(1,(double *))); break;
605 }
606 }
607
608 #define TOKEN_NAMES ffcx-t_token_names
609 const char *const ffcx-t_token_names[47] = {
610 "calculator",
611 "white space",
612 "real",
613 "'+'",
614 "'-'",
615 "'*'",
616 "'/'",
617 "unary minus",
618 "calculator",
619 "calculation",
620 "",
621 "'\\n'",
622 "",
623 "",
624 "",
625 "eof",
626 "expression",
627 "name",
628 "'='",
629 "error",
630 "'('",
631 "')'",
632 "",
633 "\"/*\"",
634 "",
635 "",
636 "",
637 "\"*/\"",
638 "",
639 "integer part",
640 "'.'",
641 "fraction part",
642 "",
643 "digit",
644 "",
645 "",
646 "",
647 "'\\n'",
648 "'='",
649 "real",
650 "')'",
651 "'('",
652 "'+'",
653 "'-'",
654 "'*'",
655 "'/'",
656 "",
657
658 };
659
660 #ifndef MISSING_FORMAT
661 #define MISSING_FORMAT "Missing %s"
662 #endif
663 #ifndef UNEXPECTED_FORMAT
664 #define UNEXPECTED_FORMAT "Unexpected %s"
665 #endif
666 #ifndef UNNAMED_TOKEN
667 #define UNNAMED_TOKEN "input"
668 #endif
669
670
671 static void ag_diagnose(void) {
672 int ag_snd = (PCB).sn;
673 int ag_k = ag_sbt[ag_snd];
674
675 if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) {
676 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]);
677 }
678 else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8
679 && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1
680 && *TOKEN_NAMES[ag_tstt[ag_k]]) {
681 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]);
682 }
683 else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) {
684 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]);
685 }
686 else if (isprint((*(PCB).lab)) && (*(PCB).lab) != '\\') {
687 char buf[20];
688 sprintf(buf, "\'%c\'", (char) (*(PCB).lab));
689 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf);
690 }
691 else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN);
692 (PCB).error_message = (PCB).ag_msg;
693
694
695 }
696 static int ag_action_1_r_proc(void);
697 static int ag_action_2_r_proc(void);
698 static int ag_action_3_r_proc(void);
699 static int ag_action_4_r_proc(void);
700 static int ag_action_1_s_proc(void);
701 static int ag_action_3_s_proc(void);
702 static int ag_action_1_proc(void);
703 static int ag_action_2_proc(void);
704 static int ag_action_3_proc(void);
705 static int ag_action_4_proc(void);
706 static int ag_action_5_proc(void);
707 static int ag_action_6_proc(void);
708 static int ag_action_7_proc(void);
709 static int ag_action_8_proc(void);
710 static int ag_action_9_proc(void);
711 static int ag_action_10_proc(void);
712 static int ag_action_11_proc(void);
713 static int ag_action_8_proc(void);
714
715
716 static int (*const ag_r_procs_scan[])(void) = {
717 ag_action_1_r_proc,
718 ag_action_2_r_proc,
719 ag_action_3_r_proc,
720 ag_action_4_r_proc
721 };
722
723 static int (*const ag_s_procs_scan[])(void) = {
724 ag_action_1_s_proc,
725 ag_action_2_r_proc,
726 ag_action_3_s_proc,
727 ag_action_4_r_proc
728 };
729
730 static int (*const ag_gt_procs_scan[])(void) = {
731 ag_action_1_proc,
732 ag_action_2_proc,
733 ag_action_3_proc,
734 ag_action_4_proc,
735 ag_action_5_proc,
736 ag_action_6_proc,
737 ag_action_7_proc,
738 ag_action_8_proc,
739 ag_action_9_proc,
740 ag_action_10_proc,
741 ag_action_11_proc,
742 ag_action_8_proc
743 };
744
745
746 static int ag_action_1_er_proc(void);
747 static int ag_action_2_er_proc(void);
748 static int ag_action_3_er_proc(void);
749 static int ag_action_4_er_proc(void);
750
751 static int (*const ag_er_procs_scan[])(void) = {
752 ag_action_1_er_proc,
753 ag_action_2_er_proc,
754 ag_action_3_er_proc,
755 ag_action_4_er_proc
756 };
757
758
759 static void ag_error_resynch(void) {
760 int ag_k;
761 int ag_ssx = (PCB).ssx;
762
763 ag_diagnose();
764 SYNTAX_ERROR;
765 if ((PCB).exit_flag != AG_RUNNING_CODE) return;
766 while (1) {
767 ag_k = ag_sbt[(PCB).sn];
768 while (ag_tstt[ag_k] != 19 && ag_tstt[ag_k]) ag_k++;
769 if (ag_tstt[ag_k] || (PCB).ssx == 0) break;
770 (PCB).sn = (PCB).ss[--(PCB).ssx];
771 }
772 if (ag_tstt[ag_k] == 0) {
773 (PCB).sn = PCB.ss[(PCB).ssx = ag_ssx];
774 (PCB).exit_flag = AG_SYNTAX_ERROR_CODE;
775 return;
776 }
777 ag_k = ag_sbt[(PCB).sn];
778 while (ag_tstt[ag_k] != 19 && ag_tstt[ag_k]) ag_k++;
779 (PCB).ag_ap = ag_pstt[ag_k];
780 (ag_er_procs_scan[ag_astt[ag_k]])();
781 while (1) {
782 ag_k = ag_sbt[(PCB).sn];
783 while (ag_tstt[ag_k] != (unsigned char) (PCB).token_number && ag_tstt[ag_k])
784 ag_k++;
785 if (ag_tstt[ag_k] && ag_astt[ag_k] != ag_action_10) break;
786 if ((PCB).token_number == 15)
787 {(PCB).exit_flag = AG_SYNTAX_ERROR_CODE; return;}
788 {(PCB).rx = 1; ag_track();}
789 if ((PCB).rx < (PCB).fx) {
790 (PCB).input_code = (PCB).lab[(PCB).rx++];
791 (PCB).token_number = (ffcx-t_token_type) AG_TCV((PCB).input_code);}
792 else {
793 GET_INPUT;
794 (PCB).lab[(PCB).fx++] = (PCB).input_code;
795 (PCB).token_number = (ffcx-t_token_type) AG_TCV((PCB).input_code);
796 (PCB).rx++;
797 }
798 if (ag_key_index[(PCB).sn]) {
799 unsigned ag_k = ag_key_index[(PCB).sn];
800 int ag_ch = CONVERT_CASE((PCB).input_code);
801 if (ag_ch < 255) {
802 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
803 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k);
804 }
805 }
806 }
807 (PCB).rx = 0;
808 }
809
810
811 static int ag_action_10_proc(void) {
812 int ag_t = (PCB).token_number;
813 (PCB).btsx = 0, (PCB).drt = -1;
814 do {
815 ag_track();
816 if ((PCB).rx < (PCB).fx) {
817 (PCB).input_code = (PCB).lab[(PCB).rx++];
818 (PCB).token_number = (ffcx-t_token_type) AG_TCV((PCB).input_code);}
819 else {
820 GET_INPUT;
821 (PCB).lab[(PCB).fx++] = (PCB).input_code;
822 (PCB).token_number = (ffcx-t_token_type) AG_TCV((PCB).input_code);
823 (PCB).rx++;
824 }
825 if (ag_key_index[(PCB).sn]) {
826 unsigned ag_k = ag_key_index[(PCB).sn];
827 int ag_ch = CONVERT_CASE((PCB).input_code);
828 if (ag_ch < 255) {
829 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
830 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k);
831 }
832 }
833 } while ((PCB).token_number == (ffcx-t_token_type) ag_t);
834 (PCB).rx = 0;
835 return 1;
836 }
837
838 static int ag_action_11_proc(void) {
839 int ag_t = (PCB).token_number;
840
841 (PCB).btsx = 0, (PCB).drt = -1;
842 do {
843 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab;
844 (PCB).ssx--;
845 ag_track();
846 ag_ra();
847 if ((PCB).exit_flag != AG_RUNNING_CODE) return 0;
848 (PCB).ssx++;
849 if ((PCB).rx < (PCB).fx) {
850 (PCB).input_code = (PCB).lab[(PCB).rx++];
851 (PCB).token_number = (ffcx-t_token_type) AG_TCV((PCB).input_code);}
852 else {
853 GET_INPUT;
854 (PCB).lab[(PCB).fx++] = (PCB).input_code;
855 (PCB).token_number = (ffcx-t_token_type) AG_TCV((PCB).input_code);
856 (PCB).rx++;
857 }
858 if (ag_key_index[(PCB).sn]) {
859 unsigned ag_k = ag_key_index[(PCB).sn];
860 int ag_ch = CONVERT_CASE((PCB).input_code);
861 if (ag_ch < 255) {
862 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
863 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k);
864 }
865 }
866 }
867 while ((PCB).token_number == (ffcx-t_token_type) ag_t);
868 (PCB).rx = 0;
869 return 1;
870 }
871
872 static int ag_action_3_r_proc(void) {
873 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
874 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
875 (PCB).btsx = 0, (PCB).drt = -1;
876 (PCB).reduction_token = (ffcx-t_token_type) ag_ptt[(PCB).ag_ap];
877 ag_ra();
878 return (PCB).exit_flag == AG_RUNNING_CODE;
879 }
880
881 static int ag_action_3_s_proc(void) {
882 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
883 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
884 (PCB).btsx = 0, (PCB).drt = -1;
885 (PCB).reduction_token = (ffcx-t_token_type) ag_ptt[(PCB).ag_ap];
886 ag_ra();
887 return (PCB).exit_flag == AG_RUNNING_CODE;
888 }
889
890 static int ag_action_4_r_proc(void) {
891 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
892 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
893 (PCB).reduction_token = (ffcx-t_token_type) ag_ptt[(PCB).ag_ap];
894 return 1;
895 }
896
897 static int ag_action_2_proc(void) {
898 (PCB).btsx = 0, (PCB).drt = -1;
899 if ((PCB).ssx >= 128) {
900 (PCB).exit_flag = AG_STACK_ERROR_CODE;
901 PARSER_STACK_OVERFLOW;
902 }
903 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab;
904 (PCB).ss[(PCB).ssx] = (PCB).sn;
905 (PCB).ssx++;
906 (PCB).sn = (PCB).ag_ap;
907 ag_track();
908 return 0;
909 }
910
911 static int ag_action_9_proc(void) {
912 if ((PCB).drt == -1) {
913 (PCB).drt=(PCB).token_number;
914 (PCB).dssx=(PCB).ssx;
915 (PCB).dsn=(PCB).sn;
916 }
917 ag_prot();
918 (PCB).vs[(PCB).ssx] = ag_null_value;
919 (PCB).ss[(PCB).ssx] = (PCB).sn;
920 (PCB).ssx++;
921 (PCB).sn = (PCB).ag_ap;
922 (PCB).rx = 0;
923 return (PCB).exit_flag == AG_RUNNING_CODE;
924 }
925
926 static int ag_action_2_r_proc(void) {
927 (PCB).ssx++;
928 (PCB).sn = (PCB).ag_ap;
929 return 0;
930 }
931
932 static int ag_action_7_proc(void) {
933 --(PCB).ssx;
934 (PCB).rx = 0;
935 (PCB).exit_flag = AG_SUCCESS_CODE;
936 return 0;
937 }
938
939 static int ag_action_1_proc(void) {
940 ag_track();
941 (PCB).exit_flag = AG_SUCCESS_CODE;
942 return 0;
943 }
944
945 static int ag_action_1_r_proc(void) {
946 (PCB).exit_flag = AG_SUCCESS_CODE;
947 return 0;
948 }
949
950 static int ag_action_1_s_proc(void) {
951 (PCB).exit_flag = AG_SUCCESS_CODE;
952 return 0;
953 }
954
955 static int ag_action_4_proc(void) {
956 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
957 (PCB).reduction_token = (ffcx-t_token_type) ag_ptt[(PCB).ag_ap];
958 (PCB).btsx = 0, (PCB).drt = -1;
959 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab;
960 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
961 else (PCB).ss[(PCB).ssx] = (PCB).sn;
962 ag_track();
963 while ((PCB).exit_flag == AG_RUNNING_CODE) {
964 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
965 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
966 do {
967 unsigned ag_tx = (ag_t1 + ag_t2)/2;
968 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
969 else ag_t2 = ag_tx;
970 } while (ag_t1 < ag_t2);
971 (PCB).ag_ap = ag_pstt[ag_t1];
972 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
973 }
974 return 0;
975 }
976
977 static int ag_action_3_proc(void) {
978 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
979 (PCB).btsx = 0, (PCB).drt = -1;
980 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab;
981 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
982 else (PCB).ss[(PCB).ssx] = (PCB).sn;
983 ag_track();
984 (PCB).reduction_token = (ffcx-t_token_type) ag_ptt[(PCB).ag_ap];
985 ag_ra();
986 while ((PCB).exit_flag == AG_RUNNING_CODE) {
987 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
988 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
989 do {
990 unsigned ag_tx = (ag_t1 + ag_t2)/2;
991 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
992 else ag_t2 = ag_tx;
993 } while (ag_t1 < ag_t2);
994 (PCB).ag_ap = ag_pstt[ag_t1];
995 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
996 }
997 return 0;
998 }
999
1000 static int ag_action_8_proc(void) {
1001 int ag_k = ag_sbt[(PCB).sn];
1002 while (ag_tstt[ag_k] != 19 && ag_tstt[ag_k]) ag_k++;
1003 if (ag_tstt[ag_k] == 0) ag_undo();
1004 (PCB).rx = 0;
1005 ag_error_resynch();
1006 return (PCB).exit_flag == AG_RUNNING_CODE;
1007 }
1008
1009 static int ag_action_5_proc(void) {
1010 int ag_sd = ag_fl[(PCB).ag_ap];
1011 (PCB).btsx = 0, (PCB).drt = -1;
1012 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1013 else {
1014 (PCB).ss[(PCB).ssx] = (PCB).sn;
1015 }
1016 (PCB).rx = 0;
1017 (PCB).reduction_token = (ffcx-t_token_type) ag_ptt[(PCB).ag_ap];
1018 ag_ra();
1019 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1020 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
1021 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
1022 do {
1023 unsigned ag_tx = (ag_t1 + ag_t2)/2;
1024 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
1025 else ag_t2 = ag_tx;
1026 } while (ag_t1 < ag_t2);
1027 (PCB).ag_ap = ag_pstt[ag_t1];
1028 if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break;
1029 }
1030 return (PCB).exit_flag == AG_RUNNING_CODE;
1031 }
1032
1033 static int ag_action_6_proc(void) {
1034 int ag_sd = ag_fl[(PCB).ag_ap];
1035 (PCB).reduction_token = (ffcx-t_token_type) ag_ptt[(PCB).ag_ap];
1036 if ((PCB).drt == -1) {
1037 (PCB).drt=(PCB).token_number;
1038 (PCB).dssx=(PCB).ssx;
1039 (PCB).dsn=(PCB).sn;
1040 }
1041 if (ag_sd) {
1042 (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1043 }
1044 else {
1045 ag_prot();
1046 (PCB).vs[(PCB).ssx] = ag_null_value;
1047 (PCB).ss[(PCB).ssx] = (PCB).sn;
1048 }
1049 (PCB).rx = 0;
1050 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1051 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
1052 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
1053 do {
1054 unsigned ag_tx = (ag_t1 + ag_t2)/2;
1055 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
1056 else ag_t2 = ag_tx;
1057 } while (ag_t1 < ag_t2);
1058 (PCB).ag_ap = ag_pstt[ag_t1];
1059 if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break;
1060 }
1061 return (PCB).exit_flag == AG_RUNNING_CODE;
1062 }
1063
1064
1065 static int ag_action_2_er_proc(void) {
1066 (PCB).btsx = 0, (PCB).drt = -1;
1067 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab;
1068 (PCB).ssx++;
1069 (PCB).sn = (PCB).ag_ap;
1070 return 0;
1071 }
1072
1073 static int ag_action_1_er_proc(void) {
1074 (PCB).btsx = 0, (PCB).drt = -1;
1075 (PCB).exit_flag = AG_SUCCESS_CODE;
1076 return 0;
1077 }
1078
1079 static int ag_action_4_er_proc(void) {
1080 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
1081 (PCB).btsx = 0, (PCB).drt = -1;
1082 (PCB).reduction_token = (ffcx-t_token_type) ag_ptt[(PCB).ag_ap];
1083 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1084 else (PCB).ss[(PCB).ssx] = (PCB).sn;
1085 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1086 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
1087 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
1088 do {
1089 unsigned ag_tx = (ag_t1 + ag_t2)/2;
1090 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
1091 else ag_t2 = ag_tx;
1092 } while (ag_t1 < ag_t2);
1093 (PCB).ag_ap = ag_pstt[ag_t1];
1094 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
1095 }
1096 return 0;
1097 }
1098
1099 static int ag_action_3_er_proc(void) {
1100 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
1101 (PCB).btsx = 0, (PCB).drt = -1;
1102 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1103 else (PCB).ss[(PCB).ssx] = (PCB).sn;
1104 (PCB).reduction_token = (ffcx-t_token_type) ag_ptt[(PCB).ag_ap];
1105 ag_ra();
1106 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1107 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
1108 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
1109 do {
1110 unsigned ag_tx = (ag_t1 + ag_t2)/2;
1111 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
1112 else ag_t2 = ag_tx;
1113 } while (ag_t1 < ag_t2);
1114 (PCB).ag_ap = ag_pstt[ag_t1];
1115 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
1116 }
1117 return 0;
1118 }
1119
1120
1121 void init_ffcx-t(void) {
1122 (PCB).rx = (PCB).fx = 0;
1123 (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0;
1124 (PCB).exit_flag = AG_RUNNING_CODE;
1125 (PCB).line = FIRST_LINE;
1126 (PCB).column = FIRST_COLUMN;
1127 (PCB).btsx = 0, (PCB).drt = -1;
1128 }
1129
1130 void ffcx-t(void) {
1131 init_ffcx-t();
1132 (PCB).exit_flag = AG_RUNNING_CODE;
1133 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1134 unsigned ag_t1 = ag_sbt[(PCB).sn];
1135 if (ag_tstt[ag_t1]) {
1136 unsigned ag_t2 = ag_sbe[(PCB).sn] - 1;
1137 if ((PCB).rx < (PCB).fx) {
1138 (PCB).input_code = (PCB).lab[(PCB).rx++];
1139 (PCB).token_number = (ffcx-t_token_type) AG_TCV((PCB).input_code);}
1140 else {
1141 GET_INPUT;
1142 (PCB).lab[(PCB).fx++] = (PCB).input_code;
1143 (PCB).token_number = (ffcx-t_token_type) AG_TCV((PCB).input_code);
1144 (PCB).rx++;
1145 }
1146 if (ag_key_index[(PCB).sn]) {
1147 unsigned ag_k = ag_key_index[(PCB).sn];
1148 int ag_ch = CONVERT_CASE((PCB).input_code);
1149 if (ag_ch < 255) {
1150 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
1151 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k);
1152 }
1153 }
1154 do {
1155 unsigned ag_tx = (ag_t1 + ag_t2)/2;
1156 if (ag_tstt[ag_tx] > (unsigned char)(PCB).token_number)
1157 ag_t1 = ag_tx + 1;
1158 else ag_t2 = ag_tx;
1159 } while (ag_t1 < ag_t2);
1160 if (ag_tstt[ag_t1] != (unsigned char)(PCB).token_number)
1161 ag_t1 = ag_sbe[(PCB).sn];
1162 }
1163 (PCB).ag_ap = ag_pstt[ag_t1];
1164 (ag_gt_procs_scan[ag_astt[ag_t1]])();
1165 }
1166 }
1167
1168