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