comparison interps/c-intercal/oil-oil.c @ 996:859f9b4339e6

<Gregor> tar xf egobot.tar.xz
author HackBot
date Sun, 09 Dec 2012 19:30:08 +0000
parents
children
comparison
equal deleted inserted replaced
995:6883f5911eb7 996:859f9b4339e6
1 /* A Bison parser, made by GNU Bison 2.5. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "2.5"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 0
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61 /* Using locations. */
62 #define YYLSP_NEEDED 0
63
64
65
66 /* Copy the first part of user declarations. */
67
68 /* Line 268 of yacc.c */
69 #line 25 "oil.y"
70
71
72 #include "bconfig.h"
73 #include <stdio.h>
74 #include <stdlib.h>
75 #include <string.h>
76 #include <ctype.h>
77
78 /* Autoconf lets us know if we have _Bool available, usually. On DJGPP there's
79 an occasional bug that I haven't managed to reproduce that leaves
80 SIZEOF_BOOL as the null string, so detect that ick_first. */
81 #if 100 - SIZEOF__BOOL - 1 == 101
82 /* The bug happened, so play safe. */
83 typedef int mybool;
84 #else
85 # if SIZEOF__BOOL > 0
86 typedef _Bool mybool;
87 # else
88 typedef int mybool;
89 # endif
90 #endif
91
92 /* Define strdup if it isn't available */
93 #ifndef HAVE_STRDUP
94 char* strdup(const char* s)
95 {
96 char* t=malloc(strlen(s)+1);
97 if(t) strcpy(t,s);
98 return t;
99 }
100 #endif
101
102 /*
103 #define YYDEBUG 1
104 int yydebug=1;
105 */
106
107 /* Each semantic value represents either a constraint on a node that needs to
108 be true for the optimization template to match, or part of the replacement
109 for the optimization template. */
110 struct ickstype
111 {
112 unsigned depth; /* The number of child nodes this is from the root */
113 unsigned long path; /* Bits from the end of this number represent the
114 sequence of lvals (=0) or rvals (=1) this is from the
115 root; depth bits from the end are relevant, and the
116 bit nearest the root is least significant */
117 const char* condition; /* Points to a constant string; the condition to generate
118 on that node. Could also point to something the lexer
119 mallocs, but then the lexer has to keep track of being
120 able to free it again. If this is NULL, it means that
121 there isn't a condition other than maybe mustbemesh */
122 const char* nodetypename; /* The name of the type of node this condition matches,
123 or NULL for a LEXERLEAF */
124 mybool usec; /* Whether to append the value of c to the condition */
125 mybool mustbemesh; /* Must this node be a mesh or mesh32? */
126 mybool cxneeded; /* True means calculate c and x for the node and the
127 condition is on those; false means append 'condition'
128 to the node itself to form the condition and c and x
129 aren't needed */
130 mybool width32; /* Generate a 32-bit node? */
131 mybool ublo; /* Is this a UBLO (if set, generate conditions
132 to check width)? */
133 unsigned long c; /* The value to append to the condition */
134 int replnum; /* Number of this group for replacements */
135 struct ickstype *n1;/* n1 and n2 are pointers to other conditions that */
136 struct ickstype *n2;/* also have to be satisified */
137 };
138
139 #define YYSTYPE YYSTYPE
140
141 #define MAXOPTNAMELEN 64
142 char optname[MAXOPTNAMELEN]="undefined";
143
144 typedef struct ickstype *YYSTYPE;
145
146 void splitend(void);
147 void splitstart(void);
148
149 void treedepthup(YYSTYPE, mybool);
150 void treefree(YYSTYPE);
151 void gennodepath(unsigned, unsigned long);
152 mybool treeshapecond(YYSTYPE, mybool);
153 YYSTYPE treenscheck(YYSTYPE, YYSTYPE, int);
154 void treecxcond(YYSTYPE);
155 void treerepcount(YYSTYPE, int*);
156 void treerepgen(YYSTYPE, YYSTYPE*, int*);
157
158 int countgetchar(void);
159 int countungetc(int, FILE*);
160 int cgccol;
161 int cgcrow;
162
163 /* #defines for chaining together template expressions; here, s is the type
164 of expression (e.g. select, bitwise and, unary and) that's chaining the
165 expressions together and n is the nonterminal that's the rval */
166 #define BINARYEXPR(s,m,l,r,w) do{ \
167 m=malloc(sizeof(struct ickstype)); \
168 m->n1=l; \
169 m->n2=r; \
170 m->usec=0; \
171 m->condition="->opcode==" s; \
172 m->nodetypename=s; \
173 m->mustbemesh=0; \
174 m->cxneeded=0; \
175 m->depth=0; \
176 m->path=0; \
177 m->replnum=0; \
178 m->width32=w; \
179 m->ublo=0; \
180 treedepthup(m->n1,0); \
181 treedepthup(m->n2,1); \
182 } while(0)
183
184 #define UNARYEXPR(s,m,r,w,u) do{ \
185 m=malloc(sizeof(struct ickstype)); \
186 m->n1=0; \
187 m->n2=r; \
188 m->usec=0; \
189 m->condition="->opcode==" s; \
190 m->nodetypename=s; \
191 m->mustbemesh=0; \
192 m->cxneeded=0; \
193 m->depth=0; \
194 m->path=0; \
195 m->replnum=0; \
196 m->width32=w; \
197 m->ublo=u; \
198 treedepthup(m->n2,1); \
199 } while(0)
200
201 /* Error handling and lexing */
202 int yylex(void);
203 int yyerror(char const *);
204
205 /* Split the output file */
206 #define SPLITMAX 20
207 int splitcount=SPLITMAX;
208 int filenumber=0;
209 mybool inloop=0;
210
211
212 /* Line 268 of yacc.c */
213 #line 214 "oil-oil.c"
214
215 /* Enabling traces. */
216 #ifndef YYDEBUG
217 # define YYDEBUG 0
218 #endif
219
220 /* Enabling verbose error messages. */
221 #ifdef YYERROR_VERBOSE
222 # undef YYERROR_VERBOSE
223 # define YYERROR_VERBOSE 1
224 #else
225 # define YYERROR_VERBOSE 0
226 #endif
227
228 /* Enabling the token table. */
229 #ifndef YYTOKEN_TABLE
230 # define YYTOKEN_TABLE 0
231 #endif
232
233
234 /* Tokens. */
235 #ifndef YYTOKENTYPE
236 # define YYTOKENTYPE
237 /* Put the tokens into the symbol table, so that GDB and other debuggers
238 know about them. */
239 enum yytokentype {
240 LEXERLEAF = 258
241 };
242 #endif
243 /* Tokens. */
244 #define LEXERLEAF 258
245
246
247
248
249 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
250 typedef int YYSTYPE;
251 # define YYSTYPE_IS_TRIVIAL 1
252 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
253 # define YYSTYPE_IS_DECLARED 1
254 #endif
255
256
257 /* Copy the second part of user declarations. */
258
259
260 /* Line 343 of yacc.c */
261 #line 262 "oil-oil.c"
262
263 #ifdef short
264 # undef short
265 #endif
266
267 #ifdef YYTYPE_UINT8
268 typedef YYTYPE_UINT8 yytype_uint8;
269 #else
270 typedef unsigned char yytype_uint8;
271 #endif
272
273 #ifdef YYTYPE_INT8
274 typedef YYTYPE_INT8 yytype_int8;
275 #elif (defined __STDC__ || defined __C99__FUNC__ \
276 || defined __cplusplus || defined _MSC_VER)
277 typedef signed char yytype_int8;
278 #else
279 typedef short int yytype_int8;
280 #endif
281
282 #ifdef YYTYPE_UINT16
283 typedef YYTYPE_UINT16 yytype_uint16;
284 #else
285 typedef unsigned short int yytype_uint16;
286 #endif
287
288 #ifdef YYTYPE_INT16
289 typedef YYTYPE_INT16 yytype_int16;
290 #else
291 typedef short int yytype_int16;
292 #endif
293
294 #ifndef YYSIZE_T
295 # ifdef __SIZE_TYPE__
296 # define YYSIZE_T __SIZE_TYPE__
297 # elif defined size_t
298 # define YYSIZE_T size_t
299 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
300 || defined __cplusplus || defined _MSC_VER)
301 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
302 # define YYSIZE_T size_t
303 # else
304 # define YYSIZE_T unsigned int
305 # endif
306 #endif
307
308 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
309
310 #ifndef YY_
311 # if defined YYENABLE_NLS && YYENABLE_NLS
312 # if ENABLE_NLS
313 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
314 # define YY_(msgid) dgettext ("bison-runtime", msgid)
315 # endif
316 # endif
317 # ifndef YY_
318 # define YY_(msgid) msgid
319 # endif
320 #endif
321
322 /* Suppress unused-variable warnings by "using" E. */
323 #if ! defined lint || defined __GNUC__
324 # define YYUSE(e) ((void) (e))
325 #else
326 # define YYUSE(e) /* empty */
327 #endif
328
329 /* Identity function, used to suppress warnings about constant conditions. */
330 #ifndef lint
331 # define YYID(n) (n)
332 #else
333 #if (defined __STDC__ || defined __C99__FUNC__ \
334 || defined __cplusplus || defined _MSC_VER)
335 static int
336 YYID (int yyi)
337 #else
338 static int
339 YYID (yyi)
340 int yyi;
341 #endif
342 {
343 return yyi;
344 }
345 #endif
346
347 #if ! defined yyoverflow || YYERROR_VERBOSE
348
349 /* The parser invokes alloca or malloc; define the necessary symbols. */
350
351 # ifdef YYSTACK_USE_ALLOCA
352 # if YYSTACK_USE_ALLOCA
353 # ifdef __GNUC__
354 # define YYSTACK_ALLOC __builtin_alloca
355 # elif defined __BUILTIN_VA_ARG_INCR
356 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
357 # elif defined _AIX
358 # define YYSTACK_ALLOC __alloca
359 # elif defined _MSC_VER
360 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
361 # define alloca _alloca
362 # else
363 # define YYSTACK_ALLOC alloca
364 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
365 || defined __cplusplus || defined _MSC_VER)
366 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
367 # ifndef EXIT_SUCCESS
368 # define EXIT_SUCCESS 0
369 # endif
370 # endif
371 # endif
372 # endif
373 # endif
374
375 # ifdef YYSTACK_ALLOC
376 /* Pacify GCC's `empty if-body' warning. */
377 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
378 # ifndef YYSTACK_ALLOC_MAXIMUM
379 /* The OS might guarantee only one guard page at the bottom of the stack,
380 and a page size can be as small as 4096 bytes. So we cannot safely
381 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
382 to allow for a few compiler-allocated temporary stack slots. */
383 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
384 # endif
385 # else
386 # define YYSTACK_ALLOC YYMALLOC
387 # define YYSTACK_FREE YYFREE
388 # ifndef YYSTACK_ALLOC_MAXIMUM
389 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
390 # endif
391 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
392 && ! ((defined YYMALLOC || defined malloc) \
393 && (defined YYFREE || defined free)))
394 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
395 # ifndef EXIT_SUCCESS
396 # define EXIT_SUCCESS 0
397 # endif
398 # endif
399 # ifndef YYMALLOC
400 # define YYMALLOC malloc
401 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
402 || defined __cplusplus || defined _MSC_VER)
403 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
404 # endif
405 # endif
406 # ifndef YYFREE
407 # define YYFREE free
408 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
409 || defined __cplusplus || defined _MSC_VER)
410 void free (void *); /* INFRINGES ON USER NAME SPACE */
411 # endif
412 # endif
413 # endif
414 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
415
416
417 #if (! defined yyoverflow \
418 && (! defined __cplusplus \
419 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
420
421 /* A type that is properly aligned for any stack member. */
422 union yyalloc
423 {
424 yytype_int16 yyss_alloc;
425 YYSTYPE yyvs_alloc;
426 };
427
428 /* The size of the maximum gap between one aligned stack and the next. */
429 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
430
431 /* The size of an array large to enough to hold all stacks, each with
432 N elements. */
433 # define YYSTACK_BYTES(N) \
434 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
435 + YYSTACK_GAP_MAXIMUM)
436
437 # define YYCOPY_NEEDED 1
438
439 /* Relocate STACK from its old location to the new one. The
440 local variables YYSIZE and YYSTACKSIZE give the old and new number of
441 elements in the stack, and YYPTR gives the new location of the
442 stack. Advance YYPTR to a properly aligned location for the next
443 stack. */
444 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
445 do \
446 { \
447 YYSIZE_T yynewbytes; \
448 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
449 Stack = &yyptr->Stack_alloc; \
450 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
451 yyptr += yynewbytes / sizeof (*yyptr); \
452 } \
453 while (YYID (0))
454
455 #endif
456
457 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
458 /* Copy COUNT objects from FROM to TO. The source and destination do
459 not overlap. */
460 # ifndef YYCOPY
461 # if defined __GNUC__ && 1 < __GNUC__
462 # define YYCOPY(To, From, Count) \
463 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
464 # else
465 # define YYCOPY(To, From, Count) \
466 do \
467 { \
468 YYSIZE_T yyi; \
469 for (yyi = 0; yyi < (Count); yyi++) \
470 (To)[yyi] = (From)[yyi]; \
471 } \
472 while (YYID (0))
473 # endif
474 # endif
475 #endif /* !YYCOPY_NEEDED */
476
477 /* YYFINAL -- State number of the termination state. */
478 #define YYFINAL 2
479 /* YYLAST -- Last index in YYTABLE. */
480 #define YYLAST 345
481
482 /* YYNTOKENS -- Number of terminals. */
483 #define YYNTOKENS 31
484 /* YYNNTS -- Number of nonterminals. */
485 #define YYNNTS 8
486 /* YYNRULES -- Number of rules. */
487 #define YYNRULES 89
488 /* YYNRULES -- Number of states. */
489 #define YYNSTATES 244
490
491 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
492 #define YYUNDEFTOK 2
493 #define YYMAXUTOK 258
494
495 #define YYTRANSLATE(YYX) \
496 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
497
498 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
499 static const yytype_uint8 yytranslate[] =
500 {
501 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504 2, 2, 2, 29, 9, 2, 11, 28, 17, 10,
505 7, 8, 26, 25, 2, 4, 2, 27, 2, 13,
506 16, 15, 22, 23, 14, 2, 2, 2, 2, 2,
507 6, 30, 5, 19, 21, 2, 2, 2, 2, 2,
508 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
509 2, 2, 2, 2, 2, 2, 18, 2, 2, 2,
510 2, 2, 2, 2, 20, 2, 2, 2, 2, 2,
511 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
513 2, 2, 2, 2, 24, 2, 12, 2, 2, 2,
514 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 2, 2, 2, 2, 2, 2, 1, 2, 3
527 };
528
529 #if YYDEBUG
530 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
531 YYRHS. */
532 static const yytype_uint16 yyprhs[] =
533 {
534 0, 0, 3, 4, 7, 12, 17, 19, 21, 25,
535 29, 33, 35, 37, 41, 45, 51, 57, 62, 67,
536 72, 77, 82, 87, 92, 97, 102, 108, 114, 120,
537 126, 131, 137, 143, 149, 155, 159, 165, 171, 175,
538 181, 187, 191, 197, 203, 207, 213, 219, 223, 229,
539 235, 239, 245, 251, 255, 261, 267, 271, 277, 283,
540 287, 293, 299, 303, 309, 315, 320, 325, 330, 337,
541 344, 349, 356, 363, 368, 375, 382, 387, 394, 401,
542 406, 413, 420, 425, 432, 439, 442, 447, 452, 454
543 };
544
545 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
546 static const yytype_int8 yyrhs[] =
547 {
548 32, 0, -1, -1, 32, 33, -1, 34, 4, 5,
549 38, -1, 6, 3, 4, 3, -1, 5, -1, 35,
550 -1, 7, 37, 8, -1, 9, 37, 9, -1, 10,
551 37, 10, -1, 35, -1, 3, -1, 36, 11, 36,
552 -1, 36, 12, 36, -1, 36, 12, 13, 14, 36,
553 -1, 36, 12, 15, 16, 36, -1, 17, 13, 14,
554 36, -1, 17, 15, 16, 36, -1, 18, 13, 14,
555 36, -1, 18, 15, 16, 36, -1, 19, 13, 14,
556 36, -1, 19, 15, 16, 36, -1, 20, 13, 14,
557 36, -1, 20, 15, 16, 36, -1, 21, 13, 14,
558 36, -1, 21, 16, 13, 14, 36, -1, 21, 15,
559 13, 14, 36, -1, 21, 22, 13, 14, 36, -1,
560 21, 23, 13, 14, 36, -1, 21, 15, 16, 36,
561 -1, 21, 16, 15, 16, 36, -1, 21, 15, 15,
562 16, 36, -1, 21, 22, 15, 16, 36, -1, 21,
563 23, 15, 16, 36, -1, 36, 17, 36, -1, 36,
564 17, 13, 14, 36, -1, 36, 17, 15, 16, 36,
565 -1, 36, 24, 36, -1, 36, 24, 13, 14, 36,
566 -1, 36, 24, 15, 16, 36, -1, 36, 20, 36,
567 -1, 36, 20, 13, 14, 36, -1, 36, 20, 15,
568 16, 36, -1, 36, 25, 36, -1, 36, 25, 13,
569 14, 36, -1, 36, 25, 15, 16, 36, -1, 36,
570 4, 36, -1, 36, 4, 13, 14, 36, -1, 36,
571 4, 15, 16, 36, -1, 36, 26, 36, -1, 36,
572 26, 13, 14, 36, -1, 36, 26, 15, 16, 36,
573 -1, 36, 27, 36, -1, 36, 27, 13, 14, 36,
574 -1, 36, 27, 15, 16, 36, -1, 36, 28, 36,
575 -1, 36, 28, 13, 14, 36, -1, 36, 28, 15,
576 16, 36, -1, 36, 5, 36, -1, 36, 5, 13,
577 14, 36, -1, 36, 5, 15, 16, 36, -1, 36,
578 6, 36, -1, 36, 6, 13, 14, 36, -1, 36,
579 6, 15, 16, 36, -1, 12, 13, 14, 36, -1,
580 12, 15, 16, 36, -1, 36, 29, 30, 36, -1,
581 36, 29, 30, 13, 14, 36, -1, 36, 29, 30,
582 15, 16, 36, -1, 36, 30, 30, 36, -1, 36,
583 30, 30, 13, 14, 36, -1, 36, 30, 30, 15,
584 16, 36, -1, 36, 17, 17, 36, -1, 36, 17,
585 17, 13, 14, 36, -1, 36, 17, 17, 15, 16,
586 36, -1, 36, 24, 24, 36, -1, 36, 24, 24,
587 13, 14, 36, -1, 36, 24, 24, 15, 16, 36,
588 -1, 36, 5, 5, 36, -1, 36, 5, 5, 13,
589 14, 36, -1, 36, 5, 5, 15, 16, 36, -1,
590 36, 6, 6, 36, -1, 36, 6, 6, 13, 14,
591 36, -1, 36, 6, 6, 15, 16, 36, -1, 29,
592 36, -1, 29, 13, 14, 36, -1, 29, 15, 16,
593 36, -1, 36, -1, 35, -1
594 };
595
596 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
597 static const yytype_uint16 yyrline[] =
598 {
599 0, 198, 198, 198, 200, 258, 270, 272, 274, 275,
600 276, 278, 279, 281, 282, 283, 284, 285, 286, 287,
601 288, 289, 290, 291, 292, 293, 294, 295, 296, 297,
602 298, 299, 300, 301, 302, 303, 304, 305, 306, 307,
603 308, 309, 310, 311, 312, 313, 314, 315, 316, 317,
604 318, 319, 320, 321, 322, 323, 324, 325, 326, 327,
605 328, 329, 330, 331, 332, 333, 334, 335, 336, 337,
606 338, 339, 340, 341, 342, 343, 344, 345, 346, 347,
607 348, 349, 350, 351, 352, 353, 354, 355, 356, 358
608 };
609 #endif
610
611 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
612 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
613 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
614 static const char *const yytname[] =
615 {
616 "$end", "error", "$undefined", "LEXERLEAF", "'-'", "'>'", "'<'", "'('",
617 "')'", "'\"'", "'\\''", "'$'", "'~'", "'1'", "'6'", "'3'", "'2'", "'&'",
618 "'V'", "'?'", "'^'", "'@'", "'4'", "'5'", "'|'", "'+'", "'*'", "'/'",
619 "'%'", "'!'", "'='", "$accept", "input", "optimization", "template",
620 "expr3", "expr", "expr2", "replacement", 0
621 };
622 #endif
623
624 # ifdef YYPRINT
625 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
626 token YYLEX-NUM. */
627 static const yytype_uint16 yytoknum[] =
628 {
629 0, 256, 257, 258, 45, 62, 60, 40, 41, 34,
630 39, 36, 126, 49, 54, 51, 50, 38, 86, 63,
631 94, 64, 52, 53, 124, 43, 42, 47, 37, 33,
632 61
633 };
634 # endif
635
636 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
637 static const yytype_uint8 yyr1[] =
638 {
639 0, 31, 32, 32, 33, 33, 33, 34, 35, 35,
640 35, 36, 36, 37, 37, 37, 37, 37, 37, 37,
641 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
642 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
643 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
644 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
645 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
646 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
647 37, 37, 37, 37, 37, 37, 37, 37, 37, 38
648 };
649
650 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
651 static const yytype_uint8 yyr2[] =
652 {
653 0, 2, 0, 2, 4, 4, 1, 1, 3, 3,
654 3, 1, 1, 3, 3, 5, 5, 4, 4, 4,
655 4, 4, 4, 4, 4, 4, 5, 5, 5, 5,
656 4, 5, 5, 5, 5, 3, 5, 5, 3, 5,
657 5, 3, 5, 5, 3, 5, 5, 3, 5, 5,
658 3, 5, 5, 3, 5, 5, 3, 5, 5, 3,
659 5, 5, 3, 5, 5, 4, 4, 4, 6, 6,
660 4, 6, 6, 4, 6, 6, 4, 6, 6, 4,
661 6, 6, 4, 6, 6, 2, 4, 4, 1, 1
662 };
663
664 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
665 Performed when YYTABLE doesn't specify something else to do. Zero
666 means the default is an error. */
667 static const yytype_uint8 yydefact[] =
668 {
669 2, 0, 1, 6, 0, 0, 0, 0, 3, 0,
670 7, 0, 12, 0, 0, 0, 0, 0, 0, 0,
671 11, 88, 0, 0, 0, 0, 0, 0, 0, 0,
672 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
673 0, 0, 0, 0, 85, 0, 0, 0, 0, 0,
674 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,
675 9, 10, 0, 5, 0, 0, 0, 0, 0, 0,
676 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
677 0, 0, 0, 0, 0, 0, 0, 0, 47, 0,
678 0, 0, 59, 0, 0, 0, 62, 13, 0, 0,
679 14, 0, 0, 0, 35, 0, 0, 41, 0, 0,
680 0, 38, 0, 0, 44, 0, 0, 50, 0, 0,
681 53, 0, 0, 56, 0, 0, 89, 4, 65, 66,
682 17, 18, 19, 20, 21, 22, 23, 24, 25, 0,
683 0, 30, 0, 0, 0, 0, 0, 0, 86, 87,
684 0, 0, 0, 0, 79, 0, 0, 0, 0, 82,
685 0, 0, 0, 0, 0, 0, 0, 0, 73, 0,
686 0, 0, 0, 0, 0, 76, 0, 0, 0, 0,
687 0, 0, 0, 0, 0, 0, 67, 0, 0, 70,
688 27, 32, 26, 31, 28, 33, 29, 34, 48, 49,
689 0, 0, 60, 61, 0, 0, 63, 64, 15, 16,
690 36, 37, 0, 0, 42, 43, 39, 40, 0, 0,
691 45, 46, 51, 52, 54, 55, 57, 58, 0, 0,
692 0, 0, 80, 81, 83, 84, 74, 75, 77, 78,
693 68, 69, 71, 72
694 };
695
696 /* YYDEFGOTO[NTERM-NUM]. */
697 static const yytype_int8 yydefgoto[] =
698 {
699 -1, 1, 8, 9, 20, 21, 22, 127
700 };
701
702 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
703 STATE-NUM. */
704 #define YYPACT_NINF -20
705 static const yytype_int16 yypact[] =
706 {
707 -20, 10, -20, -20, 1, 210, 210, 210, -20, 3,
708 -20, 17, -20, -10, -2, 29, 63, 120, 192, 89,
709 -20, 83, 31, 34, 46, 67, 65, 68, 74, 72,
710 77, 87, 81, 101, 102, 105, 106, 115, 25, 125,
711 134, 141, 116, 118, -20, 188, 70, 162, 15, 231,
712 54, 240, -1, 249, 258, 267, 276, 51, 109, -20,
713 -20, -20, 107, -20, 15, 15, 15, 15, 15, 15,
714 15, 15, 15, 15, 15, 152, 132, 15, 153, 139,
715 156, 157, 160, 163, 15, 15, 164, 167, -20, 285,
716 166, 168, -20, 294, 173, 172, -20, -20, 175, 174,
717 -20, 178, 180, 303, -20, 190, 186, -20, 202, 205,
718 312, -20, 204, 207, -20, 211, 208, -20, 212, 216,
719 -20, 219, 220, -20, 321, 330, -20, -20, -20, -20,
720 -20, -20, -20, -20, -20, -20, -20, -20, -20, 15,
721 15, -20, 15, 15, 15, 15, 15, 15, -20, -20,
722 15, 15, 221, 226, -20, 15, 15, 223, 229, -20,
723 15, 15, 15, 15, 15, 15, 234, 235, -20, 15,
724 15, 15, 15, 243, 238, -20, 15, 15, 15, 15,
725 15, 15, 15, 15, 246, 247, -20, 252, 253, -20,
726 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
727 15, 15, -20, -20, 15, 15, -20, -20, -20, -20,
728 -20, -20, 15, 15, -20, -20, -20, -20, 15, 15,
729 -20, -20, -20, -20, -20, -20, -20, -20, 15, 15,
730 15, 15, -20, -20, -20, -20, -20, -20, -20, -20,
731 -20, -20, -20, -20
732 };
733
734 /* YYPGOTO[NTERM-NUM]. */
735 static const yytype_int8 yypgoto[] =
736 {
737 -20, -20, -20, -20, 0, -19, 53, -20
738 };
739
740 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
741 positive, shift that token. If negative, reduce the rule which
742 number is the opposite. If YYTABLE_NINF, syntax error. */
743 #define YYTABLE_NINF -1
744 static const yytype_uint8 yytable[] =
745 {
746 44, 10, 12, 27, 11, 28, 5, 25, 6, 7,
747 2, 29, 108, 30, 109, 3, 4, 5, 12, 6,
748 7, 26, 5, 110, 6, 7, 88, 92, 96, 97,
749 100, 104, 107, 111, 114, 117, 120, 123, 75, 59,
750 76, 77, 31, 60, 32, 128, 129, 130, 131, 132,
751 133, 134, 135, 136, 137, 138, 61, 12, 141, 23,
752 24, 5, 126, 6, 7, 148, 149, 101, 63, 102,
753 154, 103, 62, 12, 159, 89, 33, 5, 34, 6,
754 7, 124, 64, 90, 168, 91, 66, 45, 46, 47,
755 65, 175, 12, 67, 48, 49, 5, 69, 6, 7,
756 50, 68, 42, 51, 43, 186, 189, 52, 53, 54,
757 55, 56, 57, 58, 5, 70, 6, 7, 71, 72,
758 190, 191, 73, 192, 193, 194, 195, 196, 197, 74,
759 84, 198, 199, 35, 85, 36, 202, 203, 78, 125,
760 79, 206, 207, 208, 209, 210, 211, 80, 140, 81,
761 214, 215, 216, 217, 82, 143, 83, 220, 221, 222,
762 223, 224, 225, 226, 227, 12, 139, 142, 93, 5,
763 144, 6, 7, 145, 146, 94, 0, 95, 150, 147,
764 155, 232, 233, 151, 156, 234, 235, 160, 161, 162,
765 163, 12, 164, 236, 237, 5, 165, 6, 7, 238,
766 239, 86, 170, 87, 169, 37, 0, 38, 39, 240,
767 241, 242, 243, 12, 40, 41, 171, 5, 176, 6,
768 7, 172, 13, 177, 179, 178, 180, 14, 15, 16,
769 17, 18, 181, 182, 12, 200, 183, 204, 5, 19,
770 6, 7, 201, 12, 98, 205, 99, 5, 212, 6,
771 7, 213, 12, 105, 219, 106, 5, 218, 6, 7,
772 228, 12, 112, 229, 113, 5, 230, 6, 7, 231,
773 12, 115, 0, 116, 5, 0, 6, 7, 0, 12,
774 118, 0, 119, 5, 0, 6, 7, 0, 12, 121,
775 0, 122, 5, 0, 6, 7, 0, 12, 152, 0,
776 153, 5, 0, 6, 7, 0, 12, 157, 0, 158,
777 5, 0, 6, 7, 0, 12, 166, 0, 167, 5,
778 0, 6, 7, 0, 12, 173, 0, 174, 5, 0,
779 6, 7, 0, 12, 184, 0, 185, 5, 0, 6,
780 7, 0, 0, 187, 0, 188
781 };
782
783 #define yypact_value_is_default(yystate) \
784 ((yystate) == (-20))
785
786 #define yytable_value_is_error(yytable_value) \
787 YYID (0)
788
789 static const yytype_int16 yycheck[] =
790 {
791 19, 1, 3, 13, 3, 15, 7, 4, 9, 10,
792 0, 13, 13, 15, 15, 5, 6, 7, 3, 9,
793 10, 4, 7, 24, 9, 10, 45, 46, 47, 48,
794 49, 50, 51, 52, 53, 54, 55, 56, 13, 8,
795 15, 16, 13, 9, 15, 64, 65, 66, 67, 68,
796 69, 70, 71, 72, 73, 74, 10, 3, 77, 6,
797 7, 7, 62, 9, 10, 84, 85, 13, 3, 15,
798 89, 17, 5, 3, 93, 5, 13, 7, 15, 9,
799 10, 30, 14, 13, 103, 15, 14, 4, 5, 6,
800 16, 110, 3, 16, 11, 12, 7, 16, 9, 10,
801 17, 14, 13, 20, 15, 124, 125, 24, 25, 26,
802 27, 28, 29, 30, 7, 14, 9, 10, 16, 14,
803 139, 140, 16, 142, 143, 144, 145, 146, 147, 14,
804 14, 150, 151, 13, 16, 15, 155, 156, 13, 30,
805 15, 160, 161, 162, 163, 164, 165, 13, 16, 15,
806 169, 170, 171, 172, 13, 16, 15, 176, 177, 178,
807 179, 180, 181, 182, 183, 3, 14, 14, 6, 7,
808 14, 9, 10, 16, 14, 13, -1, 15, 14, 16,
809 14, 200, 201, 16, 16, 204, 205, 14, 16, 14,
810 16, 3, 14, 212, 213, 7, 16, 9, 10, 218,
811 219, 13, 16, 15, 14, 13, -1, 15, 16, 228,
812 229, 230, 231, 3, 22, 23, 14, 7, 14, 9,
813 10, 16, 12, 16, 16, 14, 14, 17, 18, 19,
814 20, 21, 16, 14, 3, 14, 16, 14, 7, 29,
815 9, 10, 16, 3, 13, 16, 15, 7, 14, 9,
816 10, 16, 3, 13, 16, 15, 7, 14, 9, 10,
817 14, 3, 13, 16, 15, 7, 14, 9, 10, 16,
818 3, 13, -1, 15, 7, -1, 9, 10, -1, 3,
819 13, -1, 15, 7, -1, 9, 10, -1, 3, 13,
820 -1, 15, 7, -1, 9, 10, -1, 3, 13, -1,
821 15, 7, -1, 9, 10, -1, 3, 13, -1, 15,
822 7, -1, 9, 10, -1, 3, 13, -1, 15, 7,
823 -1, 9, 10, -1, 3, 13, -1, 15, 7, -1,
824 9, 10, -1, 3, 13, -1, 15, 7, -1, 9,
825 10, -1, -1, 13, -1, 15
826 };
827
828 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
829 symbol of state STATE-NUM. */
830 static const yytype_uint8 yystos[] =
831 {
832 0, 32, 0, 5, 6, 7, 9, 10, 33, 34,
833 35, 3, 3, 12, 17, 18, 19, 20, 21, 29,
834 35, 36, 37, 37, 37, 4, 4, 13, 15, 13,
835 15, 13, 15, 13, 15, 13, 15, 13, 15, 16,
836 22, 23, 13, 15, 36, 4, 5, 6, 11, 12,
837 17, 20, 24, 25, 26, 27, 28, 29, 30, 8,
838 9, 10, 5, 3, 14, 16, 14, 16, 14, 16,
839 14, 16, 14, 16, 14, 13, 15, 16, 13, 15,
840 13, 15, 13, 15, 14, 16, 13, 15, 36, 5,
841 13, 15, 36, 6, 13, 15, 36, 36, 13, 15,
842 36, 13, 15, 17, 36, 13, 15, 36, 13, 15,
843 24, 36, 13, 15, 36, 13, 15, 36, 13, 15,
844 36, 13, 15, 36, 30, 30, 35, 38, 36, 36,
845 36, 36, 36, 36, 36, 36, 36, 36, 36, 14,
846 16, 36, 14, 16, 14, 16, 14, 16, 36, 36,
847 14, 16, 13, 15, 36, 14, 16, 13, 15, 36,
848 14, 16, 14, 16, 14, 16, 13, 15, 36, 14,
849 16, 14, 16, 13, 15, 36, 14, 16, 14, 16,
850 14, 16, 14, 16, 13, 15, 36, 13, 15, 36,
851 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
852 14, 16, 36, 36, 14, 16, 36, 36, 36, 36,
853 36, 36, 14, 16, 36, 36, 36, 36, 14, 16,
854 36, 36, 36, 36, 36, 36, 36, 36, 14, 16,
855 14, 16, 36, 36, 36, 36, 36, 36, 36, 36,
856 36, 36, 36, 36
857 };
858
859 #define yyerrok (yyerrstatus = 0)
860 #define yyclearin (yychar = YYEMPTY)
861 #define YYEMPTY (-2)
862 #define YYEOF 0
863
864 #define YYACCEPT goto yyacceptlab
865 #define YYABORT goto yyabortlab
866 #define YYERROR goto yyerrorlab
867
868
869 /* Like YYERROR except do call yyerror. This remains here temporarily
870 to ease the transition to the new meaning of YYERROR, for GCC.
871 Once GCC version 2 has supplanted version 1, this can go. However,
872 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
873 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
874 discussed. */
875
876 #define YYFAIL goto yyerrlab
877 #if defined YYFAIL
878 /* This is here to suppress warnings from the GCC cpp's
879 -Wunused-macros. Normally we don't worry about that warning, but
880 some users do, and we want to make it easy for users to remove
881 YYFAIL uses, which will produce warnings from Bison 2.5. */
882 #endif
883
884 #define YYRECOVERING() (!!yyerrstatus)
885
886 #define YYBACKUP(Token, Value) \
887 do \
888 if (yychar == YYEMPTY && yylen == 1) \
889 { \
890 yychar = (Token); \
891 yylval = (Value); \
892 YYPOPSTACK (1); \
893 goto yybackup; \
894 } \
895 else \
896 { \
897 yyerror (YY_("syntax error: cannot back up")); \
898 YYERROR; \
899 } \
900 while (YYID (0))
901
902
903 #define YYTERROR 1
904 #define YYERRCODE 256
905
906
907 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
908 If N is 0, then set CURRENT to the empty location which ends
909 the previous symbol: RHS[0] (always defined). */
910
911 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
912 #ifndef YYLLOC_DEFAULT
913 # define YYLLOC_DEFAULT(Current, Rhs, N) \
914 do \
915 if (YYID (N)) \
916 { \
917 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
918 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
919 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
920 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
921 } \
922 else \
923 { \
924 (Current).first_line = (Current).last_line = \
925 YYRHSLOC (Rhs, 0).last_line; \
926 (Current).first_column = (Current).last_column = \
927 YYRHSLOC (Rhs, 0).last_column; \
928 } \
929 while (YYID (0))
930 #endif
931
932
933 /* This macro is provided for backward compatibility. */
934
935 #ifndef YY_LOCATION_PRINT
936 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
937 #endif
938
939
940 /* YYLEX -- calling `yylex' with the right arguments. */
941
942 #ifdef YYLEX_PARAM
943 # define YYLEX yylex (YYLEX_PARAM)
944 #else
945 # define YYLEX yylex ()
946 #endif
947
948 /* Enable debugging if requested. */
949 #if YYDEBUG
950
951 # ifndef YYFPRINTF
952 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
953 # define YYFPRINTF fprintf
954 # endif
955
956 # define YYDPRINTF(Args) \
957 do { \
958 if (yydebug) \
959 YYFPRINTF Args; \
960 } while (YYID (0))
961
962 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
963 do { \
964 if (yydebug) \
965 { \
966 YYFPRINTF (stderr, "%s ", Title); \
967 yy_symbol_print (stderr, \
968 Type, Value); \
969 YYFPRINTF (stderr, "\n"); \
970 } \
971 } while (YYID (0))
972
973
974 /*--------------------------------.
975 | Print this symbol on YYOUTPUT. |
976 `--------------------------------*/
977
978 /*ARGSUSED*/
979 #if (defined __STDC__ || defined __C99__FUNC__ \
980 || defined __cplusplus || defined _MSC_VER)
981 static void
982 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
983 #else
984 static void
985 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
986 FILE *yyoutput;
987 int yytype;
988 YYSTYPE const * const yyvaluep;
989 #endif
990 {
991 if (!yyvaluep)
992 return;
993 # ifdef YYPRINT
994 if (yytype < YYNTOKENS)
995 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
996 # else
997 YYUSE (yyoutput);
998 # endif
999 switch (yytype)
1000 {
1001 default:
1002 break;
1003 }
1004 }
1005
1006
1007 /*--------------------------------.
1008 | Print this symbol on YYOUTPUT. |
1009 `--------------------------------*/
1010
1011 #if (defined __STDC__ || defined __C99__FUNC__ \
1012 || defined __cplusplus || defined _MSC_VER)
1013 static void
1014 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1015 #else
1016 static void
1017 yy_symbol_print (yyoutput, yytype, yyvaluep)
1018 FILE *yyoutput;
1019 int yytype;
1020 YYSTYPE const * const yyvaluep;
1021 #endif
1022 {
1023 if (yytype < YYNTOKENS)
1024 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1025 else
1026 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1027
1028 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1029 YYFPRINTF (yyoutput, ")");
1030 }
1031
1032 /*------------------------------------------------------------------.
1033 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1034 | TOP (included). |
1035 `------------------------------------------------------------------*/
1036
1037 #if (defined __STDC__ || defined __C99__FUNC__ \
1038 || defined __cplusplus || defined _MSC_VER)
1039 static void
1040 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1041 #else
1042 static void
1043 yy_stack_print (yybottom, yytop)
1044 yytype_int16 *yybottom;
1045 yytype_int16 *yytop;
1046 #endif
1047 {
1048 YYFPRINTF (stderr, "Stack now");
1049 for (; yybottom <= yytop; yybottom++)
1050 {
1051 int yybot = *yybottom;
1052 YYFPRINTF (stderr, " %d", yybot);
1053 }
1054 YYFPRINTF (stderr, "\n");
1055 }
1056
1057 # define YY_STACK_PRINT(Bottom, Top) \
1058 do { \
1059 if (yydebug) \
1060 yy_stack_print ((Bottom), (Top)); \
1061 } while (YYID (0))
1062
1063
1064 /*------------------------------------------------.
1065 | Report that the YYRULE is going to be reduced. |
1066 `------------------------------------------------*/
1067
1068 #if (defined __STDC__ || defined __C99__FUNC__ \
1069 || defined __cplusplus || defined _MSC_VER)
1070 static void
1071 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1072 #else
1073 static void
1074 yy_reduce_print (yyvsp, yyrule)
1075 YYSTYPE *yyvsp;
1076 int yyrule;
1077 #endif
1078 {
1079 int yynrhs = yyr2[yyrule];
1080 int yyi;
1081 unsigned long int yylno = yyrline[yyrule];
1082 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1083 yyrule - 1, yylno);
1084 /* The symbols being reduced. */
1085 for (yyi = 0; yyi < yynrhs; yyi++)
1086 {
1087 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1088 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1089 &(yyvsp[(yyi + 1) - (yynrhs)])
1090 );
1091 YYFPRINTF (stderr, "\n");
1092 }
1093 }
1094
1095 # define YY_REDUCE_PRINT(Rule) \
1096 do { \
1097 if (yydebug) \
1098 yy_reduce_print (yyvsp, Rule); \
1099 } while (YYID (0))
1100
1101 /* Nonzero means print parse trace. It is left uninitialized so that
1102 multiple parsers can coexist. */
1103 int yydebug;
1104 #else /* !YYDEBUG */
1105 # define YYDPRINTF(Args)
1106 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1107 # define YY_STACK_PRINT(Bottom, Top)
1108 # define YY_REDUCE_PRINT(Rule)
1109 #endif /* !YYDEBUG */
1110
1111
1112 /* YYINITDEPTH -- initial size of the parser's stacks. */
1113 #ifndef YYINITDEPTH
1114 # define YYINITDEPTH 200
1115 #endif
1116
1117 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1118 if the built-in stack extension method is used).
1119
1120 Do not make this value too large; the results are undefined if
1121 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1122 evaluated with infinite-precision integer arithmetic. */
1123
1124 #ifndef YYMAXDEPTH
1125 # define YYMAXDEPTH 10000
1126 #endif
1127
1128
1129 #if YYERROR_VERBOSE
1130
1131 # ifndef yystrlen
1132 # if defined __GLIBC__ && defined _STRING_H
1133 # define yystrlen strlen
1134 # else
1135 /* Return the length of YYSTR. */
1136 #if (defined __STDC__ || defined __C99__FUNC__ \
1137 || defined __cplusplus || defined _MSC_VER)
1138 static YYSIZE_T
1139 yystrlen (const char *yystr)
1140 #else
1141 static YYSIZE_T
1142 yystrlen (yystr)
1143 const char *yystr;
1144 #endif
1145 {
1146 YYSIZE_T yylen;
1147 for (yylen = 0; yystr[yylen]; yylen++)
1148 continue;
1149 return yylen;
1150 }
1151 # endif
1152 # endif
1153
1154 # ifndef yystpcpy
1155 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1156 # define yystpcpy stpcpy
1157 # else
1158 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1159 YYDEST. */
1160 #if (defined __STDC__ || defined __C99__FUNC__ \
1161 || defined __cplusplus || defined _MSC_VER)
1162 static char *
1163 yystpcpy (char *yydest, const char *yysrc)
1164 #else
1165 static char *
1166 yystpcpy (yydest, yysrc)
1167 char *yydest;
1168 const char *yysrc;
1169 #endif
1170 {
1171 char *yyd = yydest;
1172 const char *yys = yysrc;
1173
1174 while ((*yyd++ = *yys++) != '\0')
1175 continue;
1176
1177 return yyd - 1;
1178 }
1179 # endif
1180 # endif
1181
1182 # ifndef yytnamerr
1183 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1184 quotes and backslashes, so that it's suitable for yyerror. The
1185 heuristic is that double-quoting is unnecessary unless the string
1186 contains an apostrophe, a comma, or backslash (other than
1187 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1188 null, do not copy; instead, return the length of what the result
1189 would have been. */
1190 static YYSIZE_T
1191 yytnamerr (char *yyres, const char *yystr)
1192 {
1193 if (*yystr == '"')
1194 {
1195 YYSIZE_T yyn = 0;
1196 char const *yyp = yystr;
1197
1198 for (;;)
1199 switch (*++yyp)
1200 {
1201 case '\'':
1202 case ',':
1203 goto do_not_strip_quotes;
1204
1205 case '\\':
1206 if (*++yyp != '\\')
1207 goto do_not_strip_quotes;
1208 /* Fall through. */
1209 default:
1210 if (yyres)
1211 yyres[yyn] = *yyp;
1212 yyn++;
1213 break;
1214
1215 case '"':
1216 if (yyres)
1217 yyres[yyn] = '\0';
1218 return yyn;
1219 }
1220 do_not_strip_quotes: ;
1221 }
1222
1223 if (! yyres)
1224 return yystrlen (yystr);
1225
1226 return yystpcpy (yyres, yystr) - yyres;
1227 }
1228 # endif
1229
1230 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1231 about the unexpected token YYTOKEN for the state stack whose top is
1232 YYSSP.
1233
1234 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1235 not large enough to hold the message. In that case, also set
1236 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1237 required number of bytes is too large to store. */
1238 static int
1239 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1240 yytype_int16 *yyssp, int yytoken)
1241 {
1242 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1243 YYSIZE_T yysize = yysize0;
1244 YYSIZE_T yysize1;
1245 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1246 /* Internationalized format string. */
1247 const char *yyformat = 0;
1248 /* Arguments of yyformat. */
1249 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1250 /* Number of reported tokens (one for the "unexpected", one per
1251 "expected"). */
1252 int yycount = 0;
1253
1254 /* There are many possibilities here to consider:
1255 - Assume YYFAIL is not used. It's too flawed to consider. See
1256 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1257 for details. YYERROR is fine as it does not invoke this
1258 function.
1259 - If this state is a consistent state with a default action, then
1260 the only way this function was invoked is if the default action
1261 is an error action. In that case, don't check for expected
1262 tokens because there are none.
1263 - The only way there can be no lookahead present (in yychar) is if
1264 this state is a consistent state with a default action. Thus,
1265 detecting the absence of a lookahead is sufficient to determine
1266 that there is no unexpected or expected token to report. In that
1267 case, just report a simple "syntax error".
1268 - Don't assume there isn't a lookahead just because this state is a
1269 consistent state with a default action. There might have been a
1270 previous inconsistent state, consistent state with a non-default
1271 action, or user semantic action that manipulated yychar.
1272 - Of course, the expected token list depends on states to have
1273 correct lookahead information, and it depends on the parser not
1274 to perform extra reductions after fetching a lookahead from the
1275 scanner and before detecting a syntax error. Thus, state merging
1276 (from LALR or IELR) and default reductions corrupt the expected
1277 token list. However, the list is correct for canonical LR with
1278 one exception: it will still contain any token that will not be
1279 accepted due to an error action in a later state.
1280 */
1281 if (yytoken != YYEMPTY)
1282 {
1283 int yyn = yypact[*yyssp];
1284 yyarg[yycount++] = yytname[yytoken];
1285 if (!yypact_value_is_default (yyn))
1286 {
1287 /* Start YYX at -YYN if negative to avoid negative indexes in
1288 YYCHECK. In other words, skip the first -YYN actions for
1289 this state because they are default actions. */
1290 int yyxbegin = yyn < 0 ? -yyn : 0;
1291 /* Stay within bounds of both yycheck and yytname. */
1292 int yychecklim = YYLAST - yyn + 1;
1293 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1294 int yyx;
1295
1296 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1297 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1298 && !yytable_value_is_error (yytable[yyx + yyn]))
1299 {
1300 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1301 {
1302 yycount = 1;
1303 yysize = yysize0;
1304 break;
1305 }
1306 yyarg[yycount++] = yytname[yyx];
1307 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1308 if (! (yysize <= yysize1
1309 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1310 return 2;
1311 yysize = yysize1;
1312 }
1313 }
1314 }
1315
1316 switch (yycount)
1317 {
1318 # define YYCASE_(N, S) \
1319 case N: \
1320 yyformat = S; \
1321 break
1322 YYCASE_(0, YY_("syntax error"));
1323 YYCASE_(1, YY_("syntax error, unexpected %s"));
1324 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1325 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1326 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1327 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1328 # undef YYCASE_
1329 }
1330
1331 yysize1 = yysize + yystrlen (yyformat);
1332 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1333 return 2;
1334 yysize = yysize1;
1335
1336 if (*yymsg_alloc < yysize)
1337 {
1338 *yymsg_alloc = 2 * yysize;
1339 if (! (yysize <= *yymsg_alloc
1340 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1341 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1342 return 1;
1343 }
1344
1345 /* Avoid sprintf, as that infringes on the user's name space.
1346 Don't have undefined behavior even if the translation
1347 produced a string with the wrong number of "%s"s. */
1348 {
1349 char *yyp = *yymsg;
1350 int yyi = 0;
1351 while ((*yyp = *yyformat) != '\0')
1352 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1353 {
1354 yyp += yytnamerr (yyp, yyarg[yyi++]);
1355 yyformat += 2;
1356 }
1357 else
1358 {
1359 yyp++;
1360 yyformat++;
1361 }
1362 }
1363 return 0;
1364 }
1365 #endif /* YYERROR_VERBOSE */
1366
1367 /*-----------------------------------------------.
1368 | Release the memory associated to this symbol. |
1369 `-----------------------------------------------*/
1370
1371 /*ARGSUSED*/
1372 #if (defined __STDC__ || defined __C99__FUNC__ \
1373 || defined __cplusplus || defined _MSC_VER)
1374 static void
1375 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1376 #else
1377 static void
1378 yydestruct (yymsg, yytype, yyvaluep)
1379 const char *yymsg;
1380 int yytype;
1381 YYSTYPE *yyvaluep;
1382 #endif
1383 {
1384 YYUSE (yyvaluep);
1385
1386 if (!yymsg)
1387 yymsg = "Deleting";
1388 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1389
1390 switch (yytype)
1391 {
1392
1393 default:
1394 break;
1395 }
1396 }
1397
1398
1399 /* Prevent warnings from -Wmissing-prototypes. */
1400 #ifdef YYPARSE_PARAM
1401 #if defined __STDC__ || defined __cplusplus
1402 int yyparse (void *YYPARSE_PARAM);
1403 #else
1404 int yyparse ();
1405 #endif
1406 #else /* ! YYPARSE_PARAM */
1407 #if defined __STDC__ || defined __cplusplus
1408 int yyparse (void);
1409 #else
1410 int yyparse ();
1411 #endif
1412 #endif /* ! YYPARSE_PARAM */
1413
1414
1415 /* The lookahead symbol. */
1416 int yychar;
1417
1418 /* The semantic value of the lookahead symbol. */
1419 YYSTYPE yylval;
1420
1421 /* Number of syntax errors so far. */
1422 int yynerrs;
1423
1424
1425 /*----------.
1426 | yyparse. |
1427 `----------*/
1428
1429 #ifdef YYPARSE_PARAM
1430 #if (defined __STDC__ || defined __C99__FUNC__ \
1431 || defined __cplusplus || defined _MSC_VER)
1432 int
1433 yyparse (void *YYPARSE_PARAM)
1434 #else
1435 int
1436 yyparse (YYPARSE_PARAM)
1437 void *YYPARSE_PARAM;
1438 #endif
1439 #else /* ! YYPARSE_PARAM */
1440 #if (defined __STDC__ || defined __C99__FUNC__ \
1441 || defined __cplusplus || defined _MSC_VER)
1442 int
1443 yyparse (void)
1444 #else
1445 int
1446 yyparse ()
1447
1448 #endif
1449 #endif
1450 {
1451 int yystate;
1452 /* Number of tokens to shift before error messages enabled. */
1453 int yyerrstatus;
1454
1455 /* The stacks and their tools:
1456 `yyss': related to states.
1457 `yyvs': related to semantic values.
1458
1459 Refer to the stacks thru separate pointers, to allow yyoverflow
1460 to reallocate them elsewhere. */
1461
1462 /* The state stack. */
1463 yytype_int16 yyssa[YYINITDEPTH];
1464 yytype_int16 *yyss;
1465 yytype_int16 *yyssp;
1466
1467 /* The semantic value stack. */
1468 YYSTYPE yyvsa[YYINITDEPTH];
1469 YYSTYPE *yyvs;
1470 YYSTYPE *yyvsp;
1471
1472 YYSIZE_T yystacksize;
1473
1474 int yyn;
1475 int yyresult;
1476 /* Lookahead token as an internal (translated) token number. */
1477 int yytoken;
1478 /* The variables used to return semantic value and location from the
1479 action routines. */
1480 YYSTYPE yyval;
1481
1482 #if YYERROR_VERBOSE
1483 /* Buffer for error messages, and its allocated size. */
1484 char yymsgbuf[128];
1485 char *yymsg = yymsgbuf;
1486 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1487 #endif
1488
1489 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1490
1491 /* The number of symbols on the RHS of the reduced rule.
1492 Keep to zero when no symbol should be popped. */
1493 int yylen = 0;
1494
1495 yytoken = 0;
1496 yyss = yyssa;
1497 yyvs = yyvsa;
1498 yystacksize = YYINITDEPTH;
1499
1500 YYDPRINTF ((stderr, "Starting parse\n"));
1501
1502 yystate = 0;
1503 yyerrstatus = 0;
1504 yynerrs = 0;
1505 yychar = YYEMPTY; /* Cause a token to be read. */
1506
1507 /* Initialize stack pointers.
1508 Waste one element of value and location stack
1509 so that they stay on the same level as the state stack.
1510 The wasted elements are never initialized. */
1511 yyssp = yyss;
1512 yyvsp = yyvs;
1513
1514 goto yysetstate;
1515
1516 /*------------------------------------------------------------.
1517 | yynewstate -- Push a new state, which is found in yystate. |
1518 `------------------------------------------------------------*/
1519 yynewstate:
1520 /* In all cases, when you get here, the value and location stacks
1521 have just been pushed. So pushing a state here evens the stacks. */
1522 yyssp++;
1523
1524 yysetstate:
1525 *yyssp = yystate;
1526
1527 if (yyss + yystacksize - 1 <= yyssp)
1528 {
1529 /* Get the current used size of the three stacks, in elements. */
1530 YYSIZE_T yysize = yyssp - yyss + 1;
1531
1532 #ifdef yyoverflow
1533 {
1534 /* Give user a chance to reallocate the stack. Use copies of
1535 these so that the &'s don't force the real ones into
1536 memory. */
1537 YYSTYPE *yyvs1 = yyvs;
1538 yytype_int16 *yyss1 = yyss;
1539
1540 /* Each stack pointer address is followed by the size of the
1541 data in use in that stack, in bytes. This used to be a
1542 conditional around just the two extra args, but that might
1543 be undefined if yyoverflow is a macro. */
1544 yyoverflow (YY_("memory exhausted"),
1545 &yyss1, yysize * sizeof (*yyssp),
1546 &yyvs1, yysize * sizeof (*yyvsp),
1547 &yystacksize);
1548
1549 yyss = yyss1;
1550 yyvs = yyvs1;
1551 }
1552 #else /* no yyoverflow */
1553 # ifndef YYSTACK_RELOCATE
1554 goto yyexhaustedlab;
1555 # else
1556 /* Extend the stack our own way. */
1557 if (YYMAXDEPTH <= yystacksize)
1558 goto yyexhaustedlab;
1559 yystacksize *= 2;
1560 if (YYMAXDEPTH < yystacksize)
1561 yystacksize = YYMAXDEPTH;
1562
1563 {
1564 yytype_int16 *yyss1 = yyss;
1565 union yyalloc *yyptr =
1566 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1567 if (! yyptr)
1568 goto yyexhaustedlab;
1569 YYSTACK_RELOCATE (yyss_alloc, yyss);
1570 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1571 # undef YYSTACK_RELOCATE
1572 if (yyss1 != yyssa)
1573 YYSTACK_FREE (yyss1);
1574 }
1575 # endif
1576 #endif /* no yyoverflow */
1577
1578 yyssp = yyss + yysize - 1;
1579 yyvsp = yyvs + yysize - 1;
1580
1581 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1582 (unsigned long int) yystacksize));
1583
1584 if (yyss + yystacksize - 1 <= yyssp)
1585 YYABORT;
1586 }
1587
1588 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1589
1590 if (yystate == YYFINAL)
1591 YYACCEPT;
1592
1593 goto yybackup;
1594
1595 /*-----------.
1596 | yybackup. |
1597 `-----------*/
1598 yybackup:
1599
1600 /* Do appropriate processing given the current state. Read a
1601 lookahead token if we need one and don't already have one. */
1602
1603 /* First try to decide what to do without reference to lookahead token. */
1604 yyn = yypact[yystate];
1605 if (yypact_value_is_default (yyn))
1606 goto yydefault;
1607
1608 /* Not known => get a lookahead token if don't already have one. */
1609
1610 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1611 if (yychar == YYEMPTY)
1612 {
1613 YYDPRINTF ((stderr, "Reading a token: "));
1614 yychar = YYLEX;
1615 }
1616
1617 if (yychar <= YYEOF)
1618 {
1619 yychar = yytoken = YYEOF;
1620 YYDPRINTF ((stderr, "Now at end of input.\n"));
1621 }
1622 else
1623 {
1624 yytoken = YYTRANSLATE (yychar);
1625 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1626 }
1627
1628 /* If the proper action on seeing token YYTOKEN is to reduce or to
1629 detect an error, take that action. */
1630 yyn += yytoken;
1631 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1632 goto yydefault;
1633 yyn = yytable[yyn];
1634 if (yyn <= 0)
1635 {
1636 if (yytable_value_is_error (yyn))
1637 goto yyerrlab;
1638 yyn = -yyn;
1639 goto yyreduce;
1640 }
1641
1642 /* Count tokens shifted since error; after three, turn off error
1643 status. */
1644 if (yyerrstatus)
1645 yyerrstatus--;
1646
1647 /* Shift the lookahead token. */
1648 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1649
1650 /* Discard the shifted token. */
1651 yychar = YYEMPTY;
1652
1653 yystate = yyn;
1654 *++yyvsp = yylval;
1655
1656 goto yynewstate;
1657
1658
1659 /*-----------------------------------------------------------.
1660 | yydefault -- do the default action for the current state. |
1661 `-----------------------------------------------------------*/
1662 yydefault:
1663 yyn = yydefact[yystate];
1664 if (yyn == 0)
1665 goto yyerrlab;
1666 goto yyreduce;
1667
1668
1669 /*-----------------------------.
1670 | yyreduce -- Do a reduction. |
1671 `-----------------------------*/
1672 yyreduce:
1673 /* yyn is the number of a rule to reduce with. */
1674 yylen = yyr2[yyn];
1675
1676 /* If YYLEN is nonzero, implement the default value of the action:
1677 `$$ = $1'.
1678
1679 Otherwise, the following line sets YYVAL to garbage.
1680 This behavior is undocumented and Bison
1681 users should not rely upon it. Assigning to YYVAL
1682 unconditionally makes the parser a bit smaller, and it avoids a
1683 GCC warning that YYVAL may be used uninitialized. */
1684 yyval = yyvsp[1-yylen];
1685
1686
1687 YY_REDUCE_PRINT (yyn);
1688 switch (yyn)
1689 {
1690 case 4:
1691
1692 /* Line 1806 of yacc.c */
1693 #line 201 "oil.y"
1694 {
1695 static YYSTYPE tempmem[10];
1696 static int replcount[10];
1697 /* Handle splitting the file. */
1698 if(splitcount) splitcount--;
1699 if(!splitcount && !inloop)
1700 {
1701 splitcount=SPLITMAX;
1702 splitend();
1703 ++filenumber;
1704 splitstart();
1705 }
1706 /* This is where we actually generate the optimizer code. */
1707 /* Tree-shape and is-constant conditions */
1708 printf(" checknodeactbits(np);\n");
1709 if(treeshapecond((yyvsp[(1) - (4)]),1)) printf(" if(1"); printf(")\n do\n {\n");
1710 /* Nodesame and cxdata conditions */
1711 {
1712 int i=10;
1713 YYSTYPE temp;
1714 while(--i)
1715 {
1716 temp=treenscheck((yyvsp[(1) - (4)]),0,i);
1717 if(temp)
1718 {
1719 printf(" x%d=np",i);
1720 gennodepath(temp->depth,temp->path);
1721 printf("->constant; c%d=np",i);
1722 gennodepath(temp->depth,temp->path);
1723 printf("->optdata;\n");
1724 }
1725 tempmem[i]=temp;
1726 replcount[i]=0; /* we need to zero this somewhere, may as well be here */
1727 }
1728 treecxcond((yyvsp[(1) - (4)]));
1729 }
1730 /* If we reach this point in the generated code, we have an optimizer
1731 template match. */
1732 printf(" OPTING(%s);\n",optname);
1733
1734 /* We now need to replace np with its replacement. This is done by creating
1735 a new nodetree, copying across tempmem'd nodes where necessary, and then
1736 substituting one for the other. (This is an inefficient but general way
1737 to do this.) One special case is needed; because pointers into the root
1738 node need to continue pointing there, the temporary node tp is copied
1739 member-for-member and then freed again. To make coding optimizations
1740 easier, the root stays as the same width no matter what. */
1741 printf(" tp=newnode();\n");
1742 treerepcount((yyvsp[(4) - (4)]),replcount);
1743 treerepgen((yyvsp[(4) - (4)]),tempmem,replcount);
1744 printf(" nodefree(np->lval); nodefree(np->rval);\n");
1745 printf(" tempw=np->width; *np=*tp; np->width=tempw; free(tp);\n");
1746 printf(" } while(0);\n\n");
1747 /* Free the template and replacement now they're finished being used. */
1748 treefree((yyvsp[(1) - (4)]));
1749 treefree((yyvsp[(4) - (4)]));
1750 }
1751 break;
1752
1753 case 5:
1754
1755 /* Line 1806 of yacc.c */
1756 #line 259 "oil.y"
1757 {
1758 if(!(yyvsp[(2) - (4)])->mustbemesh||!(yyvsp[(4) - (4)])->mustbemesh)
1759 {
1760 yyerror("syntax error in <#..#()->()> construct");
1761 free((yyvsp[(2) - (4)])); free((yyvsp[(4) - (4)]));
1762 YYERROR;
1763 }
1764 printf(" r=%luLU; while(r<=%luLU) {\n",(yyvsp[(2) - (4)])->c,(yyvsp[(4) - (4)])->c);
1765 free((yyvsp[(2) - (4)])); free((yyvsp[(4) - (4)]));
1766 inloop=1;
1767 }
1768 break;
1769
1770 case 6:
1771
1772 /* Line 1806 of yacc.c */
1773 #line 270 "oil.y"
1774 {printf(" r++;\n }\n"); inloop=0;}
1775 break;
1776
1777 case 8:
1778
1779 /* Line 1806 of yacc.c */
1780 #line 274 "oil.y"
1781 {(yyval)=(yyvsp[(2) - (3)]);}
1782 break;
1783
1784 case 9:
1785
1786 /* Line 1806 of yacc.c */
1787 #line 275 "oil.y"
1788 {(yyval)=(yyvsp[(2) - (3)]);}
1789 break;
1790
1791 case 10:
1792
1793 /* Line 1806 of yacc.c */
1794 #line 276 "oil.y"
1795 {(yyval)=(yyvsp[(2) - (3)]);}
1796 break;
1797
1798 case 13:
1799
1800 /* Line 1806 of yacc.c */
1801 #line 281 "oil.y"
1802 {BINARYEXPR("MINGLE",(yyval),(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),1);}
1803 break;
1804
1805 case 14:
1806
1807 /* Line 1806 of yacc.c */
1808 #line 282 "oil.y"
1809 {BINARYEXPR("SELECT",(yyval),(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),1);}
1810 break;
1811
1812 case 15:
1813
1814 /* Line 1806 of yacc.c */
1815 #line 283 "oil.y"
1816 {BINARYEXPR("SELECT",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),0);}
1817 break;
1818
1819 case 16:
1820
1821 /* Line 1806 of yacc.c */
1822 #line 284 "oil.y"
1823 {BINARYEXPR("SELECT",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),1);}
1824 break;
1825
1826 case 17:
1827
1828 /* Line 1806 of yacc.c */
1829 #line 285 "oil.y"
1830 {UNARYEXPR("AND",(yyval),(yyvsp[(4) - (4)]),0,1);}
1831 break;
1832
1833 case 18:
1834
1835 /* Line 1806 of yacc.c */
1836 #line 286 "oil.y"
1837 {UNARYEXPR("AND",(yyval),(yyvsp[(4) - (4)]),1,1);}
1838 break;
1839
1840 case 19:
1841
1842 /* Line 1806 of yacc.c */
1843 #line 287 "oil.y"
1844 {UNARYEXPR("OR",(yyval),(yyvsp[(4) - (4)]),0,1);}
1845 break;
1846
1847 case 20:
1848
1849 /* Line 1806 of yacc.c */
1850 #line 288 "oil.y"
1851 {UNARYEXPR("OR",(yyval),(yyvsp[(4) - (4)]),1,1);}
1852 break;
1853
1854 case 21:
1855
1856 /* Line 1806 of yacc.c */
1857 #line 289 "oil.y"
1858 {UNARYEXPR("XOR",(yyval),(yyvsp[(4) - (4)]),0,1);}
1859 break;
1860
1861 case 22:
1862
1863 /* Line 1806 of yacc.c */
1864 #line 290 "oil.y"
1865 {UNARYEXPR("XOR",(yyval),(yyvsp[(4) - (4)]),1,1);}
1866 break;
1867
1868 case 23:
1869
1870 /* Line 1806 of yacc.c */
1871 #line 291 "oil.y"
1872 {UNARYEXPR("FIN",(yyval),(yyvsp[(4) - (4)]),0,1);}
1873 break;
1874
1875 case 24:
1876
1877 /* Line 1806 of yacc.c */
1878 #line 292 "oil.y"
1879 {UNARYEXPR("FIN",(yyval),(yyvsp[(4) - (4)]),1,1);}
1880 break;
1881
1882 case 25:
1883
1884 /* Line 1806 of yacc.c */
1885 #line 293 "oil.y"
1886 {UNARYEXPR("WHIRL",(yyval),(yyvsp[(4) - (4)]),0,1);}
1887 break;
1888
1889 case 26:
1890
1891 /* Line 1806 of yacc.c */
1892 #line 294 "oil.y"
1893 {UNARYEXPR("WHIRL2",(yyval),(yyvsp[(5) - (5)]),0,1);}
1894 break;
1895
1896 case 27:
1897
1898 /* Line 1806 of yacc.c */
1899 #line 295 "oil.y"
1900 {UNARYEXPR("WHIRL3",(yyval),(yyvsp[(5) - (5)]),0,1);}
1901 break;
1902
1903 case 28:
1904
1905 /* Line 1806 of yacc.c */
1906 #line 296 "oil.y"
1907 {UNARYEXPR("WHIRL4",(yyval),(yyvsp[(5) - (5)]),0,1);}
1908 break;
1909
1910 case 29:
1911
1912 /* Line 1806 of yacc.c */
1913 #line 297 "oil.y"
1914 {UNARYEXPR("WHIRL5",(yyval),(yyvsp[(5) - (5)]),0,1);}
1915 break;
1916
1917 case 30:
1918
1919 /* Line 1806 of yacc.c */
1920 #line 298 "oil.y"
1921 {UNARYEXPR("WHIRL",(yyval),(yyvsp[(4) - (4)]),1,1);}
1922 break;
1923
1924 case 31:
1925
1926 /* Line 1806 of yacc.c */
1927 #line 299 "oil.y"
1928 {UNARYEXPR("WHIRL2",(yyval),(yyvsp[(5) - (5)]),1,1);}
1929 break;
1930
1931 case 32:
1932
1933 /* Line 1806 of yacc.c */
1934 #line 300 "oil.y"
1935 {UNARYEXPR("WHIRL3",(yyval),(yyvsp[(5) - (5)]),1,1);}
1936 break;
1937
1938 case 33:
1939
1940 /* Line 1806 of yacc.c */
1941 #line 301 "oil.y"
1942 {UNARYEXPR("WHIRL4",(yyval),(yyvsp[(5) - (5)]),1,1);}
1943 break;
1944
1945 case 34:
1946
1947 /* Line 1806 of yacc.c */
1948 #line 302 "oil.y"
1949 {UNARYEXPR("WHIRL5",(yyval),(yyvsp[(5) - (5)]),1,1);}
1950 break;
1951
1952 case 35:
1953
1954 /* Line 1806 of yacc.c */
1955 #line 303 "oil.y"
1956 {BINARYEXPR("C_AND",(yyval),(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),1);}
1957 break;
1958
1959 case 36:
1960
1961 /* Line 1806 of yacc.c */
1962 #line 304 "oil.y"
1963 {BINARYEXPR("C_AND",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),0);}
1964 break;
1965
1966 case 37:
1967
1968 /* Line 1806 of yacc.c */
1969 #line 305 "oil.y"
1970 {BINARYEXPR("C_AND",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),1);}
1971 break;
1972
1973 case 38:
1974
1975 /* Line 1806 of yacc.c */
1976 #line 306 "oil.y"
1977 {BINARYEXPR("C_OR",(yyval),(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),1);}
1978 break;
1979
1980 case 39:
1981
1982 /* Line 1806 of yacc.c */
1983 #line 307 "oil.y"
1984 {BINARYEXPR("C_OR",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),0);}
1985 break;
1986
1987 case 40:
1988
1989 /* Line 1806 of yacc.c */
1990 #line 308 "oil.y"
1991 {BINARYEXPR("C_OR",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),1);}
1992 break;
1993
1994 case 41:
1995
1996 /* Line 1806 of yacc.c */
1997 #line 309 "oil.y"
1998 {BINARYEXPR("C_XOR",(yyval),(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),1);}
1999 break;
2000
2001 case 42:
2002
2003 /* Line 1806 of yacc.c */
2004 #line 310 "oil.y"
2005 {BINARYEXPR("C_XOR",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),0);}
2006 break;
2007
2008 case 43:
2009
2010 /* Line 1806 of yacc.c */
2011 #line 311 "oil.y"
2012 {BINARYEXPR("C_XOR",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),1);}
2013 break;
2014
2015 case 44:
2016
2017 /* Line 1806 of yacc.c */
2018 #line 312 "oil.y"
2019 {BINARYEXPR("C_PLUS",(yyval),(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),1);}
2020 break;
2021
2022 case 45:
2023
2024 /* Line 1806 of yacc.c */
2025 #line 313 "oil.y"
2026 {BINARYEXPR("C_PLUS",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),0);}
2027 break;
2028
2029 case 46:
2030
2031 /* Line 1806 of yacc.c */
2032 #line 314 "oil.y"
2033 {BINARYEXPR("C_PLUS",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),1);}
2034 break;
2035
2036 case 47:
2037
2038 /* Line 1806 of yacc.c */
2039 #line 315 "oil.y"
2040 {BINARYEXPR("C_MINUS",(yyval),(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),1);}
2041 break;
2042
2043 case 48:
2044
2045 /* Line 1806 of yacc.c */
2046 #line 316 "oil.y"
2047 {BINARYEXPR("C_MINUS",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),0);}
2048 break;
2049
2050 case 49:
2051
2052 /* Line 1806 of yacc.c */
2053 #line 317 "oil.y"
2054 {BINARYEXPR("C_MINUS",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),1);}
2055 break;
2056
2057 case 50:
2058
2059 /* Line 1806 of yacc.c */
2060 #line 318 "oil.y"
2061 {BINARYEXPR("C_TIMES",(yyval),(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),1);}
2062 break;
2063
2064 case 51:
2065
2066 /* Line 1806 of yacc.c */
2067 #line 319 "oil.y"
2068 {BINARYEXPR("C_TIMES",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),0);}
2069 break;
2070
2071 case 52:
2072
2073 /* Line 1806 of yacc.c */
2074 #line 320 "oil.y"
2075 {BINARYEXPR("C_TIMES",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),1);}
2076 break;
2077
2078 case 53:
2079
2080 /* Line 1806 of yacc.c */
2081 #line 321 "oil.y"
2082 {BINARYEXPR("C_DIVIDEBY",(yyval),(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),1);}
2083 break;
2084
2085 case 54:
2086
2087 /* Line 1806 of yacc.c */
2088 #line 322 "oil.y"
2089 {BINARYEXPR("C_DIVIDEBY",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),0);}
2090 break;
2091
2092 case 55:
2093
2094 /* Line 1806 of yacc.c */
2095 #line 323 "oil.y"
2096 {BINARYEXPR("C_DIVIDEBY",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),1);}
2097 break;
2098
2099 case 56:
2100
2101 /* Line 1806 of yacc.c */
2102 #line 324 "oil.y"
2103 {BINARYEXPR("C_MODULUS",(yyval),(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),1);}
2104 break;
2105
2106 case 57:
2107
2108 /* Line 1806 of yacc.c */
2109 #line 325 "oil.y"
2110 {BINARYEXPR("C_MODULUS",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),0);}
2111 break;
2112
2113 case 58:
2114
2115 /* Line 1806 of yacc.c */
2116 #line 326 "oil.y"
2117 {BINARYEXPR("C_MODULUS",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),1);}
2118 break;
2119
2120 case 59:
2121
2122 /* Line 1806 of yacc.c */
2123 #line 327 "oil.y"
2124 {BINARYEXPR("C_GREATER",(yyval),(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),1);}
2125 break;
2126
2127 case 60:
2128
2129 /* Line 1806 of yacc.c */
2130 #line 328 "oil.y"
2131 {BINARYEXPR("C_GREATER",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),0);}
2132 break;
2133
2134 case 61:
2135
2136 /* Line 1806 of yacc.c */
2137 #line 329 "oil.y"
2138 {BINARYEXPR("C_GREATER",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),1);}
2139 break;
2140
2141 case 62:
2142
2143 /* Line 1806 of yacc.c */
2144 #line 330 "oil.y"
2145 {BINARYEXPR("C_LESS",(yyval),(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),1);}
2146 break;
2147
2148 case 63:
2149
2150 /* Line 1806 of yacc.c */
2151 #line 331 "oil.y"
2152 {BINARYEXPR("C_LESS",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),0);}
2153 break;
2154
2155 case 64:
2156
2157 /* Line 1806 of yacc.c */
2158 #line 332 "oil.y"
2159 {BINARYEXPR("C_LESS",(yyval),(yyvsp[(1) - (5)]),(yyvsp[(5) - (5)]),1);}
2160 break;
2161
2162 case 65:
2163
2164 /* Line 1806 of yacc.c */
2165 #line 333 "oil.y"
2166 {UNARYEXPR("C_NOT",(yyval),(yyvsp[(4) - (4)]),0,1);}
2167 break;
2168
2169 case 66:
2170
2171 /* Line 1806 of yacc.c */
2172 #line 334 "oil.y"
2173 {UNARYEXPR("C_NOT",(yyval),(yyvsp[(4) - (4)]),1,1);}
2174 break;
2175
2176 case 67:
2177
2178 /* Line 1806 of yacc.c */
2179 #line 335 "oil.y"
2180 {BINARYEXPR("C_NOTEQUAL",(yyval),(yyvsp[(1) - (4)]),(yyvsp[(4) - (4)]),0);}
2181 break;
2182
2183 case 68:
2184
2185 /* Line 1806 of yacc.c */
2186 #line 336 "oil.y"
2187 {BINARYEXPR("C_NOTEQUAL",(yyval),(yyvsp[(1) - (6)]),(yyvsp[(6) - (6)]),0);}
2188 break;
2189
2190 case 69:
2191
2192 /* Line 1806 of yacc.c */
2193 #line 337 "oil.y"
2194 {BINARYEXPR("C_NOTEQUAL",(yyval),(yyvsp[(1) - (6)]),(yyvsp[(6) - (6)]),1);}
2195 break;
2196
2197 case 70:
2198
2199 /* Line 1806 of yacc.c */
2200 #line 338 "oil.y"
2201 {BINARYEXPR("C_ISEQUAL",(yyval),(yyvsp[(1) - (4)]),(yyvsp[(4) - (4)]),0);}
2202 break;
2203
2204 case 71:
2205
2206 /* Line 1806 of yacc.c */
2207 #line 339 "oil.y"
2208 {BINARYEXPR("C_ISEQUAL",(yyval),(yyvsp[(1) - (6)]),(yyvsp[(6) - (6)]),0);}
2209 break;
2210
2211 case 72:
2212
2213 /* Line 1806 of yacc.c */
2214 #line 340 "oil.y"
2215 {BINARYEXPR("C_ISEQUAL",(yyval),(yyvsp[(1) - (6)]),(yyvsp[(6) - (6)]),1);}
2216 break;
2217
2218 case 73:
2219
2220 /* Line 1806 of yacc.c */
2221 #line 341 "oil.y"
2222 {BINARYEXPR("C_LOGICALAND",(yyval),(yyvsp[(1) - (4)]),(yyvsp[(4) - (4)]),0);}
2223 break;
2224
2225 case 74:
2226
2227 /* Line 1806 of yacc.c */
2228 #line 342 "oil.y"
2229 {BINARYEXPR("C_LOGICALAND",(yyval),(yyvsp[(1) - (6)]),(yyvsp[(6) - (6)]),0);}
2230 break;
2231
2232 case 75:
2233
2234 /* Line 1806 of yacc.c */
2235 #line 343 "oil.y"
2236 {BINARYEXPR("C_LOGICALAND",(yyval),(yyvsp[(1) - (6)]),(yyvsp[(6) - (6)]),1);}
2237 break;
2238
2239 case 76:
2240
2241 /* Line 1806 of yacc.c */
2242 #line 344 "oil.y"
2243 {BINARYEXPR("C_LOGICALOR",(yyval),(yyvsp[(1) - (4)]),(yyvsp[(4) - (4)]),0);}
2244 break;
2245
2246 case 77:
2247
2248 /* Line 1806 of yacc.c */
2249 #line 345 "oil.y"
2250 {BINARYEXPR("C_LOGICALOR",(yyval),(yyvsp[(1) - (6)]),(yyvsp[(6) - (6)]),0);}
2251 break;
2252
2253 case 78:
2254
2255 /* Line 1806 of yacc.c */
2256 #line 346 "oil.y"
2257 {BINARYEXPR("C_LOGICALOR",(yyval),(yyvsp[(1) - (6)]),(yyvsp[(6) - (6)]),1);}
2258 break;
2259
2260 case 79:
2261
2262 /* Line 1806 of yacc.c */
2263 #line 347 "oil.y"
2264 {BINARYEXPR("C_RSHIFTBY",(yyval),(yyvsp[(1) - (4)]),(yyvsp[(4) - (4)]),1);}
2265 break;
2266
2267 case 80:
2268
2269 /* Line 1806 of yacc.c */
2270 #line 348 "oil.y"
2271 {BINARYEXPR("C_RSHIFTBY",(yyval),(yyvsp[(1) - (6)]),(yyvsp[(6) - (6)]),0);}
2272 break;
2273
2274 case 81:
2275
2276 /* Line 1806 of yacc.c */
2277 #line 349 "oil.y"
2278 {BINARYEXPR("C_RSHIFTBY",(yyval),(yyvsp[(1) - (6)]),(yyvsp[(6) - (6)]),1);}
2279 break;
2280
2281 case 82:
2282
2283 /* Line 1806 of yacc.c */
2284 #line 350 "oil.y"
2285 {BINARYEXPR("C_LSHIFTBY",(yyval),(yyvsp[(1) - (4)]),(yyvsp[(4) - (4)]),1);}
2286 break;
2287
2288 case 83:
2289
2290 /* Line 1806 of yacc.c */
2291 #line 351 "oil.y"
2292 {BINARYEXPR("C_LSHIFTBY",(yyval),(yyvsp[(1) - (6)]),(yyvsp[(6) - (6)]),0);}
2293 break;
2294
2295 case 84:
2296
2297 /* Line 1806 of yacc.c */
2298 #line 352 "oil.y"
2299 {BINARYEXPR("C_LSHIFTBY",(yyval),(yyvsp[(1) - (6)]),(yyvsp[(6) - (6)]),1);}
2300 break;
2301
2302 case 85:
2303
2304 /* Line 1806 of yacc.c */
2305 #line 353 "oil.y"
2306 {UNARYEXPR("C_LOGICALNOT",(yyval),(yyvsp[(2) - (2)]),0,0);}
2307 break;
2308
2309 case 86:
2310
2311 /* Line 1806 of yacc.c */
2312 #line 354 "oil.y"
2313 {UNARYEXPR("C_LOGICALNOT",(yyval),(yyvsp[(4) - (4)]),0,0);}
2314 break;
2315
2316 case 87:
2317
2318 /* Line 1806 of yacc.c */
2319 #line 355 "oil.y"
2320 {UNARYEXPR("C_LOGICALNOT",(yyval),(yyvsp[(4) - (4)]),1,0);}
2321 break;
2322
2323
2324
2325 /* Line 1806 of yacc.c */
2326 #line 2327 "oil-oil.c"
2327 default: break;
2328 }
2329 /* User semantic actions sometimes alter yychar, and that requires
2330 that yytoken be updated with the new translation. We take the
2331 approach of translating immediately before every use of yytoken.
2332 One alternative is translating here after every semantic action,
2333 but that translation would be missed if the semantic action invokes
2334 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2335 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2336 incorrect destructor might then be invoked immediately. In the
2337 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2338 to an incorrect destructor call or verbose syntax error message
2339 before the lookahead is translated. */
2340 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2341
2342 YYPOPSTACK (yylen);
2343 yylen = 0;
2344 YY_STACK_PRINT (yyss, yyssp);
2345
2346 *++yyvsp = yyval;
2347
2348 /* Now `shift' the result of the reduction. Determine what state
2349 that goes to, based on the state we popped back to and the rule
2350 number reduced by. */
2351
2352 yyn = yyr1[yyn];
2353
2354 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2355 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2356 yystate = yytable[yystate];
2357 else
2358 yystate = yydefgoto[yyn - YYNTOKENS];
2359
2360 goto yynewstate;
2361
2362
2363 /*------------------------------------.
2364 | yyerrlab -- here on detecting error |
2365 `------------------------------------*/
2366 yyerrlab:
2367 /* Make sure we have latest lookahead translation. See comments at
2368 user semantic actions for why this is necessary. */
2369 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2370
2371 /* If not already recovering from an error, report this error. */
2372 if (!yyerrstatus)
2373 {
2374 ++yynerrs;
2375 #if ! YYERROR_VERBOSE
2376 yyerror (YY_("syntax error"));
2377 #else
2378 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2379 yyssp, yytoken)
2380 {
2381 char const *yymsgp = YY_("syntax error");
2382 int yysyntax_error_status;
2383 yysyntax_error_status = YYSYNTAX_ERROR;
2384 if (yysyntax_error_status == 0)
2385 yymsgp = yymsg;
2386 else if (yysyntax_error_status == 1)
2387 {
2388 if (yymsg != yymsgbuf)
2389 YYSTACK_FREE (yymsg);
2390 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2391 if (!yymsg)
2392 {
2393 yymsg = yymsgbuf;
2394 yymsg_alloc = sizeof yymsgbuf;
2395 yysyntax_error_status = 2;
2396 }
2397 else
2398 {
2399 yysyntax_error_status = YYSYNTAX_ERROR;
2400 yymsgp = yymsg;
2401 }
2402 }
2403 yyerror (yymsgp);
2404 if (yysyntax_error_status == 2)
2405 goto yyexhaustedlab;
2406 }
2407 # undef YYSYNTAX_ERROR
2408 #endif
2409 }
2410
2411
2412
2413 if (yyerrstatus == 3)
2414 {
2415 /* If just tried and failed to reuse lookahead token after an
2416 error, discard it. */
2417
2418 if (yychar <= YYEOF)
2419 {
2420 /* Return failure if at end of input. */
2421 if (yychar == YYEOF)
2422 YYABORT;
2423 }
2424 else
2425 {
2426 yydestruct ("Error: discarding",
2427 yytoken, &yylval);
2428 yychar = YYEMPTY;
2429 }
2430 }
2431
2432 /* Else will try to reuse lookahead token after shifting the error
2433 token. */
2434 goto yyerrlab1;
2435
2436
2437 /*---------------------------------------------------.
2438 | yyerrorlab -- error raised explicitly by YYERROR. |
2439 `---------------------------------------------------*/
2440 yyerrorlab:
2441
2442 /* Pacify compilers like GCC when the user code never invokes
2443 YYERROR and the label yyerrorlab therefore never appears in user
2444 code. */
2445 if (/*CONSTCOND*/ 0)
2446 goto yyerrorlab;
2447
2448 /* Do not reclaim the symbols of the rule which action triggered
2449 this YYERROR. */
2450 YYPOPSTACK (yylen);
2451 yylen = 0;
2452 YY_STACK_PRINT (yyss, yyssp);
2453 yystate = *yyssp;
2454 goto yyerrlab1;
2455
2456
2457 /*-------------------------------------------------------------.
2458 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2459 `-------------------------------------------------------------*/
2460 yyerrlab1:
2461 yyerrstatus = 3; /* Each real token shifted decrements this. */
2462
2463 for (;;)
2464 {
2465 yyn = yypact[yystate];
2466 if (!yypact_value_is_default (yyn))
2467 {
2468 yyn += YYTERROR;
2469 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2470 {
2471 yyn = yytable[yyn];
2472 if (0 < yyn)
2473 break;
2474 }
2475 }
2476
2477 /* Pop the current state because it cannot handle the error token. */
2478 if (yyssp == yyss)
2479 YYABORT;
2480
2481
2482 yydestruct ("Error: popping",
2483 yystos[yystate], yyvsp);
2484 YYPOPSTACK (1);
2485 yystate = *yyssp;
2486 YY_STACK_PRINT (yyss, yyssp);
2487 }
2488
2489 *++yyvsp = yylval;
2490
2491
2492 /* Shift the error token. */
2493 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2494
2495 yystate = yyn;
2496 goto yynewstate;
2497
2498
2499 /*-------------------------------------.
2500 | yyacceptlab -- YYACCEPT comes here. |
2501 `-------------------------------------*/
2502 yyacceptlab:
2503 yyresult = 0;
2504 goto yyreturn;
2505
2506 /*-----------------------------------.
2507 | yyabortlab -- YYABORT comes here. |
2508 `-----------------------------------*/
2509 yyabortlab:
2510 yyresult = 1;
2511 goto yyreturn;
2512
2513 #if !defined(yyoverflow) || YYERROR_VERBOSE
2514 /*-------------------------------------------------.
2515 | yyexhaustedlab -- memory exhaustion comes here. |
2516 `-------------------------------------------------*/
2517 yyexhaustedlab:
2518 yyerror (YY_("memory exhausted"));
2519 yyresult = 2;
2520 /* Fall through. */
2521 #endif
2522
2523 yyreturn:
2524 if (yychar != YYEMPTY)
2525 {
2526 /* Make sure we have latest lookahead translation. See comments at
2527 user semantic actions for why this is necessary. */
2528 yytoken = YYTRANSLATE (yychar);
2529 yydestruct ("Cleanup: discarding lookahead",
2530 yytoken, &yylval);
2531 }
2532 /* Do not reclaim the symbols of the rule which action triggered
2533 this YYABORT or YYACCEPT. */
2534 YYPOPSTACK (yylen);
2535 YY_STACK_PRINT (yyss, yyssp);
2536 while (yyssp != yyss)
2537 {
2538 yydestruct ("Cleanup: popping",
2539 yystos[*yyssp], yyvsp);
2540 YYPOPSTACK (1);
2541 }
2542 #ifndef yyoverflow
2543 if (yyss != yyssa)
2544 YYSTACK_FREE (yyss);
2545 #endif
2546 #if YYERROR_VERBOSE
2547 if (yymsg != yymsgbuf)
2548 YYSTACK_FREE (yymsg);
2549 #endif
2550 /* Make sure YYID is used. */
2551 return YYID (yyresult);
2552 }
2553
2554
2555
2556 /* Line 2067 of yacc.c */
2557 #line 360 "oil.y"
2558
2559
2560 #define MAXTOFREE 1000
2561
2562 char* tofree[MAXTOFREE]={0};
2563 int tfi=0;
2564
2565 int yylex(void)
2566 {
2567 int c;
2568 unsigned long acc;
2569
2570 /* Whitespace is completely insignificant here, even inside && and other
2571 two-character operators. Just to be different, though, it /is/ significant
2572 inside constructs like .1 and #{1}2; in such cases, it isn't allowed. */
2573 c=countgetchar();
2574 while(isspace(c)) c=countgetchar();
2575 while(c==';'||c=='[')
2576 {
2577 /* Comments go from a semicolon/hybrid to the end of the line. */
2578 if(c==';')
2579 {
2580 c=countgetchar();
2581 while(c!='\n') c=countgetchar();
2582 while(isspace(c)) c=countgetchar();
2583 }
2584 /* Square brackets set the name for optimizations. */
2585 if(c=='[')
2586 {
2587 int i=0;
2588 c=countgetchar();
2589 while(c!=']')
2590 {
2591 optname[i++]=c;
2592 c=countgetchar();
2593 if(i==MAXOPTNAMELEN-1) {i=0; yyerror("optimization name too long");}
2594 }
2595 optname[i]=0;
2596 c=countgetchar();
2597 while(isspace(c)) c=countgetchar();
2598 }
2599 }
2600 if(c==EOF) return 0;
2601 switch(c)
2602 {
2603 case '#':
2604 c=countgetchar();
2605 if(c!='{')
2606 {
2607 acc=0;
2608 while(isdigit(c))
2609 {
2610 acc*=10;
2611 acc+=(c-'0');
2612 c=countgetchar();
2613 }
2614 yylval=malloc(sizeof(struct ickstype));
2615 yylval->depth=0;
2616 yylval->path=0;
2617 yylval->condition="->constant==";
2618 yylval->nodetypename=0;
2619 yylval->usec=1;
2620 yylval->mustbemesh=1;
2621 yylval->cxneeded=0;
2622 yylval->c=acc;
2623 yylval->replnum=0;
2624 yylval->n1=0;
2625 yylval->n2=0;
2626 yylval->ublo=0;
2627 yylval->width32=1; /* generate MESH32 not MESH; we can still AND16 it,
2628 etc., if necessary */
2629 countungetc(c, stdin);
2630 return LEXERLEAF;
2631 }
2632 countungetc(c, stdin);
2633 c='#';
2634 /* fall through */
2635 case '_':
2636 case ':':
2637 case '.':
2638 yylval=malloc(sizeof(struct ickstype));
2639 yylval->depth=0;
2640 yylval->path=0;
2641 yylval->condition=0; /* _ or # */
2642 yylval->width32=1; /* should never matter, but you never
2643 know... */
2644 yylval->ublo=0;
2645 if(c==':') yylval->condition="->width==32";
2646 if(c=='.') {yylval->condition="->width==16"; yylval->width32=0;}
2647 yylval->nodetypename=0;
2648 yylval->usec=0;
2649 yylval->mustbemesh=c=='#';
2650 yylval->cxneeded=0;
2651 c=countgetchar();
2652 if(c=='{')
2653 {
2654 /* Create a new node to hold the c/x condition */
2655 yylval->n1=malloc(sizeof(struct ickstype));
2656 yylval->n1->depth=0;
2657 yylval->n1->path=0;
2658 {
2659 static char buf[512];
2660 int bi=0;
2661 c=countgetchar();
2662 while(c!='}')
2663 {
2664 buf[bi++]=c;
2665 if(bi==511) {yyerror("{quoted} string too long"); bi=0;}
2666 c=countgetchar();
2667 }
2668 buf[bi]=0;
2669 yylval->n1->condition=tofree[tfi++]=strdup(buf);
2670 if(tfi==MAXTOFREE) {yyerror("Too many {quoted} strings"); tfi--;}
2671 c=countgetchar();
2672 }
2673 yylval->n1->nodetypename=0;
2674 yylval->n1->usec=0;
2675 yylval->n1->mustbemesh=0;
2676 yylval->n1->cxneeded=1;
2677 yylval->n1->n1=0;
2678 yylval->n1->n2=0;
2679 yylval->n1->width32=yylval->width32;
2680 yylval->n1->ublo=0;
2681 }
2682 else yylval->n1=0;
2683 yylval->replnum=0;
2684 if(yylval->n1) yylval->n1->replnum=c-'0'; else yylval->replnum=c-'0';
2685 yylval->n2=0;
2686 return LEXERLEAF;
2687 default:
2688 return c;
2689 }
2690 }
2691
2692 void treedepthup(YYSTYPE v, mybool i)
2693 {
2694 if(!v) return;
2695 treedepthup(v->n1,i);
2696 treedepthup(v->n2,i);
2697 v->depth++;
2698 v->path<<=1;
2699 v->path|=i;
2700 if(v->depth>30) yyerror("Nesting too deep in template or replacement\n");
2701 }
2702
2703 void treefree(YYSTYPE v)
2704 {
2705 if(!v) return;
2706 treefree(v->n1);
2707 treefree(v->n2);
2708 free(v);
2709 }
2710
2711 void gennodepath(unsigned depth, unsigned long path)
2712 {
2713 while(depth--)
2714 {
2715 if(path&1) printf("->rval"); else printf("->lval");
2716 path>>=1;
2717 }
2718 }
2719
2720 mybool treeshapecond(YYSTYPE v, mybool firstopt)
2721 {
2722 if(!v) return firstopt;
2723 /* To prevent possibly dereferencing a null pointer, check the root ick_first */
2724 if(v->mustbemesh) /* it's a must-be-constant constraint */
2725 {
2726 printf(firstopt?" if((np":" &&\n (np");
2727 gennodepath(v->depth,v->path);
2728 printf("->opcode==MESH || np");
2729 gennodepath(v->depth,v->path);
2730 printf("->opcode==MESH32)");
2731 firstopt=0;
2732 }
2733 if(v->condition&&!v->cxneeded) /* it's a tree-shape constraint */
2734 {
2735 printf(firstopt?" if(np":" &&\n np");
2736 gennodepath(v->depth,v->path);
2737 printf("%s",v->condition);
2738 if(v->usec) printf("%luLU",v->c);
2739 firstopt=0;
2740 }
2741 if(v->ublo) /* generate a width check */
2742 {
2743 printf(firstopt?" if(np":" &&\n np");
2744 gennodepath(v->depth,v->path);
2745 printf("->width==%d",v->width32?32:16);
2746 firstopt=0;
2747 }
2748 firstopt=treeshapecond(v->n1,firstopt);
2749 return treeshapecond(v->n2,firstopt);
2750 }
2751
2752 YYSTYPE treenscheck(YYSTYPE v, YYSTYPE prev, int replnum)
2753 {
2754 if(!v) return prev;
2755 prev=treenscheck(v->n1,prev,replnum);
2756 prev=treenscheck(v->n2,prev,replnum);
2757 if(v->replnum!=replnum) return prev;
2758 if(prev)
2759 {
2760 printf(" if(!nodessame(np");
2761 gennodepath(prev->depth,prev->path);
2762 printf(",np");
2763 gennodepath(v->depth,v->path);
2764 printf(")) break;\n");
2765 }
2766 return v;
2767 }
2768
2769 void treecxcond(YYSTYPE v)
2770 {
2771 if(!v) return;
2772 if(v->cxneeded&&strcmp(v->condition,"1"))
2773 {
2774 if(v->replnum)
2775 printf(" x=x%d; c=c%d; ",v->replnum,v->replnum);
2776 else
2777 {
2778 printf(" x=np");
2779 gennodepath(v->depth,v->path);
2780 printf("->constant;\n c=np");
2781 gennodepath(v->depth,v->path);
2782 printf("->optdata;\n ");
2783 }
2784 printf("if(!(%s)) break;\n",v->condition);
2785 }
2786 treecxcond(v->n1);
2787 treecxcond(v->n2);
2788 }
2789
2790 void treerepcount(YYSTYPE v, int* rc)
2791 {
2792 if(!v) return;
2793 if(!(v->nodetypename)&&v->replnum&&!(v->cxneeded)) rc[v->replnum]++;
2794 treerepcount(v->n1, rc);
2795 treerepcount(v->n2, rc);
2796 }
2797
2798 void treerepgen(YYSTYPE v, YYSTYPE* refs, int* rc)
2799 {
2800 if(!v) return;
2801 /* We absolutely have to generate the root node ick_first here, because otherwise
2802 the nodes in question won't exist. */
2803 if(v->nodetypename) /* Generate an intermediate node */
2804 {
2805 printf(" MAYBENEWNODE(tp");
2806 gennodepath(v->depth,v->path);
2807 printf(");\n tp");
2808 gennodepath(v->depth,v->path);
2809 printf("->opcode=%s;\n tp",v->nodetypename);
2810 gennodepath(v->depth,v->path);
2811 printf("->width=%d;\n",v->width32?32:16);
2812 /* optdata will be filled in by checknodeactbits before the ick_next idiom is
2813 tested; constant is irrelevant, lval and rval are NULL at present and
2814 will be filled in by later recursions of this function, and I seriously
2815 hope that nextslat is never filled in by an optimizer idiom. */
2816 }
2817 else if(v->replnum&&!(v->cxneeded))
2818 {
2819 /* Copy a node from the template. The node ought not to be allocated at
2820 this point, so we can safely just ick_assign to it with a new malloced
2821 node. */
2822 if(refs[v->replnum])
2823 {
2824 if(rc[v->replnum]>1||!refs[v->replnum]->depth)
2825 {
2826 /* The node actually has to be copied, either because another copy is
2827 needed or because it's np itself that's being copied over. */
2828 rc[v->replnum]--;
2829 printf(" tp");
2830 gennodepath(v->depth,v->path);
2831 printf("=nodecopy(np");
2832 gennodepath(refs[v->replnum]->depth,refs[v->replnum]->path);
2833 printf(");\n");
2834 }
2835 else
2836 {
2837 /* This can be optimized slightly by moving rather than copying,
2838 zeroing backlinks so that the node won't be freed. */
2839 rc[v->replnum]--;
2840 printf(" tp");
2841 gennodepath(v->depth,v->path);
2842 printf("=np");
2843 gennodepath(refs[v->replnum]->depth,refs[v->replnum]->path);
2844 printf(";\n np");
2845 gennodepath(refs[v->replnum]->depth,refs[v->replnum]->path);
2846 printf("=0;\n");
2847 }
2848 }
2849 else yyerror("Replacement isn't in the template");
2850 }
2851 else if(v->cxneeded)
2852 {
2853 /* Generate a constant node based on an expression (#{expr}0). */
2854 printf(" MAYBENEWNODE(tp");
2855 gennodepath(v->depth,v->path);
2856 printf(");\n tp");
2857 gennodepath(v->depth,v->path);
2858 printf("->opcode=MESH32;\n tp");
2859 gennodepath(v->depth,v->path);
2860 printf("->width=32;\n tp");
2861 gennodepath(v->depth,v->path);
2862 printf("->constant=(%s);\n",v->condition);
2863 }
2864 else if(v->mustbemesh&&!v->n1)
2865 {
2866 /* Generate a constant node based on a constant (#65535). */
2867 printf(" MAYBENEWNODE(tp");
2868 gennodepath(v->depth,v->path);
2869 printf(");\n tp");
2870 gennodepath(v->depth,v->path);
2871 printf("->opcode=MESH32;\n tp");
2872 gennodepath(v->depth,v->path);
2873 printf("->width=32;\n tp");
2874 gennodepath(v->depth,v->path);
2875 printf("->constant=(%luLU);\n",v->c);
2876 }
2877 else if(v->mustbemesh&&v->n1)
2878 /* let this node's n1 handle it */ ;
2879 else
2880 yyerror("can't figure out how to generate a replacement node\n");
2881 treerepgen(v->n1,refs,rc);
2882 treerepgen(v->n2,refs,rc);
2883 }
2884
2885 int yyerror(char const *s)
2886 {
2887 fprintf(stderr,"Error at (%d:%d): \"%s\"\n",cgcrow,cgccol,s);
2888 return 0; /* this return value is ignored anyway */
2889 }
2890
2891 static int cgcpushback=0;
2892
2893 int countgetchar(void)
2894 {
2895 int c=getchar();
2896 if(cgcpushback) {cgcpushback=0; return c;}
2897 cgccol++;
2898 if(c=='\n') {cgccol=0; cgcrow++;}
2899 return c;
2900 }
2901
2902 int countungetc(int c, FILE* f)
2903 {
2904 ungetc(c,f);
2905 cgcpushback=1;
2906 return c;
2907 }
2908
2909 void splitstart(void)
2910 {
2911 static char fname[]="oilout00.c";
2912 if(filenumber>255)
2913 {
2914 filenumber=255;
2915 fprintf(stdout,"Input file too long.\n");
2916 }
2917 sprintf(fname,"oilout%02x.c",filenumber);
2918 freopen(fname,"w",stdout);
2919 puts("/* Automatically generated output, edit source and recompile to "
2920 "change */");
2921 printf("#include \"oil.h\"\n"
2922 "int optimize_pass1_%x(node *np)\n"
2923 "{"
2924 " int opted=0;\n"
2925 " unsigned long c,c1,c2,c3,c4,c5,c6,c7,c8,c9;\n"
2926 " unsigned long x,x1,x2,x3,x4,x5,x6,x7,x8,x9,r;\n"
2927 " int tempw;\n"
2928 " node *tp;\n", filenumber);
2929 }
2930
2931 void splitend(void)
2932 {
2933 /* Disabling warnings about unused variables. gcc will optimize this right
2934 out, and in any case the raise(SIGSEGV) will be unreachable (but will
2935 cause a pretty recognizable error because it'll be caught by the handler
2936 for SIGSEGV and output an internal error, with an obvious debug backtrace
2937 if -U is used). */
2938 printf(" c=c1=c2=c3=c4=c5=c6=c7=c8=c9=0;\n"
2939 " x=x1=x2=x3=x4=x5=x6=x7=x8=x9=r=0;\n"
2940 " if(c+c1+c2+c3+c4+c5+c6+c7+c8+c9+r+\n"
2941 " x+x1+x2+x3+x4+x5+x6+x7+x8+x9) raise(SIGSEGV);\n");
2942 printf(" return opted;\n}\n");
2943 fclose(stdout);
2944 }
2945
2946 int main(void)
2947 {
2948 int e,i;
2949 /*
2950 " if(!np) return 0;\n"
2951 " if(np->lval) opted|=optimize_pass1(np->lval);\n"
2952 " if(np->rval) opted|=optimize_pass1(np->rval);\n"
2953 */
2954 splitstart();
2955 cgccol=0;
2956 cgcrow=1;
2957 e=yyparse();
2958 while(tfi--) free(tofree[tfi]);
2959 splitend();
2960 freopen("oilout-m.c","w",stdout);
2961 puts("/* Automatically generated output, edit source and recompile to "
2962 "change */");
2963 puts("#include \"ick.h\"");
2964 i=filenumber+1;
2965 while(i--) printf("extern int optimize_pass1_%x(node*);\n",i);
2966 puts("int optimize_pass1(node* np)\n"
2967 "{\n"
2968 " int opted=0;\n"
2969 " if(!np) return 0;\n"
2970 " if(np->lval) opted|=optimize_pass1(np->lval);\n"
2971 " if(np->rval) opted|=optimize_pass1(np->rval);");
2972 i=filenumber+1;
2973 while(i--) printf(" opted|=optimize_pass1_%x(np);\n",i);
2974 puts(" return opted;\n"
2975 "}");
2976 return e;
2977 }
2978