Mercurial > ~dholland > hg > ag > index.cgi
comparison tests/agcl/oldagsrc/good/asilbug1.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 VM.SYN | |
3 | |
4 Virtual Machine Compiler | |
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 Function calls | |
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 vmCompile 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 VM.SYN is compiled with the AnaGram parser generator | |
54 yielding VM.H and VM.CPP. | |
55 | |
56 To build VM, compile VM.CPP and VMDEMO.CPP and link them | |
57 with your C++ compiler. | |
58 | |
59 For information about AnaGram, visit http://www.parsifalsoft.com. | |
60 */ | |
61 | |
62 #include <math.h> | |
63 #include "vmdefs.h" // defines external interface | |
64 | |
65 static VirtualMachine *vm; | |
66 | |
67 | |
68 /* | |
69 * AnaGram, A System for Syntax Directed Programming | |
70 * File generated by: ... | |
71 * | |
72 * AnaGram Parsing Engine | |
73 * Copyright 1993-2002 Parsifal Software. All Rights Reserved. | |
74 * | |
75 * This software is provided 'as-is', without any express or implied | |
76 * warranty. In no event will the authors be held liable for any damages | |
77 * arising from the use of this software. | |
78 * | |
79 * Permission is granted to anyone to use this software for any purpose, | |
80 * including commercial applications, and to alter it and redistribute it | |
81 * freely, subject to the following restrictions: | |
82 * | |
83 * 1. The origin of this software must not be misrepresented; you must not | |
84 * claim that you wrote the original software. If you use this software | |
85 * in a product, an acknowledgment in the product documentation would be | |
86 * appreciated but is not required. | |
87 * 2. Altered source versions must be plainly marked as such, and must not be | |
88 * misrepresented as being the original software. | |
89 * 3. This notice may not be removed or altered from any source distribution. | |
90 */ | |
91 | |
92 #ifndef ASILBUG1_H | |
93 #include "asilbug1.h" | |
94 #endif | |
95 | |
96 #ifndef ASILBUG1_H | |
97 #error Mismatched header file | |
98 #endif | |
99 | |
100 #include <ctype.h> | |
101 #include <stdio.h> | |
102 | |
103 #define RULE_CONTEXT (&((PCB).cs[(PCB).ssx])) | |
104 #define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx]) | |
105 #define CONTEXT ((PCB).cs[(PCB).ssx]) | |
106 | |
107 | |
108 | |
109 asil_pcb_type asil_pcb; | |
110 #define PCB asil_pcb | |
111 #define CHANGE_REDUCTION(x) asil_change_reduction(asil_##x##_token) | |
112 int asil_change_reduction(asil_token_type); | |
113 | |
114 | |
115 #line - "asilbug1.syn" | |
116 // begin embedded C | |
117 | |
118 | |
119 int compileStatements(VirtualMachine *v, char *text) { | |
120 vm = v; | |
121 resetCharStack(); | |
122 vmCompile_pcb.pointer = (unsigned char *) text; | |
123 vmCompile(); | |
124 return vmCompile_pcb.exit_flag != AG_SUCCESS_CODE; | |
125 } | |
126 #line - "asilbug1.cpp" | |
127 | |
128 #ifndef CONVERT_CASE | |
129 #define CONVERT_CASE(c) (c) | |
130 #endif | |
131 #ifndef TAB_SPACING | |
132 #define TAB_SPACING 8 | |
133 #endif | |
134 | |
135 #define ag_rp_1(x) (x) | |
136 | |
137 #define ag_rp_2(x) (x) | |
138 | |
139 static double ag_rp_3(double x) { | |
140 #line - "asilbug1.syn" | |
141 if (x) CHANGE_REDUCTION(true_if_clause); | |
142 #line - "asilbug1.cpp" | |
143 } | |
144 | |
145 #define ag_rp_4(k, x) (vm->code(STORE, k), x) | |
146 | |
147 #define ag_rp_5(k, x) (vm->code(ADDM,k), x) | |
148 | |
149 #define ag_rp_6(k, x) (vm->code(SUBM,k), x) | |
150 | |
151 #define ag_rp_7(k, x) (vm->code(MULM,k), x) | |
152 | |
153 #define ag_rp_8(k, x) (vm->code(DIVM,k), x) | |
154 | |
155 #define ag_rp_9(c, x, y) (vm->codeIfElse(c,x,y)) | |
156 | |
157 #define ag_rp_10(x, y) (vm->insertCode(OR, vm->wx - y, y), x) | |
158 | |
159 #define ag_rp_11(x, y) (vm->insertCode(AND, vm->wx - y, y), x) | |
160 | |
161 #define ag_rp_12(x, y) (vm->code(EQ), x) | |
162 | |
163 #define ag_rp_13(x, y) (vm->code(NE), x) | |
164 | |
165 #define ag_rp_14(x, y) (vm->code(LT), x) | |
166 | |
167 #define ag_rp_15(x, y) (vm->code(LE), x) | |
168 | |
169 #define ag_rp_16(x, y) (vm->code(GT), x) | |
170 | |
171 #define ag_rp_17(x, y) (vm->code(GE), x) | |
172 | |
173 #define ag_rp_18(x, y) (vm->code(ADD), x) | |
174 | |
175 #define ag_rp_19(x, y) (vm->code(SUB), x) | |
176 | |
177 #define ag_rp_20(x, y) (vm->code(MUL), x) | |
178 | |
179 #define ag_rp_21(x, y) (vm->code(DIV), x) | |
180 | |
181 #define ag_rp_22(x, y) (vm->code(POW), x) | |
182 | |
183 #define ag_rp_23(x) (vm->code(PUSHI, x)) | |
184 | |
185 #define ag_rp_24(k) (vm->code(PUSH, k)) | |
186 | |
187 #define ag_rp_25(x) (vm->code(LOG), x) | |
188 | |
189 #define ag_rp_26(x) (vm->code(EXP), x) | |
190 | |
191 #define ag_rp_28(x) (vm->code(NEG), x) | |
192 | |
193 #define ag_rp_29(x) (x) | |
194 | |
195 #define ag_rp_30(x) (vm->code(NOT), x) | |
196 | |
197 #define ag_rp_31(x, e) (x*pow(10,e)) | |
198 | |
199 #define ag_rp_32(x, e) (x*pow(10,-e)) | |
200 | |
201 #define ag_rp_33(i, f) (i+f) | |
202 | |
203 #define ag_rp_34(f) (f) | |
204 | |
205 #define ag_rp_35(d) (d-'0') | |
206 | |
207 #define ag_rp_36(x, d) (10*x + d-'0') | |
208 | |
209 #define ag_rp_37(d) ((d-'0')/10.) | |
210 | |
211 #define ag_rp_38(d, f) ((d-'0' + f)/10.) | |
212 | |
213 #define ag_rp_39(d) (d-'0') | |
214 | |
215 #define ag_rp_40(x, d) (10*x + d-'0') | |
216 | |
217 #define ag_rp_41(k) (locateVariable(k)) | |
218 | |
219 #define ag_rp_42(c) (pushChar(c), 1) | |
220 | |
221 #define ag_rp_43(k, c) (pushChar(c), k+1) | |
222 | |
223 | |
224 #define READ_COUNTS | |
225 #define WRITE_COUNTS | |
226 #undef V | |
227 #define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i])) | |
228 #undef VS | |
229 #define VS(i) (PCB).vs[(PCB).ssx + i] | |
230 | |
231 #ifndef GET_CONTEXT | |
232 #define GET_CONTEXT CONTEXT = (PCB).input_context | |
233 #endif | |
234 | |
235 typedef enum { | |
236 ag_action_1, | |
237 ag_action_2, | |
238 ag_action_3, | |
239 ag_action_4, | |
240 ag_action_5, | |
241 ag_action_6, | |
242 ag_action_7, | |
243 ag_action_8, | |
244 ag_action_9, | |
245 ag_action_10, | |
246 ag_action_11, | |
247 ag_action_12 | |
248 } ag_parser_action; | |
249 | |
250 | |
251 #ifndef NULL_VALUE_INITIALIZER | |
252 #define NULL_VALUE_INITIALIZER = { 0 } | |
253 #endif | |
254 | |
255 static asil_vs_type const ag_null_value NULL_VALUE_INITIALIZER; | |
256 | |
257 static const unsigned char ag_rpx[] = { | |
258 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, | |
259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
260 0, 0, 0, 0, 3, 0, 4, 5, 6, 7, 8, 0, 9, 0, 10, 0, 11, 0, | |
261 12, 13, 0, 14, 15, 16, 17, 0, 18, 19, 0, 20, 21, 0, 22, 23, 24, 25, | |
262 26, 27, 28, 29, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
263 0, 31, 32, 33, 0, 0, 0, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 | |
264 }; | |
265 | |
266 static const unsigned char ag_key_itt[] = { | |
267 0 | |
268 }; | |
269 | |
270 static const unsigned short ag_key_pt[] = { | |
271 0 | |
272 }; | |
273 | |
274 static const unsigned char ag_key_ch[] = { | |
275 0, 42, 47,255, 47,101,105,108,119,255, 42,255, 42, 61,255, 42, 47, 61, | |
276 255,108,120,255, 33, 38, 42, 43, 45, 47, 60, 61, 62,101,105,108,119,124, | |
277 255,101,105,108,119,255, 42, 47,255, 33, 38, 42, 47, 60, 61, 62,124,255, | |
278 42, 47,255, 47,101,108,255, 42, 47,255, 47,255,101,108,255, 33, 38, 42, | |
279 60, 61, 62,124,255, 33, 38, 60, 61, 62,124,255, 33, 38, 61,124,255, 42, | |
280 61,255, 42, 47, 61,255, 33, 38, 42, 43, 45, 47, 60, 61, 62,124,255, 38, | |
281 124,255,124,255, 42, 47,255,108,120,255, 47,101,105,108,119,255, 42, 61, | |
282 255, 33, 38, 42, 43, 45, 47, 60, 61, 62,124,255,105,119,255,108,120,255, | |
283 101,105,108,119,255, 42, 47,255, 33, 38, 42, 47, 60, 61, 62,101,105,108, | |
284 119,124,255, 42, 47,255, 47,105,119,255 | |
285 }; | |
286 | |
287 static const unsigned char ag_key_act[] = { | |
288 0,0,0,4,2,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,2,3,3,3, | |
289 3,4,3,3,3,3,4,0,0,4,3,3,3,2,3,3,3,3,4,0,0,4,2,3,3,4,0,0,4,2,4,3,3,4,3, | |
290 3,3,3,3,3,3,4,3,3,3,3,3,3,4,3,3,3,3,4,0,0,4,0,0,0,4,3,3,2,3,3,2,3,3,3, | |
291 3,4,3,3,4,3,4,0,0,4,3,3,4,2,2,3,3,3,4,0,0,4,3,3,2,3,3,3,3,3,3,3,4,3,3, | |
292 4,3,3,4,2,3,3,3,4,0,0,4,3,3,3,2,3,3,3,3,3,3,3,3,4,0,0,4,2,3,3,4 | |
293 }; | |
294 | |
295 static const unsigned char ag_key_parm[] = { | |
296 0, 68, 73, 0, 0,129,105,128,102, 0, 72, 0,126,110, 0, 68, 73,111, | |
297 0,104,129, 0,117,115, 0,108,109, 0,119,116,121, 0,105,128,102,114, | |
298 0,129,105,128,102, 0, 68, 73, 0,117,115,126, 0,119,116,121,114, 0, | |
299 68, 73, 0, 0,129,128, 0, 68, 73, 0, 0, 0,129,128, 0,117,115,126, | |
300 119,116,121,114, 0,117,115,119,116,121,114, 0,117,115,116,114, 0,126, | |
301 110, 0, 68, 73,111, 0,117,115, 0,108,109, 0,119,116,121,114, 0,115, | |
302 114, 0,114, 0, 68, 73, 0,104,129, 0, 0, 0,105,128,102, 0,126,110, | |
303 0,117,115, 0,108,109,111,119,116,121,114, 0,105,102, 0,104,129, 0, | |
304 0,105,128,102, 0, 68, 73, 0,117,115,126, 0,119,116,121,129,105,128, | |
305 102,114, 0, 68, 73, 0, 0,105,102, 0 | |
306 }; | |
307 | |
308 static const unsigned char ag_key_jmp[] = { | |
309 0, 0, 0, 0, 1, 0, 3, 5, 8, 0, 13, 0, 0, 0, 0, 0, 0, 0, | |
310 0, 29, 32, 0, 15, 17, 12, 19, 21, 15, 23, 25, 27, 19, 34, 36, 39, 44, | |
311 0, 46, 49, 51, 54, 0, 0, 0, 0, 59, 61, 63, 42, 65, 67, 69, 71, 0, | |
312 0, 0, 0, 54, 73, 76, 0, 0, 0, 0, 61, 0, 79, 82, 0, 85, 87, 89, | |
313 91, 93, 95, 97, 0, 99,101,103,105,107,109, 0,111,113,115,117, 0, 0, | |
314 0, 0, 0, 0, 0, 0,119,121, 89,123,125, 92,127,129,131,133, 0,135, | |
315 137, 0,139, 0, 0, 0, 0,141,144, 0,112,115,146,148,151, 0, 0, 0, | |
316 0,156,158,124,160,162,164,166,168,170,172, 0,174,176, 0,181,184, 0, | |
317 141,186,188,191, 0, 0, 0, 0,196,198,200,149,202,204,206,208,211,213, | |
318 216,221, 0, 0, 0, 0,165,223,225, 0 | |
319 }; | |
320 | |
321 static const unsigned char ag_key_index[] = { | |
322 4, 0, 10, 22, 37, 0, 0, 10, 10, 0, 45, 45, 57, 57, 57, 57, 64, 64, | |
323 45, 66, 66, 66, 66, 0, 0, 69, 77, 77, 77, 84, 96,107, 64, 64, 96,110, | |
324 0, 0, 4,118,127,138, 37, 0, 0, 37, 0, 37, 0, 45, 45, 0, 0, 66, | |
325 66, 57, 66, 57, 66, 57, 66, 66, 66, 57, 66, 57, 66, 57, 66, 57, 66, 57, | |
326 66, 57, 66, 57, 66, 57, 66, 57, 66, 66, 0,138, 57, 66, 57, 66, 57, 66, | |
327 57, 66, 57, 66, 64, 64, 57, 64, 64, 64, 0, 0, 0, 0, 0,144,144, 0, | |
328 0, 37,118, 0, 0,152, 0, 0, 77, 77, 77, 77, 77, 77, 77, 77, 84,107, | |
329 0, 0, 0, 0, 0,138,138, 4, 37,138,168,138, 4, 37,138, 45, 45, 66, | |
330 144,138 | |
331 }; | |
332 | |
333 static const unsigned char ag_key_ends[] = { | |
334 120,112,0, 102,0, 111,103,0, 104,105,108,101,0, 47,0, 61,0, | |
335 38,0, 61,0, 61,0, 61,0, 61,0, 61,0, 115,101,0, 112,0, 102,0, | |
336 111,103,0, 104,105,108,101,0, 124,0, 120,112,0, 102,0, 111,103,0, | |
337 104,105,108,101,0, 61,0, 38,0, 42,0, 61,0, 61,0, 61,0, 124,0, | |
338 120,112,0, 111,103,0, 120,112,0, 111,103,0, 61,0, 38,0, 42,0, | |
339 61,0, 61,0, 61,0, 124,0, 61,0, 38,0, 61,0, 61,0, 61,0, 124,0, | |
340 61,0, 38,0, 61,0, 124,0, 61,0, 38,0, 61,0, 61,0, 61,0, 61,0, | |
341 61,0, 124,0, 38,0, 124,0, 124,0, 115,101,0, 112,0, 102,0, | |
342 111,103,0, 104,105,108,101,0, 61,0, 38,0, 61,0, 61,0, 61,0, | |
343 61,0, 61,0, 61,0, 124,0, 102,0, 104,105,108,101,0, 115,101,0, | |
344 112,0, 102,0, 111,103,0, 104,105,108,101,0, 61,0, 38,0, 42,0, | |
345 61,0, 61,0, 61,0, 120,112,0, 102,0, 111,103,0, 104,105,108,101,0, | |
346 124,0, 102,0, 104,105,108,101,0, | |
347 }; | |
348 | |
349 #define AG_TCV(x) ag_tcv[(x)] | |
350 | |
351 static const unsigned char ag_tcv[] = { | |
352 7, 93, 93, 93, 93, 93, 93, 93, 93, 92, 77, 92, 92, 92, 93, 93, 93, 93, | |
353 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 92,130,131,131, | |
354 131,131,131,131, 97, 96,124,122,131,123,132,125,133,133,133,133,133,133, | |
355 133,133,133,133,112,100,118,106,120,113,131,134,134,134,134,135,134,134, | |
356 134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134, | |
357 134,131,131,131,131,134,131,134,134,134,134,135,134,134,134,134,134,134, | |
358 134,134,134,134,134,134,134,134,134,134,134,134,134,134,134, 99,131, 98, | |
359 131, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, | |
360 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, | |
361 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, | |
362 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, | |
363 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, | |
364 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, | |
365 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, | |
366 93, 93, 93, 93 | |
367 }; | |
368 | |
369 #ifndef SYNTAX_ERROR | |
370 #define SYNTAX_ERROR fprintf(stderr,"%s, line %d, column %d\n", \ | |
371 (PCB).error_message, (PCB).line, (PCB).column) | |
372 #endif | |
373 | |
374 #ifndef FIRST_LINE | |
375 #define FIRST_LINE 1 | |
376 #endif | |
377 | |
378 #ifndef FIRST_COLUMN | |
379 #define FIRST_COLUMN 1 | |
380 #endif | |
381 | |
382 #ifndef PARSER_STACK_OVERFLOW | |
383 #define PARSER_STACK_OVERFLOW {fprintf(stderr, \ | |
384 "\nParser stack overflow, line %d, column %d\n",\ | |
385 (PCB).line, (PCB).column);} | |
386 #endif | |
387 | |
388 #ifndef REDUCTION_TOKEN_ERROR | |
389 #define REDUCTION_TOKEN_ERROR {fprintf(stderr, \ | |
390 "\nReduction token error, line %d, column %d\n", \ | |
391 (PCB).line, (PCB).column);} | |
392 #endif | |
393 | |
394 | |
395 #ifndef INPUT_CODE | |
396 #define INPUT_CODE(T) (T) | |
397 #endif | |
398 | |
399 typedef enum | |
400 {ag_accept_key, ag_set_key, ag_jmp_key, ag_end_key, ag_no_match_key, | |
401 ag_cf_accept_key, ag_cf_set_key, ag_cf_end_key} key_words; | |
402 | |
403 static void ag_get_key_word(int ag_k) { | |
404 int ag_save = (int) ((PCB).la_ptr - (PCB).pointer); | |
405 const unsigned char *ag_p; | |
406 int ag_ch; | |
407 while (1) { | |
408 switch (ag_key_act[ag_k]) { | |
409 case ag_cf_end_key: { | |
410 const unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k]; | |
411 do { | |
412 if ((ag_ch = *sp++) == 0) { | |
413 int ag_k1 = ag_key_parm[ag_k]; | |
414 int ag_k2 = ag_key_pt[ag_k1]; | |
415 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) goto ag_fail; | |
416 (PCB).token_number = (asil_token_type) ag_key_pt[ag_k1 + 1]; | |
417 return; | |
418 } | |
419 } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch); | |
420 goto ag_fail; | |
421 } | |
422 case ag_end_key: { | |
423 const unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k]; | |
424 do { | |
425 if ((ag_ch = *sp++) == 0) { | |
426 (PCB).token_number = (asil_token_type) ag_key_parm[ag_k]; | |
427 return; | |
428 } | |
429 } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch); | |
430 } | |
431 case ag_no_match_key: | |
432 ag_fail: | |
433 (PCB).la_ptr = (PCB).pointer + ag_save; | |
434 return; | |
435 case ag_cf_set_key: { | |
436 int ag_k1 = ag_key_parm[ag_k]; | |
437 int ag_k2 = ag_key_pt[ag_k1]; | |
438 ag_k = ag_key_jmp[ag_k]; | |
439 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) break; | |
440 ag_save = (int) ((PCB).la_ptr - (PCB).pointer); | |
441 (PCB).token_number = (asil_token_type) ag_key_pt[ag_k1+1]; | |
442 break; | |
443 } | |
444 case ag_set_key: | |
445 ag_save = (int) ((PCB).la_ptr - (PCB).pointer); | |
446 (PCB).token_number = (asil_token_type) ag_key_parm[ag_k]; | |
447 case ag_jmp_key: | |
448 ag_k = ag_key_jmp[ag_k]; | |
449 break; | |
450 case ag_accept_key: | |
451 (PCB).token_number = (asil_token_type) ag_key_parm[ag_k]; | |
452 return; | |
453 case ag_cf_accept_key: { | |
454 int ag_k1 = ag_key_parm[ag_k]; | |
455 int ag_k2 = ag_key_pt[ag_k1]; | |
456 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) | |
457 (PCB).la_ptr = (PCB).pointer + ag_save; | |
458 else (PCB).token_number = (asil_token_type) ag_key_pt[ag_k1+1]; | |
459 return; | |
460 } | |
461 } | |
462 ag_ch = CONVERT_CASE(*(PCB).la_ptr++); | |
463 ag_p = &ag_key_ch[ag_k]; | |
464 if (ag_ch <= 255) while (*ag_p < ag_ch) ag_p++; | |
465 if (ag_ch > 255 || *ag_p != ag_ch) { | |
466 (PCB).la_ptr = (PCB).pointer + ag_save; | |
467 return; | |
468 } | |
469 ag_k = (int) (ag_p - ag_key_ch); | |
470 } | |
471 } | |
472 | |
473 | |
474 #ifndef AG_NEWLINE | |
475 #define AG_NEWLINE 10 | |
476 #endif | |
477 | |
478 #ifndef AG_RETURN | |
479 #define AG_RETURN 13 | |
480 #endif | |
481 | |
482 #ifndef AG_FORMFEED | |
483 #define AG_FORMFEED 12 | |
484 #endif | |
485 | |
486 #ifndef AG_TABCHAR | |
487 #define AG_TABCHAR 9 | |
488 #endif | |
489 | |
490 static void ag_track(void) { | |
491 int ag_k = (int) ((PCB).la_ptr - (PCB).pointer); | |
492 while (ag_k--) { | |
493 switch (*(PCB).pointer++) { | |
494 case AG_NEWLINE: | |
495 (PCB).column = 1, (PCB).line++; | |
496 case AG_RETURN: | |
497 case AG_FORMFEED: | |
498 break; | |
499 case AG_TABCHAR: | |
500 (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING); | |
501 break; | |
502 default: | |
503 (PCB).column++; | |
504 } | |
505 } | |
506 } | |
507 | |
508 | |
509 static void ag_prot(void) { | |
510 int ag_k; | |
511 ag_k = 128 - ++(PCB).btsx; | |
512 if (ag_k <= (PCB).ssx) { | |
513 (PCB).exit_flag = AG_STACK_ERROR_CODE; | |
514 PARSER_STACK_OVERFLOW; | |
515 return; | |
516 } | |
517 (PCB).bts[(PCB).btsx] = (PCB).sn; | |
518 (PCB).bts[ag_k] = (PCB).ssx; | |
519 (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx]; | |
520 (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx]; | |
521 } | |
522 | |
523 static void ag_undo(void) { | |
524 if ((PCB).drt == -1) return; | |
525 while ((PCB).btsx) { | |
526 int ag_k = 128 - (PCB).btsx; | |
527 (PCB).sn = (PCB).bts[(PCB).btsx--]; | |
528 (PCB).ssx = (PCB).bts[ag_k]; | |
529 (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k]; | |
530 (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k]; | |
531 } | |
532 (PCB).token_number = (asil_token_type) (PCB).drt; | |
533 (PCB).ssx = (PCB).dssx; | |
534 (PCB).sn = (PCB).dsn; | |
535 (PCB).drt = -1; | |
536 } | |
537 | |
538 | |
539 | |
540 static const int ag_rtt[] = { | |
541 32, 31, 0 | |
542 }; | |
543 | |
544 static const unsigned char ag_tstt[] = { | |
545 135,134,133,132,130,129,128,123,122,105,102,100,99,97,92,77,73,68,7,0,1,94, | |
546 95, | |
547 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,100,99,98,97,96, | |
548 93,92,77,0,75,76, | |
549 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,100,99,98,97,96, | |
550 93,92,77,72,0,70,71, | |
551 92,77,73,68,0,1, | |
552 135,134,133,132,130,129,128,123,122,105,102,100,99,97,7,0,2,3,4,5,6,12,15, | |
553 17,18,19,23,24,25,28,30,31,32,34,35,41,44,46,48,51,56,57,58,59,62,64,65, | |
554 66,78,82,87,107,127, | |
555 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,100,99,98,97,96, | |
556 93,92,0, | |
557 77,0, | |
558 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,100,99,98,97,96, | |
559 93,92,77,0, | |
560 72,0, | |
561 133,0,84, | |
562 135,133,132,126,125,124,123,122,121,120,119,118,117,116,115,114,113,112,100, | |
563 96,92,77,73,68,0,85, | |
564 135,0, | |
565 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,100,99, | |
566 98,97,96,92,77,73,68,0,1,94,95, | |
567 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,100,99, | |
568 98,97,96,92,77,73,68,0,1,94,95, | |
569 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,100,99, | |
570 98,97,96,92,77,73,68,0,1,94,95, | |
571 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,97,96, | |
572 92,77,73,68,0,1,94,95, | |
573 97,92,77,73,68,0,1,94,95, | |
574 97,92,77,73,68,0,1,94,95, | |
575 126,125,124,123,122,121,120,119,118,117,116,115,114,113,112,100,96,92,77,73, | |
576 68,0,1,94,95, | |
577 135,134,133,132,130,129,128,123,122,97,0,2,3,12,57,58,62,64,65,66,78,82,87, | |
578 107,127, | |
579 135,134,133,132,130,129,128,123,122,97,0,2,3,12,57,58,62,64,65,66,78,82,87, | |
580 107,127, | |
581 135,134,133,132,130,129,128,123,122,97,0,2,3,12,57,58,62,64,65,66,78,82,87, | |
582 107,127, | |
583 135,134,133,132,130,129,128,123,122,97,0,2,3,12,23,35,41,44,46,48,51,56,57, | |
584 58,59,62,64,65,66,78,82,87,107,127, | |
585 97,0,12, | |
586 97,0,12, | |
587 126,0,63, | |
588 125,124,0,60,61, | |
589 123,122,0,57,58, | |
590 121,120,119,118,0,52,53,54,55, | |
591 117,116,0,49,50, | |
592 135,134,133,0, | |
593 115,0,47, | |
594 97,92,77,73,68,0,1,94,95, | |
595 97,92,77,73,68,0,1,94,95, | |
596 126,125,124,123,122,121,120,119,118,117,116,115,114,113,112,111,110,109,108, | |
597 106,100,96,92,77,73,68,0,1,94,95, | |
598 114,113,0,42,45, | |
599 97,0,12, | |
600 97,0,10,12, | |
601 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,105,102, | |
602 100,99,98,97,92,77,73,68,0,1,94,95, | |
603 135,134,133,132,130,129,128,123,122,105,104,103,102,101,100,99,98,97,92,77, | |
604 73,68,7,0,1,94,95, | |
605 111,110,109,108,106,0,36,37,38,39,40, | |
606 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,105,102,100,99, | |
607 97,0,8,10,11,12,13,15,20,21,22,28,34,36,42,43,52,54,57,58,60,61,66,79, | |
608 83,86,90,91, | |
609 135,134,133,132,130,129,128,123,122,105,102,100,99,97,0,2,3,12,15,17,18,19, | |
610 23,24,25,28,30,31,32,34,35,41,44,46,48,51,56,57,58,59,62,64,65,66,78,82, | |
611 87,107,127, | |
612 103,101,0,26, | |
613 103,101,0,26, | |
614 135,134,133,132,130,129,128,123,122,105,102,100,99,98,97,0,2,3,5,12,15,16, | |
615 17,18,19,23,24,25,28,30,31,32,34,35,41,44,46,48,51,56,57,58,59,62,64,65, | |
616 66,78,82,87,107,127, | |
617 100,0,24, | |
618 135,134,133,132,130,129,128,123,122,105,102,100,99,97,0,2,3,12,15,17,18,19, | |
619 23,24,25,28,30,31,32,34,35,41,44,46,48,51,56,57,58,59,62,64,65,66,78,82, | |
620 87,107,127, | |
621 7,0, | |
622 133,0,84, | |
623 133,0,84, | |
624 133,123,122,0,80, | |
625 96,0,14, | |
626 135,134,133,132,130,129,128,123,122,97,0,2,3,12,23,35,41,44,46,48,51,56,57, | |
627 58,59,62,64,65,66,78,82,87,107,127, | |
628 135,134,133,132,130,129,128,123,122,97,0,2,3,12,23,35,41,44,46,48,51,56,57, | |
629 58,59,62,64,65,66,78,82,87,107,127, | |
630 135,134,133,132,130,129,128,123,122,97,92,77,73,68,0,1,94,95, | |
631 135,134,133,132,130,129,128,123,122,97,0,2,3,12,57,58,59,62,64,65,66,78,82, | |
632 87,107,127, | |
633 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,100,99, | |
634 98,97,96,92,77,73,68,0,1,94,95, | |
635 135,134,133,132,130,129,128,123,122,97,0,2,3,12,57,58,59,62,64,65,66,78,82, | |
636 87,107,127, | |
637 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,100,99, | |
638 98,97,96,92,77,73,68,0,1,94,95, | |
639 135,134,133,132,130,129,128,123,122,97,0,2,3,12,57,58,59,62,64,65,66,78,82, | |
640 87,107,127, | |
641 135,134,133,132,130,129,128,123,122,97,0,2,3,12,56,57,58,59,62,64,65,66,78, | |
642 82,87,107,127, | |
643 135,134,133,132,130,129,128,123,122,97,0,2,3,12,56,57,58,59,62,64,65,66,78, | |
644 82,87,107,127, | |
645 135,134,133,132,130,129,128,123,122,97,92,77,73,68,0,1,94,95, | |
646 135,134,133,132,130,129,128,123,122,97,0,2,3,12,51,56,57,58,59,62,64,65,66, | |
647 78,82,87,107,127, | |
648 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,100,99, | |
649 98,97,96,92,77,73,68,0,1,94,95, | |
650 135,134,133,132,130,129,128,123,122,97,0,2,3,12,51,56,57,58,59,62,64,65,66, | |
651 78,82,87,107,127, | |
652 135,134,133,132,130,129,128,123,122,97,92,77,73,68,0,1,94,95, | |
653 135,134,133,132,130,129,128,123,122,97,0,2,3,12,51,56,57,58,59,62,64,65,66, | |
654 78,82,87,107,127, | |
655 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,100,99, | |
656 98,97,96,92,77,73,68,0,1,94,95, | |
657 135,134,133,132,130,129,128,123,122,97,0,2,3,12,51,56,57,58,59,62,64,65,66, | |
658 78,82,87,107,127, | |
659 135,134,133,132,130,129,128,123,122,97,92,77,73,68,0,1,94,95, | |
660 135,134,133,132,130,129,128,123,122,97,0,2,3,12,48,51,56,57,58,59,62,64,65, | |
661 66,78,82,87,107,127, | |
662 135,134,133,132,130,129,128,123,122,97,92,77,73,68,0,1,94,95, | |
663 135,134,133,132,130,129,128,123,122,97,0,2,3,12,48,51,56,57,58,59,62,64,65, | |
664 66,78,82,87,107,127, | |
665 135,134,133,132,130,129,128,123,122,97,92,77,73,68,0,1,94,95, | |
666 135,134,133,132,130,129,128,123,122,97,0,2,3,12,46,48,51,56,57,58,59,62,64, | |
667 65,66,78,82,87,107,127, | |
668 135,134,133,132,130,129,128,123,122,97,92,77,73,68,0,1,94,95, | |
669 135,134,133,132,130,129,128,123,122,97,0,2,3,12,44,46,48,51,56,57,58,59,62, | |
670 64,65,66,78,82,87,107,127, | |
671 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,100,99, | |
672 98,97,96,92,77,73,68,0,1,94,95, | |
673 135,134,133,132,130,129,128,123,122,97,0,2,3,12,23,35,41,44,46,48,51,56,57, | |
674 58,59,62,64,65,66,78,82,87,107,127, | |
675 135,134,133,132,130,129,128,123,122,97,0,2,3,12,23,35,41,44,46,48,51,56,57, | |
676 58,59,62,64,65,66,78,82,87,107,127, | |
677 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,97,96,0,8,10,12, | |
678 13,36,42,43,52,54,57,58,60,61,66,79,83,86,90,91, | |
679 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,105,102,100,99, | |
680 97,0,8,10,11,12,13,15,21,22,28,34,36,42,43,52,54,57,58,60,61,66,79,83, | |
681 86,90,91, | |
682 135,134,133,132,130,129,128,123,122,97,92,77,73,68,0,1,94,95, | |
683 135,134,133,132,130,129,128,123,122,97,0,2,3,12,23,35,41,44,46,48,51,56,57, | |
684 58,59,62,64,65,66,78,82,87,107,127, | |
685 135,134,133,132,130,129,128,123,122,97,92,77,73,68,0,1,94,95, | |
686 135,134,133,132,130,129,128,123,122,97,0,2,3,12,23,35,41,44,46,48,51,56,57, | |
687 58,59,62,64,65,66,78,82,87,107,127, | |
688 135,134,133,132,130,129,128,123,122,97,92,77,73,68,0,1,94,95, | |
689 135,134,133,132,130,129,128,123,122,97,0,2,3,12,23,35,41,44,46,48,51,56,57, | |
690 58,59,62,64,65,66,78,82,87,107,127, | |
691 135,134,133,132,130,129,128,123,122,97,92,77,73,68,0,1,94,95, | |
692 135,134,133,132,130,129,128,123,122,97,0,2,3,12,23,35,41,44,46,48,51,56,57, | |
693 58,59,62,64,65,66,78,82,87,107,127, | |
694 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,100,99, | |
695 98,97,96,92,77,73,68,0,1,94,95, | |
696 135,134,133,132,130,129,128,123,122,97,0,2,3,12,23,35,41,44,46,48,51,56,57, | |
697 58,59,62,64,65,66,78,82,87,107,127, | |
698 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,100,99,98,97,96, | |
699 92,77,73,68,0,1,94,95, | |
700 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,100,99,98,97,96, | |
701 92,77,73,68,0,1,94,95, | |
702 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,100,99, | |
703 98,97,96,92,77,73,68,0,1,94,95, | |
704 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,100,99,98,97,96, | |
705 92,77,73,68,0,1,94,95, | |
706 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,100,99,98,97,96, | |
707 92,77,73,68,0,1,94,95, | |
708 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,100,99,98,97,96, | |
709 92,77,73,68,0,1,94,95, | |
710 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,99,98,97,0,8,10, | |
711 11,12,13,15,36,42,43,52,54,57,58,60,61,66,79,83,86,90,91, | |
712 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,99,97,0,10,11, | |
713 12,15,36,42,43,52,54,57,58,60,61,66,79,83,86,90,91, | |
714 97,0,10,12, | |
715 97,0,10,12, | |
716 100,0,24, | |
717 104,0,33, | |
718 104,0,33, | |
719 103,101,0,27,29, | |
720 103,101,0,27,29, | |
721 135,134,133,132,130,129,128,123,122,105,102,100,99,98,97,0,2,3,12,15,16,17, | |
722 18,19,23,24,25,28,30,31,32,34,35,41,44,46,48,51,56,57,58,59,62,64,65,66, | |
723 78,82,87,107,127, | |
724 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,105,104, | |
725 103,102,101,100,99,98,97,96,92,77,73,68,7,0,1,94,95, | |
726 133,0,81, | |
727 133,0,81, | |
728 135,134,133,132,131,130,129,128,126,125,124,123,122,121,120,119,118,117,116, | |
729 115,114,113,112,106,105,102,100,99,98,97,96,92,77,73,68,0,1,94,95, | |
730 96,0,14, | |
731 96,0,14, | |
732 125,124,0,60,61, | |
733 125,124,0,60,61, | |
734 123,122,0,57,58, | |
735 123,122,0,57,58, | |
736 123,122,0,57,58, | |
737 123,122,0,57,58, | |
738 121,120,119,118,0,52,53,54,55, | |
739 121,120,119,118,0,52,53,54,55, | |
740 117,116,0,49,50, | |
741 115,0,47, | |
742 112,0,43, | |
743 96,0,14, | |
744 96,0,14, | |
745 98,0,16, | |
746 98,0,16, | |
747 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,105,102,100,99, | |
748 97,0,8,10,11,12,13,15,20,21,22,28,34,36,42,43,52,54,57,58,60,61,66,79, | |
749 83,86,90,91, | |
750 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,105,102,100,99, | |
751 97,0,8,10,11,12,13,15,21,22,28,34,36,42,43,52,54,57,58,60,61,66,79,83, | |
752 86,90,91, | |
753 135,134,133,132,131,130,129,128,125,124,123,122,120,118,113,112,106,105,102, | |
754 100,99,97,92,77,73,68,0,1,94,95, | |
755 135,134,133,132,130,129,128,123,122,105,102,100,99,97,0,2,3,12,15,17,18,19, | |
756 23,24,25,28,30,31,32,34,35,41,44,46,48,51,56,57,58,59,62,64,65,66,78,82, | |
757 87,107,127, | |
758 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,105,102,100,99, | |
759 97,0,8,10,11,12,13,15,20,21,22,28,34,36,42,43,52,54,57,58,60,61,66,79, | |
760 83,86,90,91, | |
761 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,105,102,100,99, | |
762 97,92,77,73,68,0,1,94,95, | |
763 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,105,102,100,99, | |
764 97,0,8,10,11,12,13,15,20,21,22,28,34,36,42,43,52,54,57,58,60,61,66,79, | |
765 83,86,90,91, | |
766 135,134,133,132,130,129,128,123,122,105,102,100,99,97,92,77,73,68,0,1,94,95, | |
767 135,134,133,132,130,129,128,123,122,105,102,100,99,97,0,2,3,12,15,17,18,19, | |
768 23,24,25,28,30,31,32,34,35,41,44,46,48,51,56,57,58,59,62,64,65,66,78,82, | |
769 87,107,127, | |
770 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,105,102,100,99, | |
771 97,0,8,10,11,12,13,15,20,21,22,28,34,36,42,43,52,54,57,58,60,61,66,79, | |
772 83,86,90,91, | |
773 133,0, | |
774 133,0, | |
775 135,134,133,132,130,129,128,123,122,97,0,2,3,12,35,41,44,46,48,51,56,57,58, | |
776 59,62,64,65,66,78,82,87,107,127, | |
777 104,0,33, | |
778 135,134,133,132,131,130,125,124,123,122,120,118,113,112,106,105,102,100,99, | |
779 97,0,8,10,11,12,13,15,20,21,22,28,34,36,42,43,52,54,57,58,60,61,66,79, | |
780 83,86,90,91, | |
781 | |
782 }; | |
783 | |
784 | |
785 static unsigned const char ag_astt[2991] = { | |
786 8,8,8,8,8,8,8,8,8,8,8,8,8,8,1,1,1,1,8,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
787 1,1,1,1,1,1,1,1,8,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8,7, | |
788 1,1,9,9,1,1,5,3,2,2,2,1,1,1,1,1,1,1,1,1,1,1,8,7,2,1,0,1,1,1,1,2,2,2,1,2,1, | |
789 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9, | |
790 9,9,9,9,9,9,9,9,9,5,3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5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,1,5,6, | |
873 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, | |
874 175,175,1,2,177,175, | |
875 105,105,98,9,12,16,17,14,13,32,33,39,38,15,48,4,69,40,0,47,48,22,45,16,16, | |
876 16,46,16,44,37,43,42,41,36,46,35,31,29,28,27,26,20,21,26,25,24,23,19,11, | |
877 10,30,34,18, | |
878 84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,86, | |
879 87,6, | |
880 79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,81, | |
881 82,8, | |
882 49,9,97, | |
883 94,99,50,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,10, | |
884 96, | |
885 51,88, | |
886 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
887 176,176,176,3,3,1,2,12,3,3,212, | |
888 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
889 176,176,176,3,3,1,2,13,3,3,204, | |
890 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
891 176,176,176,3,3,1,2,14,3,3,205, | |
892 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
893 3,3,1,2,15,3,3,179, | |
894 176,3,3,1,2,16,3,3,211, | |
895 176,3,3,1,2,17,3,3,210, | |
896 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,3,3,1,2, | |
897 18,3,3,209, | |
898 105,105,98,9,12,16,17,14,13,15,19,69,70,22,20,21,76,24,23,19,11,10,30,34,18, | |
899 105,105,98,9,12,16,17,14,13,15,20,69,70,22,20,21,75,24,23,19,11,10,30,34,18, | |
900 105,105,98,9,12,16,17,14,13,15,21,69,70,22,20,21,74,24,23,19,11,10,30,34,18, | |
901 105,105,98,9,12,16,17,14,13,15,22,69,40,22,52,52,35,31,29,28,27,26,20,21,26, | |
902 25,24,23,19,11,10,30,34,18, | |
903 15,23,53, | |
904 15,24,54, | |
905 55,67,56, | |
906 57,59,61,60,58, | |
907 14,13,56,62,61, | |
908 63,65,67,69,53,70,68,66,64, | |
909 71,73,51,74,72, | |
910 106,106,106,104, | |
911 75,49,76, | |
912 176,3,3,1,2,32,3,3,187, | |
913 176,3,3,1,2,33,3,3,184, | |
914 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
915 176,176,176,3,3,1,2,34,3,3,189, | |
916 77,79,47,80,78, | |
917 15,36,81, | |
918 15,37,83,82, | |
919 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
920 176,176,176,176,3,3,1,2,38,3,3,181, | |
921 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,3,3, | |
922 1,2,176,39,3,3,182, | |
923 84,86,88,90,92,70,93,91,89,87,85, | |
924 94,95,97,98,99,12,57,59,14,13,65,69,79,96,92,32,33,104,38,15,41,101,101,105, | |
925 82,104,100,33,105,33,103,102,101,101,101,101,101,101,101,101,101,101, | |
926 101,101,101,101,101, | |
927 105,105,98,9,12,16,17,14,13,32,33,39,38,15,42,69,40,22,45,32,106,32,46,106, | |
928 44,37,43,42,41,36,46,35,31,29,28,27,26,20,21,26,25,24,23,19,11,10,30,34, | |
929 18, | |
930 107,107,43,107, | |
931 108,108,44,108, | |
932 105,105,98,9,12,16,17,14,13,32,33,39,38,110,15,45,69,40,109,22,45,22,16,16, | |
933 16,46,16,44,37,43,42,41,36,46,35,31,29,28,27,26,20,21,26,25,24,23,19,11, | |
934 10,30,34,18, | |
935 39,46,20, | |
936 105,105,98,9,12,16,17,14,13,32,33,39,38,15,2,69,40,22,45,17,17,17,46,17,44, | |
937 37,43,42,41,36,46,35,31,29,28,27,26,20,21,26,25,24,23,19,11,10,30,34,18, | |
938 3,48, | |
939 49,100,101, | |
940 49,95,93, | |
941 112,111,112,51,112, | |
942 113,52,73, | |
943 105,105,98,9,12,16,17,14,13,15,53,69,40,22,114,114,35,31,29,28,27,26,20,21, | |
944 26,25,24,23,19,11,10,30,34,18, | |
945 105,105,98,9,12,16,17,14,13,15,54,69,40,22,115,115,35,31,29,28,27,26,20,21, | |
946 26,25,24,23,19,11,10,30,34,18, | |
947 176,176,176,176,176,176,176,176,176,176,3,3,1,2,55,3,3,208, | |
948 105,105,98,9,12,16,17,14,13,15,56,69,70,22,20,21,68,25,24,23,19,11,10,30,34, | |
949 18, | |
950 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
951 176,176,176,3,3,1,2,57,3,3,207, | |
952 105,105,98,9,12,16,17,14,13,15,58,69,70,22,20,21,66,25,24,23,19,11,10,30,34, | |
953 18, | |
954 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
955 176,176,176,3,3,1,2,59,3,3,206, | |
956 105,105,98,9,12,16,17,14,13,15,60,69,70,22,20,21,65,25,24,23,19,11,10,30,34, | |
957 18, | |
958 105,105,98,9,12,16,17,14,13,15,61,69,70,22,116,20,21,116,25,24,23,19,11,10, | |
959 30,34,18, | |
960 105,105,98,9,12,16,17,14,13,15,62,69,70,22,117,20,21,117,25,24,23,19,11,10, | |
961 30,34,18, | |
962 176,176,176,176,176,176,176,176,176,176,3,3,1,2,63,3,3,203, | |
963 105,105,98,9,12,16,17,14,13,15,64,69,70,22,118,26,20,21,26,25,24,23,19,11, | |
964 10,30,34,18, | |
965 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
966 176,176,176,3,3,1,2,65,3,3,202, | |
967 105,105,98,9,12,16,17,14,13,15,66,69,70,22,119,26,20,21,26,25,24,23,19,11, | |
968 10,30,34,18, | |
969 176,176,176,176,176,176,176,176,176,176,3,3,1,2,67,3,3,201, | |
970 105,105,98,9,12,16,17,14,13,15,68,69,70,22,120,26,20,21,26,25,24,23,19,11, | |
971 10,30,34,18, | |
972 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
973 176,176,176,3,3,1,2,69,3,3,200, | |
974 105,105,98,9,12,16,17,14,13,15,70,69,70,22,121,26,20,21,26,25,24,23,19,11, | |
975 10,30,34,18, | |
976 176,176,176,176,176,176,176,176,176,176,3,3,1,2,71,3,3,199, | |
977 105,105,98,9,12,16,17,14,13,15,72,69,70,22,122,27,26,20,21,26,25,24,23,19, | |
978 11,10,30,34,18, | |
979 176,176,176,176,176,176,176,176,176,176,3,3,1,2,73,3,3,198, | |
980 105,105,98,9,12,16,17,14,13,15,74,69,70,22,123,27,26,20,21,26,25,24,23,19, | |
981 11,10,30,34,18, | |
982 176,176,176,176,176,176,176,176,176,176,3,3,1,2,75,3,3,197, | |
983 105,105,98,9,12,16,17,14,13,15,76,69,70,22,124,28,27,26,20,21,26,25,24,23, | |
984 19,11,10,30,34,18, | |
985 176,176,176,176,176,176,176,176,176,176,3,3,1,2,77,3,3,196, | |
986 105,105,98,9,12,16,17,14,13,15,78,69,70,22,125,29,28,27,26,20,21,26,25,24, | |
987 23,19,11,10,30,34,18, | |
988 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
989 176,176,176,3,3,1,2,79,3,3,195, | |
990 105,105,98,9,12,16,17,14,13,15,80,69,40,22,126,126,35,31,29,28,27,26,20,21, | |
991 26,25,24,23,19,11,10,30,34,18, | |
992 105,105,98,9,12,16,17,14,13,15,81,69,40,22,127,127,35,31,29,28,27,26,20,21, | |
993 26,25,24,23,19,11,10,30,34,18, | |
994 94,95,97,98,99,12,57,59,14,13,65,69,79,96,92,15,128,82,101,101,82,128,101, | |
995 101,101,101,101,101,101,101,101,101,101,101,101,101,101, | |
996 94,95,97,98,99,12,57,59,14,13,65,69,79,96,92,32,33,104,38,15,83,101,101,25, | |
997 82,104,100,25,36,103,102,101,101,101,101,101,101,101,101,101,101,101, | |
998 101,101,101,101, | |
999 176,176,176,176,176,176,176,176,176,176,3,3,1,2,84,3,3,193, | |
1000 105,105,98,9,12,16,17,14,13,15,85,69,40,22,46,46,35,31,29,28,27,26,20,21,26, | |
1001 25,24,23,19,11,10,30,34,18, | |
1002 176,176,176,176,176,176,176,176,176,176,3,3,1,2,86,3,3,192, | |
1003 105,105,98,9,12,16,17,14,13,15,87,69,40,22,45,45,35,31,29,28,27,26,20,21,26, | |
1004 25,24,23,19,11,10,30,34,18, | |
1005 176,176,176,176,176,176,176,176,176,176,3,3,1,2,88,3,3,191, | |
1006 105,105,98,9,12,16,17,14,13,15,89,69,40,22,44,44,35,31,29,28,27,26,20,21,26, | |
1007 25,24,23,19,11,10,30,34,18, | |
1008 176,176,176,176,176,176,176,176,176,176,3,3,1,2,90,3,3,190, | |
1009 105,105,98,9,12,16,17,14,13,15,91,69,40,22,43,43,35,31,29,28,27,26,20,21,26, | |
1010 25,24,23,19,11,10,30,34,18, | |
1011 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
1012 176,176,176,3,3,1,2,92,3,3,188, | |
1013 105,105,98,9,12,16,17,14,13,15,93,69,40,22,42,42,35,31,29,28,27,26,20,21,26, | |
1014 25,24,23,19,11,10,30,34,18, | |
1015 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
1016 176,3,3,1,2,94,3,3,217, | |
1017 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
1018 176,3,3,1,2,95,3,3,216, | |
1019 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
1020 176,176,176,3,3,1,2,96,3,3,194, | |
1021 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
1022 176,3,3,1,2,97,3,3,215, | |
1023 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
1024 176,3,3,1,2,98,3,3,214, | |
1025 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
1026 176,3,3,1,2,99,3,3,213, | |
1027 94,95,97,98,99,12,57,59,14,13,65,69,79,96,92,38,130,15,100,101,101,129,82, | |
1028 130,100,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101, | |
1029 94,95,97,98,99,12,57,59,14,13,65,69,79,96,92,38,15,10,7,8,82,100,6,6,6,6,6, | |
1030 6,6,6,6,6,6,6,6,6,6, | |
1031 15,102,131,82, | |
1032 15,103,132,82, | |
1033 39,104,28, | |
1034 133,18,134, | |
1035 133,14,135, | |
1036 138,136,107,137,139, | |
1037 138,136,108,140,139, | |
1038 105,105,98,9,12,16,17,14,13,32,33,39,38,110,15,109,69,40,22,45,23,17,17,17, | |
1039 46,17,44,37,43,42,41,36,46,35,31,29,28,27,26,20,21,26,25,24,23,19,11,10, | |
1040 30,34,18, | |
1041 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
1042 176,176,176,176,176,176,176,176,3,3,1,2,176,110,3,3,180, | |
1043 102,111,141, | |
1044 102,112,142, | |
1045 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
1046 176,176,176,176,176,176,176,176,176,176,176,176,3,3,1,2,113,3,3,178, | |
1047 113,114,72, | |
1048 113,115,71, | |
1049 57,59,63,60,58, | |
1050 57,59,62,60,58, | |
1051 14,13,60,62,61, | |
1052 14,13,59,62,61, | |
1053 14,13,58,62,61, | |
1054 14,13,57,62,61, | |
1055 63,65,67,69,55,70,68,66,64, | |
1056 63,65,67,69,54,70,68,66,64, | |
1057 71,73,52,74,72, | |
1058 75,50,76, | |
1059 96,126,143, | |
1060 113,127,40, | |
1061 113,128,11, | |
1062 110,129,13, | |
1063 110,130,12, | |
1064 94,95,97,98,99,12,57,59,14,13,65,69,79,96,92,32,33,104,38,15,131,101,101, | |
1065 144,82,104,100,37,144,37,103,102,101,101,101,101,101,101,101,101,101, | |
1066 101,101,101,101,101,101, | |
1067 94,95,97,98,99,12,57,59,14,13,65,69,79,96,92,32,33,104,38,15,132,101,101,30, | |
1068 82,104,100,30,39,103,102,101,101,101,101,101,101,101,101,101,101,101, | |
1069 101,101,101,101, | |
1070 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
1071 176,176,176,3,3,1,2,133,3,3,186, | |
1072 105,105,98,9,12,16,17,14,13,32,33,39,38,15,134,69,40,22,45,35,35,35,46,35, | |
1073 44,37,43,42,41,36,46,35,31,29,28,27,26,20,21,26,25,24,23,19,11,10,30,34, | |
1074 18, | |
1075 94,95,97,98,99,12,57,59,14,13,65,69,79,96,92,32,33,104,38,15,135,101,101,34, | |
1076 82,104,100,34,34,34,103,102,101,101,101,101,101,101,101,101,101,101,101, | |
1077 101,101,101,101, | |
1078 176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, | |
1079 176,3,3,1,2,136,3,3,183, | |
1080 94,95,97,98,99,12,57,59,14,13,65,69,79,96,92,32,33,104,38,15,137,101,101,31, | |
1081 82,104,100,31,31,31,103,102,101,101,101,101,101,101,101,101,101,101,101, | |
1082 101,101,101,101, | |
1083 176,176,176,176,176,176,176,176,176,176,176,176,176,176,3,3,1,2,138,3,3,185, | |
1084 105,105,98,9,12,16,17,14,13,32,33,39,38,15,139,69,40,22,45,27,27,27,46,27, | |
1085 44,37,43,42,41,36,46,35,31,29,28,27,26,20,21,26,25,24,23,19,11,10,30,34, | |
1086 18, | |
1087 94,95,97,98,99,12,57,59,14,13,65,69,79,96,92,32,33,104,38,15,140,101,101,24, | |
1088 82,104,100,24,24,24,103,102,101,101,101,101,101,101,101,101,101,101,101, | |
1089 101,101,101,101, | |
1090 103,92, | |
1091 103,91, | |
1092 105,105,98,9,12,16,17,14,13,15,143,69,70,22,48,35,31,29,28,27,26,20,21,26, | |
1093 25,24,23,19,11,10,30,34,18, | |
1094 133,18,145, | |
1095 94,95,97,98,99,12,57,59,14,13,65,69,79,96,92,32,33,104,38,15,145,101,101,38, | |
1096 82,104,100,38,38,38,103,102,101,101,101,101,101,101,101,101,101,101,101, | |
1097 101,101,101,101, | |
1098 | |
1099 }; | |
1100 | |
1101 | |
1102 static const unsigned short ag_sbt[] = { | |
1103 0, 23, 49, 76, 82, 135, 158, 160, 184, 186, 189, 215, 217, 247, | |
1104 277, 307, 334, 343, 352, 377, 402, 427, 452, 486, 489, 492, 495, 500, | |
1105 505, 514, 519, 523, 526, 535, 544, 574, 579, 582, 586, 617, 644, 655, | |
1106 702, 751, 755, 759, 811, 814, 863, 865, 868, 871, 876, 879, 913, 947, | |
1107 965, 991,1021,1047,1077,1103,1130,1157,1175,1203,1233,1261,1279,1307, | |
1108 1337,1365,1383,1412,1430,1459,1477,1507,1525,1556,1586,1620,1654,1691, | |
1109 1737,1755,1789,1807,1841,1859,1893,1911,1945,1975,2009,2037,2065,2095, | |
1110 2123,2151,2179,2219,2256,2260,2264,2267,2270,2273,2278,2283,2334,2370, | |
1111 2373,2376,2415,2418,2421,2426,2431,2436,2441,2446,2451,2460,2469,2474, | |
1112 2477,2480,2483,2486,2489,2492,2539,2585,2615,2664,2711,2739,2786,2808, | |
1113 2857,2904,2906,2908,2941,2944,2991 | |
1114 }; | |
1115 | |
1116 | |
1117 static const unsigned short ag_sbe[] = { | |
1118 19, 46, 73, 80, 97, 157, 159, 183, 185, 187, 213, 216, 243, 273, | |
1119 303, 330, 339, 348, 373, 387, 412, 437, 462, 487, 490, 493, 497, 502, | |
1120 509, 516, 522, 524, 531, 540, 570, 576, 580, 583, 613, 640, 649, 675, | |
1121 716, 753, 757, 774, 812, 828, 864, 866, 869, 874, 877, 889, 923, 961, | |
1122 975,1017,1031,1073,1087,1113,1140,1171,1185,1229,1243,1275,1289,1333, | |
1123 1347,1379,1393,1426,1440,1473,1487,1521,1535,1582,1596,1630,1671,1711, | |
1124 1751,1765,1803,1817,1855,1869,1907,1921,1971,1985,2033,2061,2091,2119, | |
1125 2147,2175,2197,2236,2257,2261,2265,2268,2271,2275,2280,2298,2366,2371, | |
1126 2374,2411,2416,2419,2423,2428,2433,2438,2443,2448,2455,2464,2471,2475, | |
1127 2478,2481,2484,2487,2490,2512,2559,2611,2629,2684,2735,2759,2804,2822, | |
1128 2877,2905,2907,2918,2942,2964,2991 | |
1129 }; | |
1130 | |
1131 | |
1132 static const unsigned char ag_fl[] = { | |
1133 2,0,1,2,1,1,2,2,2,0,1,3,3,3,1,1,1,2,1,1,2,1,2,3,4,3,0,3,2,1,3,4,2,2,4, | |
1134 4,3,3,5,3,4,1,3,3,3,3,3,1,5,1,3,1,3,1,3,3,1,3,3,3,3,1,3,3,1,3,3,1,3,1, | |
1135 1,4,4,3,2,2,2,1,1,2,0,1,3,1,2,0,1,3,1,0,1,4,4,3,0,1,2,2,1,2,1,2,1,2,1, | |
1136 1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1137 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, | |
1138 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, | |
1139 2,2,2,2,2,2,2,2 | |
1140 }; | |
1141 | |
1142 static const unsigned char ag_ptt[] = { | |
1143 0, 6, 6, 4, 8, 8, 8, 8, 8, 13, 13, 10, 11, 11, 17, 17, 5, 5, | |
1144 20, 20, 18, 18, 18, 18, 18, 25, 26, 26, 21, 21, 21, 19, 19, 19, 19, 19, | |
1145 30, 22, 22, 22, 32, 23, 23, 23, 23, 23, 23, 35, 35, 41, 41, 44, 44, 46, | |
1146 46, 46, 48, 48, 48, 48, 48, 51, 51, 51, 56, 56, 56, 59, 59, 62, 62, 62, | |
1147 62, 62, 62, 62, 62, 1, 70, 70, 71, 71, 1, 75, 75, 76, 76, 1,127, 80, | |
1148 80,127,127, 78, 85, 85, 78, 78, 82, 82, 84, 84, 81, 81,107, 87, 87, 9, | |
1149 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 67, 67, 69, 69, | |
1150 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | |
1151 69, 69, 69, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | |
1152 74, 74, 74, 74, 74, 74, 74, 88, 88, 89, 89, 89, 94, 94, 95, 95, 14, 12, | |
1153 16, 15, 24, 27, 28, 29, 33, 34, 36, 3, 37, 38, 39, 40, 43, 42, 45, 47, | |
1154 49, 50, 52, 53, 54, 55, 57, 58, 60, 61, 63, 2, 64, 65, 66, 90, 83, 86, | |
1155 91, 79 | |
1156 }; | |
1157 | |
1158 static const unsigned char *ag_valid(int ag_k) { | |
1159 const unsigned char *ag_tp = &ag_tstt[ag_sbt[(PCB).sn+1]]; | |
1160 while (*--ag_tp != (unsigned char) ag_k) if (*ag_tp == 0) return NULL; | |
1161 return ag_tp; | |
1162 } | |
1163 | |
1164 int asil_change_reduction(asil_token_type ag_k) { | |
1165 if (!ag_valid(ag_k)) return 0; | |
1166 (PCB).reduction_token = ag_k; | |
1167 return 1; | |
1168 } | |
1169 | |
1170 static void ag_default(const int *ag_tp) { | |
1171 (PCB).ag_dsn = (PCB).sn; | |
1172 (PCB).ag_dtl = ag_tp; | |
1173 while (!ag_valid((asil_token_type) *ag_tp)) ag_tp++; | |
1174 (PCB).reduction_token = (asil_token_type) *ag_tp; | |
1175 } | |
1176 | |
1177 | |
1178 | |
1179 static void ag_ra(void) | |
1180 { | |
1181 switch(ag_rpx[(PCB).ag_ap]) { | |
1182 case 1: V(0,(double *)) = ag_rp_1(V(0,(double *))); break; | |
1183 case 2: V(0,(double *)) = ag_rp_2(V(0,(double *))); break; | |
1184 case 3: ag_default(&ag_rtt[0]); V(0,(double *)) = ag_rp_3(V(2,(double *))); break; | |
1185 case 4: V(0,(double *)) = ag_rp_4(V(0,(int *)), V(2,(double *))); break; | |
1186 case 5: V(0,(double *)) = ag_rp_5(V(0,(int *)), V(2,(double *))); break; | |
1187 case 6: V(0,(double *)) = ag_rp_6(V(0,(int *)), V(2,(double *))); break; | |
1188 case 7: V(0,(double *)) = ag_rp_7(V(0,(int *)), V(2,(double *))); break; | |
1189 case 8: V(0,(double *)) = ag_rp_8(V(0,(int *)), V(2,(double *))); break; | |
1190 case 9: V(0,(double *)) = ag_rp_9(V(0,(double *)), V(2,(double *)), V(4,(double *))); break; | |
1191 case 10: V(0,(double *)) = ag_rp_10(V(0,(double *)), V(2,(double *))); break; | |
1192 case 11: V(0,(double *)) = ag_rp_11(V(0,(double *)), V(2,(double *))); break; | |
1193 case 12: V(0,(double *)) = ag_rp_12(V(0,(double *)), V(2,(double *))); break; | |
1194 case 13: V(0,(double *)) = ag_rp_13(V(0,(double *)), V(2,(double *))); break; | |
1195 case 14: V(0,(double *)) = ag_rp_14(V(0,(double *)), V(2,(double *))); break; | |
1196 case 15: V(0,(double *)) = ag_rp_15(V(0,(double *)), V(2,(double *))); break; | |
1197 case 16: V(0,(double *)) = ag_rp_16(V(0,(double *)), V(2,(double *))); break; | |
1198 case 17: V(0,(double *)) = ag_rp_17(V(0,(double *)), V(2,(double *))); break; | |
1199 case 18: V(0,(double *)) = ag_rp_18(V(0,(double *)), V(2,(double *))); break; | |
1200 case 19: V(0,(double *)) = ag_rp_19(V(0,(double *)), V(2,(double *))); break; | |
1201 case 20: V(0,(double *)) = ag_rp_20(V(0,(double *)), V(2,(double *))); break; | |
1202 case 21: V(0,(double *)) = ag_rp_21(V(0,(double *)), V(2,(double *))); break; | |
1203 case 22: V(0,(double *)) = ag_rp_22(V(0,(double *)), V(2,(double *))); break; | |
1204 case 23: V(0,(double *)) = ag_rp_23(V(0,(double *))); break; | |
1205 case 24: V(0,(double *)) = ag_rp_24(V(0,(int *))); break; | |
1206 case 25: V(0,(double *)) = ag_rp_25(V(2,(double *))); break; | |
1207 case 26: V(0,(double *)) = ag_rp_26(V(2,(double *))); break; | |
1208 case 27: V(0,(double *)) = ag_rp_2(V(1,(double *))); break; | |
1209 case 28: V(0,(double *)) = ag_rp_28(V(1,(double *))); break; | |
1210 case 29: V(0,(double *)) = ag_rp_29(V(1,(double *))); break; | |
1211 case 30: V(0,(double *)) = ag_rp_30(V(1,(double *))); break; | |
1212 case 31: V(0,(double *)) = ag_rp_31(V(0,(double *)), V(3,(int *))); break; | |
1213 case 32: V(0,(double *)) = ag_rp_32(V(0,(double *)), V(3,(int *))); break; | |
1214 case 33: V(0,(double *)) = ag_rp_33(V(0,(double *)), V(2,(double *))); break; | |
1215 case 34: V(0,(double *)) = ag_rp_34(V(1,(double *))); break; | |
1216 case 35: V(0,(double *)) = ag_rp_35(V(0,(int *))); break; | |
1217 case 36: V(0,(double *)) = ag_rp_36(V(0,(double *)), V(1,(int *))); break; | |
1218 case 37: V(0,(double *)) = ag_rp_37(V(0,(int *))); break; | |
1219 case 38: V(0,(double *)) = ag_rp_38(V(0,(int *)), V(1,(double *))); break; | |
1220 case 39: V(0,(int *)) = ag_rp_39(V(0,(int *))); break; | |
1221 case 40: V(0,(int *)) = ag_rp_40(V(0,(int *)), V(1,(int *))); break; | |
1222 case 41: V(0,(int *)) = ag_rp_41(V(0,(int *))); break; | |
1223 case 42: V(0,(int *)) = ag_rp_42(V(0,(int *))); break; | |
1224 case 43: V(0,(int *)) = ag_rp_43(V(0,(int *)), V(1,(int *))); break; | |
1225 } | |
1226 (PCB).la_ptr = (PCB).pointer; | |
1227 } | |
1228 | |
1229 #define TOKEN_NAMES asil_token_names | |
1230 const char *const asil_token_names[136] = { | |
1231 "input string", | |
1232 "white space", | |
1233 "real", | |
1234 "name", | |
1235 "input string", | |
1236 "statements", | |
1237 "", | |
1238 "eof", | |
1239 "statement text", | |
1240 "statement char", | |
1241 "balanced parens", | |
1242 "balanced braces", | |
1243 "'('", | |
1244 "", | |
1245 "')'", | |
1246 "'{'", | |
1247 "'}'", | |
1248 "statement", | |
1249 "unconditional statement", | |
1250 "conditional statement", | |
1251 "skip statement", | |
1252 "skip unconditional statement", | |
1253 "skip conditional statement", | |
1254 "expression", | |
1255 "';'", | |
1256 "gather unconditional while", | |
1257 "while loop", | |
1258 "false condition", | |
1259 "\"while\"", | |
1260 "true condition", | |
1261 "gather conditional while", | |
1262 "true if clause", | |
1263 "false if clause", | |
1264 "\"else\"", | |
1265 "\"if\"", | |
1266 "conditional expression", | |
1267 "'='", | |
1268 "\"+=\"", | |
1269 "\"-=\"", | |
1270 "\"*=\"", | |
1271 "\"/=\"", | |
1272 "logical or expression", | |
1273 "'\\?'", | |
1274 "':'", | |
1275 "logical and expression", | |
1276 "\"||\"", | |
1277 "equality expression", | |
1278 "\"&&\"", | |
1279 "relational expression", | |
1280 "\"==\"", | |
1281 "\"!=\"", | |
1282 "additive expression", | |
1283 "'<'", | |
1284 "\"<=\"", | |
1285 "'>'", | |
1286 "\">=\"", | |
1287 "multiplicative expression", | |
1288 "'+'", | |
1289 "'-'", | |
1290 "factor", | |
1291 "'*'", | |
1292 "'/'", | |
1293 "primary", | |
1294 "\"**\"", | |
1295 "\"log\"", | |
1296 "\"exp\"", | |
1297 "'!'", | |
1298 "blank", | |
1299 "\"/*\"", | |
1300 "", | |
1301 "", | |
1302 "", | |
1303 "\"*/\"", | |
1304 "\"//\"", | |
1305 "", | |
1306 "", | |
1307 "", | |
1308 "'\\n'", | |
1309 "simple real", | |
1310 "", | |
1311 "", | |
1312 "exponent", | |
1313 "integer part", | |
1314 "'.'", | |
1315 "fraction part", | |
1316 "", | |
1317 "digit", | |
1318 "name string", | |
1319 "letter", | |
1320 "", | |
1321 "", | |
1322 "", | |
1323 "", | |
1324 "", | |
1325 "", | |
1326 "", | |
1327 "')'", | |
1328 "'('", | |
1329 "'}'", | |
1330 "'{'", | |
1331 "';'", | |
1332 "false condition", | |
1333 "\"while\"", | |
1334 "true condition", | |
1335 "\"else\"", | |
1336 "\"if\"", | |
1337 "'='", | |
1338 "name", | |
1339 "\"+=\"", | |
1340 "\"-=\"", | |
1341 "\"*=\"", | |
1342 "\"/=\"", | |
1343 "':'", | |
1344 "'\\?'", | |
1345 "\"||\"", | |
1346 "\"&&\"", | |
1347 "\"==\"", | |
1348 "\"!=\"", | |
1349 "'<'", | |
1350 "\"<=\"", | |
1351 "'>'", | |
1352 "\">=\"", | |
1353 "'+'", | |
1354 "'-'", | |
1355 "'*'", | |
1356 "'/'", | |
1357 "\"**\"", | |
1358 "real", | |
1359 "\"log\"", | |
1360 "\"exp\"", | |
1361 "'!'", | |
1362 "", | |
1363 "'.'", | |
1364 "digit", | |
1365 "", | |
1366 "", | |
1367 | |
1368 }; | |
1369 | |
1370 #ifndef MISSING_FORMAT | |
1371 #define MISSING_FORMAT "Missing %s" | |
1372 #endif | |
1373 #ifndef UNEXPECTED_FORMAT | |
1374 #define UNEXPECTED_FORMAT "Unexpected %s" | |
1375 #endif | |
1376 #ifndef UNNAMED_TOKEN | |
1377 #define UNNAMED_TOKEN "input" | |
1378 #endif | |
1379 | |
1380 | |
1381 static void ag_diagnose(void) { | |
1382 int ag_snd = (PCB).sn; | |
1383 int ag_k = ag_sbt[ag_snd]; | |
1384 | |
1385 if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) { | |
1386 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); | |
1387 } | |
1388 else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8 | |
1389 && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1 | |
1390 && *TOKEN_NAMES[ag_tstt[ag_k]]) { | |
1391 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); | |
1392 } | |
1393 else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) { | |
1394 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]); | |
1395 } | |
1396 else if (isprint(INPUT_CODE((*(PCB).pointer))) && INPUT_CODE((*(PCB).pointer)) != '\\') { | |
1397 char buf[20]; | |
1398 sprintf(buf, "\'%c\'", (char) INPUT_CODE((*(PCB).pointer))); | |
1399 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf); | |
1400 } | |
1401 else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN); | |
1402 (PCB).error_message = (PCB).ag_msg; | |
1403 | |
1404 | |
1405 } | |
1406 static int ag_action_1_r_proc(void); | |
1407 static int ag_action_2_r_proc(void); | |
1408 static int ag_action_3_r_proc(void); | |
1409 static int ag_action_4_r_proc(void); | |
1410 static int ag_action_1_s_proc(void); | |
1411 static int ag_action_3_s_proc(void); | |
1412 static int ag_action_1_proc(void); | |
1413 static int ag_action_2_proc(void); | |
1414 static int ag_action_3_proc(void); | |
1415 static int ag_action_4_proc(void); | |
1416 static int ag_action_5_proc(void); | |
1417 static int ag_action_6_proc(void); | |
1418 static int ag_action_7_proc(void); | |
1419 static int ag_action_8_proc(void); | |
1420 static int ag_action_9_proc(void); | |
1421 static int ag_action_10_proc(void); | |
1422 static int ag_action_11_proc(void); | |
1423 static int ag_action_8_proc(void); | |
1424 | |
1425 | |
1426 static int (*const ag_r_procs_scan[])(void) = { | |
1427 ag_action_1_r_proc, | |
1428 ag_action_2_r_proc, | |
1429 ag_action_3_r_proc, | |
1430 ag_action_4_r_proc | |
1431 }; | |
1432 | |
1433 static int (*const ag_s_procs_scan[])(void) = { | |
1434 ag_action_1_s_proc, | |
1435 ag_action_2_r_proc, | |
1436 ag_action_3_s_proc, | |
1437 ag_action_4_r_proc | |
1438 }; | |
1439 | |
1440 static int (*const ag_gt_procs_scan[])(void) = { | |
1441 ag_action_1_proc, | |
1442 ag_action_2_proc, | |
1443 ag_action_3_proc, | |
1444 ag_action_4_proc, | |
1445 ag_action_5_proc, | |
1446 ag_action_6_proc, | |
1447 ag_action_7_proc, | |
1448 ag_action_8_proc, | |
1449 ag_action_9_proc, | |
1450 ag_action_10_proc, | |
1451 ag_action_11_proc, | |
1452 ag_action_8_proc | |
1453 }; | |
1454 | |
1455 | |
1456 static int ag_action_10_proc(void) { | |
1457 int ag_t = (PCB).token_number; | |
1458 (PCB).btsx = 0, (PCB).drt = -1; | |
1459 do { | |
1460 ag_track(); | |
1461 (PCB).token_number = (asil_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr)); | |
1462 (PCB).la_ptr++; | |
1463 if (ag_key_index[(PCB).sn]) { | |
1464 unsigned ag_k = ag_key_index[(PCB).sn]; | |
1465 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer)); | |
1466 if (ag_ch <= 255) { | |
1467 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
1468 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k); | |
1469 } | |
1470 } | |
1471 } while ((PCB).token_number == (asil_token_type) ag_t); | |
1472 (PCB).la_ptr = (PCB).pointer; | |
1473 return 1; | |
1474 } | |
1475 | |
1476 static int ag_action_11_proc(void) { | |
1477 int ag_t = (PCB).token_number; | |
1478 | |
1479 (PCB).btsx = 0, (PCB).drt = -1; | |
1480 do { | |
1481 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; | |
1482 (PCB).ssx--; | |
1483 ag_track(); | |
1484 ag_ra(); | |
1485 if ((PCB).exit_flag != AG_RUNNING_CODE) return 0; | |
1486 (PCB).ssx++; | |
1487 (PCB).token_number = (asil_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr)); | |
1488 (PCB).la_ptr++; | |
1489 if (ag_key_index[(PCB).sn]) { | |
1490 unsigned ag_k = ag_key_index[(PCB).sn]; | |
1491 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer)); | |
1492 if (ag_ch <= 255) { | |
1493 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
1494 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k); | |
1495 } | |
1496 } | |
1497 } | |
1498 while ((PCB).token_number == (asil_token_type) ag_t); | |
1499 (PCB).la_ptr = (PCB).pointer; | |
1500 return 1; | |
1501 } | |
1502 | |
1503 static int ag_action_3_r_proc(void) { | |
1504 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1505 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1506 (PCB).btsx = 0, (PCB).drt = -1; | |
1507 (PCB).reduction_token = (asil_token_type) ag_ptt[(PCB).ag_ap]; | |
1508 ag_ra(); | |
1509 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1510 } | |
1511 | |
1512 static int ag_action_3_s_proc(void) { | |
1513 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1514 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1515 (PCB).btsx = 0, (PCB).drt = -1; | |
1516 (PCB).reduction_token = (asil_token_type) ag_ptt[(PCB).ag_ap]; | |
1517 ag_ra(); | |
1518 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1519 } | |
1520 | |
1521 static int ag_action_4_r_proc(void) { | |
1522 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1523 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1524 (PCB).reduction_token = (asil_token_type) ag_ptt[(PCB).ag_ap]; | |
1525 return 1; | |
1526 } | |
1527 | |
1528 static int ag_action_2_proc(void) { | |
1529 (PCB).btsx = 0, (PCB).drt = -1; | |
1530 if ((PCB).ssx >= 128) { | |
1531 (PCB).exit_flag = AG_STACK_ERROR_CODE; | |
1532 PARSER_STACK_OVERFLOW; | |
1533 } | |
1534 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; | |
1535 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1536 (PCB).ssx++; | |
1537 (PCB).sn = (PCB).ag_ap; | |
1538 ag_track(); | |
1539 return 0; | |
1540 } | |
1541 | |
1542 static int ag_action_9_proc(void) { | |
1543 if ((PCB).drt == -1) { | |
1544 (PCB).drt=(PCB).token_number; | |
1545 (PCB).dssx=(PCB).ssx; | |
1546 (PCB).dsn=(PCB).sn; | |
1547 } | |
1548 ag_prot(); | |
1549 (PCB).vs[(PCB).ssx] = ag_null_value; | |
1550 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1551 (PCB).ssx++; | |
1552 (PCB).sn = (PCB).ag_ap; | |
1553 (PCB).la_ptr = (PCB).pointer; | |
1554 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1555 } | |
1556 | |
1557 static int ag_action_2_r_proc(void) { | |
1558 (PCB).ssx++; | |
1559 (PCB).sn = (PCB).ag_ap; | |
1560 return 0; | |
1561 } | |
1562 | |
1563 static int ag_action_7_proc(void) { | |
1564 --(PCB).ssx; | |
1565 (PCB).la_ptr = (PCB).pointer; | |
1566 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1567 return 0; | |
1568 } | |
1569 | |
1570 static int ag_action_1_proc(void) { | |
1571 ag_track(); | |
1572 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1573 return 0; | |
1574 } | |
1575 | |
1576 static int ag_action_1_r_proc(void) { | |
1577 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1578 return 0; | |
1579 } | |
1580 | |
1581 static int ag_action_1_s_proc(void) { | |
1582 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1583 return 0; | |
1584 } | |
1585 | |
1586 static int ag_action_4_proc(void) { | |
1587 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1588 (PCB).reduction_token = (asil_token_type) ag_ptt[(PCB).ag_ap]; | |
1589 (PCB).btsx = 0, (PCB).drt = -1; | |
1590 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; | |
1591 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1592 else (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1593 ag_track(); | |
1594 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1595 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1596 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1597 do { | |
1598 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1599 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1600 else ag_t2 = ag_tx; | |
1601 } while (ag_t1 < ag_t2); | |
1602 if (ag_tstt[ag_t1] != (PCB).reduction_token) { | |
1603 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; | |
1604 REDUCTION_TOKEN_ERROR; break;} | |
1605 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1606 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break; | |
1607 } | |
1608 return 0; | |
1609 } | |
1610 | |
1611 static int ag_action_3_proc(void) { | |
1612 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1613 (PCB).btsx = 0, (PCB).drt = -1; | |
1614 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; | |
1615 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1616 else (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1617 ag_track(); | |
1618 (PCB).reduction_token = (asil_token_type) ag_ptt[(PCB).ag_ap]; | |
1619 ag_ra(); | |
1620 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1621 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1622 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1623 do { | |
1624 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1625 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1626 else ag_t2 = ag_tx; | |
1627 } while (ag_t1 < ag_t2); | |
1628 if (ag_tstt[ag_t1] != (PCB).reduction_token) { | |
1629 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; | |
1630 REDUCTION_TOKEN_ERROR; break;} | |
1631 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1632 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break; | |
1633 } | |
1634 return 0; | |
1635 } | |
1636 | |
1637 static int ag_action_8_proc(void) { | |
1638 ag_undo(); | |
1639 (PCB).la_ptr = (PCB).pointer; | |
1640 (PCB).exit_flag = AG_SYNTAX_ERROR_CODE; | |
1641 ag_diagnose(); | |
1642 SYNTAX_ERROR; | |
1643 {(PCB).la_ptr = (PCB).pointer + 1; ag_track();} | |
1644 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1645 } | |
1646 | |
1647 static int ag_action_5_proc(void) { | |
1648 int ag_sd = ag_fl[(PCB).ag_ap]; | |
1649 (PCB).btsx = 0, (PCB).drt = -1; | |
1650 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1651 else { | |
1652 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1653 } | |
1654 (PCB).la_ptr = (PCB).pointer; | |
1655 (PCB).reduction_token = (asil_token_type) ag_ptt[(PCB).ag_ap]; | |
1656 ag_ra(); | |
1657 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1658 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1659 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1660 do { | |
1661 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1662 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1663 else ag_t2 = ag_tx; | |
1664 } while (ag_t1 < ag_t2); | |
1665 if (ag_tstt[ag_t1] != (PCB).reduction_token) { | |
1666 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; | |
1667 REDUCTION_TOKEN_ERROR; break;} | |
1668 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1669 if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break; | |
1670 } | |
1671 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1672 } | |
1673 | |
1674 static int ag_action_6_proc(void) { | |
1675 int ag_sd = ag_fl[(PCB).ag_ap]; | |
1676 (PCB).reduction_token = (asil_token_type) ag_ptt[(PCB).ag_ap]; | |
1677 if ((PCB).drt == -1) { | |
1678 (PCB).drt=(PCB).token_number; | |
1679 (PCB).dssx=(PCB).ssx; | |
1680 (PCB).dsn=(PCB).sn; | |
1681 } | |
1682 if (ag_sd) { | |
1683 (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1684 } | |
1685 else { | |
1686 ag_prot(); | |
1687 (PCB).vs[(PCB).ssx] = ag_null_value; | |
1688 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1689 } | |
1690 (PCB).la_ptr = (PCB).pointer; | |
1691 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1692 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1693 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1694 do { | |
1695 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1696 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1697 else ag_t2 = ag_tx; | |
1698 } while (ag_t1 < ag_t2); | |
1699 if (ag_tstt[ag_t1] != (PCB).reduction_token) { | |
1700 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; | |
1701 REDUCTION_TOKEN_ERROR; break;} | |
1702 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1703 if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break; | |
1704 } | |
1705 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1706 } | |
1707 | |
1708 | |
1709 void init_asil(void) { | |
1710 (PCB).la_ptr = (PCB).pointer; | |
1711 (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0; | |
1712 (PCB).exit_flag = AG_RUNNING_CODE; | |
1713 (PCB).line = FIRST_LINE; | |
1714 (PCB).column = FIRST_COLUMN; | |
1715 (PCB).btsx = 0, (PCB).drt = -1; | |
1716 } | |
1717 | |
1718 void asil(void) { | |
1719 init_asil(); | |
1720 (PCB).exit_flag = AG_RUNNING_CODE; | |
1721 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1722 unsigned ag_t1 = ag_sbt[(PCB).sn]; | |
1723 if (ag_tstt[ag_t1]) { | |
1724 unsigned ag_t2 = ag_sbe[(PCB).sn] - 1; | |
1725 (PCB).token_number = (asil_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr)); | |
1726 (PCB).la_ptr++; | |
1727 if (ag_key_index[(PCB).sn]) { | |
1728 unsigned ag_k = ag_key_index[(PCB).sn]; | |
1729 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer)); | |
1730 if (ag_ch <= 255) { | |
1731 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
1732 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k); | |
1733 } | |
1734 } | |
1735 do { | |
1736 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1737 if (ag_tstt[ag_tx] > (unsigned char)(PCB).token_number) | |
1738 ag_t1 = ag_tx + 1; | |
1739 else ag_t2 = ag_tx; | |
1740 } while (ag_t1 < ag_t2); | |
1741 if (ag_tstt[ag_t1] != (unsigned char)(PCB).token_number) | |
1742 ag_t1 = ag_sbe[(PCB).sn]; | |
1743 } | |
1744 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1745 (ag_gt_procs_scan[ag_astt[ag_t1]])(); | |
1746 } | |
1747 } | |
1748 | |
1749 |