]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/byacc/test/btyacc/btyacc_demo.tab.c
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / byacc / test / btyacc / btyacc_demo.tab.c
1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar    1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */
4
5 #define YYBYACC 1
6 #define YYMAJOR 1
7 #define YYMINOR 9
8 #define YYCHECK "yyyymmdd"
9
10 #define YYEMPTY        (-1)
11 #define yyclearin      (yychar = YYEMPTY)
12 #define yyerrok        (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
14 #define YYENOMEM       (-2)
15 #define YYEOF          0
16 #undef YYBTYACC
17 #define YYBTYACC 1
18 #define YYDEBUGSTR (yytrial ? YYPREFIX "debug(trial)" : YYPREFIX "debug")
19
20 #ifndef yyparse
21 #define yyparse    demo_parse
22 #endif /* yyparse */
23
24 #ifndef yylex
25 #define yylex      demo_lex
26 #endif /* yylex */
27
28 #ifndef yyerror
29 #define yyerror    demo_error
30 #endif /* yyerror */
31
32 #ifndef yychar
33 #define yychar     demo_char
34 #endif /* yychar */
35
36 #ifndef yyval
37 #define yyval      demo_val
38 #endif /* yyval */
39
40 #ifndef yylval
41 #define yylval     demo_lval
42 #endif /* yylval */
43
44 #ifndef yydebug
45 #define yydebug    demo_debug
46 #endif /* yydebug */
47
48 #ifndef yynerrs
49 #define yynerrs    demo_nerrs
50 #endif /* yynerrs */
51
52 #ifndef yyerrflag
53 #define yyerrflag  demo_errflag
54 #endif /* yyerrflag */
55
56 #ifndef yylhs
57 #define yylhs      demo_lhs
58 #endif /* yylhs */
59
60 #ifndef yylen
61 #define yylen      demo_len
62 #endif /* yylen */
63
64 #ifndef yydefred
65 #define yydefred   demo_defred
66 #endif /* yydefred */
67
68 #ifndef yystos
69 #define yystos     demo_stos
70 #endif /* yystos */
71
72 #ifndef yydgoto
73 #define yydgoto    demo_dgoto
74 #endif /* yydgoto */
75
76 #ifndef yysindex
77 #define yysindex   demo_sindex
78 #endif /* yysindex */
79
80 #ifndef yyrindex
81 #define yyrindex   demo_rindex
82 #endif /* yyrindex */
83
84 #ifndef yygindex
85 #define yygindex   demo_gindex
86 #endif /* yygindex */
87
88 #ifndef yytable
89 #define yytable    demo_table
90 #endif /* yytable */
91
92 #ifndef yycheck
93 #define yycheck    demo_check
94 #endif /* yycheck */
95
96 #ifndef yyname
97 #define yyname     demo_name
98 #endif /* yyname */
99
100 #ifndef yyrule
101 #define yyrule     demo_rule
102 #endif /* yyrule */
103
104 #ifndef yyloc
105 #define yyloc      demo_loc
106 #endif /* yyloc */
107
108 #ifndef yylloc
109 #define yylloc     demo_lloc
110 #endif /* yylloc */
111
112 #if YYBTYACC
113
114 #ifndef yycindex
115 #define yycindex   demo_cindex
116 #endif /* yycindex */
117
118 #ifndef yyctable
119 #define yyctable   demo_ctable
120 #endif /* yyctable */
121
122 #endif /* YYBTYACC */
123
124 #define YYPREFIX "demo_"
125
126 #define YYPURE 0
127
128 #line 15 "btyacc_demo.y"
129 /* dummy types just for compile check */
130 typedef int Code;
131 typedef int Decl_List;
132 typedef int Expr;
133 typedef int Expr_List;
134 typedef int Scope;
135 typedef int Type;
136 enum Operator { ADD, SUB, MUL, MOD, DIV, DEREF };
137
138 typedef unsigned char bool;
139 typedef struct Decl {
140     Scope *scope;
141     Type  *type;
142     bool (*istype)(void);
143 } Decl;
144
145 #include "btyacc_demo.tab.h"
146 #include <stdlib.h>
147 #include <stdio.h>
148 #line 36 "btyacc_demo.y"
149 #ifdef YYSTYPE
150 #undef  YYSTYPE_IS_DECLARED
151 #define YYSTYPE_IS_DECLARED 1
152 #endif
153 #ifndef YYSTYPE_IS_DECLARED
154 #define YYSTYPE_IS_DECLARED 1
155 typedef union {
156     Scope       *scope;
157     Expr        *expr;
158     Expr_List   *elist;
159     Type        *type;
160     Decl        *decl;
161     Decl_List   *dlist;
162     Code        *code;
163     char        *id;
164     } YYSTYPE;
165 #endif /* !YYSTYPE_IS_DECLARED */
166 #line 167 "btyacc_demo.tab.c"
167
168 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
169 /* Default: YYLTYPE is the text position type. */
170 typedef struct YYLTYPE
171 {
172     int first_line;
173     int first_column;
174     int last_line;
175     int last_column;
176 } YYLTYPE;
177 #define YYLTYPE_IS_DECLARED 1
178 #endif
179
180 /* compatibility with bison */
181 #ifdef YYPARSE_PARAM
182 /* compatibility with FreeBSD */
183 # ifdef YYPARSE_PARAM_TYPE
184 #  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
185 # else
186 #  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
187 # endif
188 #else
189 # define YYPARSE_DECL() yyparse(void)
190 #endif
191
192 /* Parameters sent to lex. */
193 #ifdef YYLEX_PARAM
194 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
195 # define YYLEX yylex(YYLEX_PARAM)
196 #else
197 # define YYLEX_DECL() yylex(void)
198 # define YYLEX yylex()
199 #endif
200
201 /* Parameters sent to yyerror. */
202 #ifndef YYERROR_DECL
203 #define YYERROR_DECL() yyerror(YYLTYPE loc, const char *s)
204 #endif
205 #ifndef YYERROR_CALL
206 #define YYERROR_CALL(msg) yyerror(yylloc, msg)
207 #endif
208
209 #ifndef YYDESTRUCT_DECL
210 #define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, YYLTYPE *loc)
211 #endif
212 #ifndef YYDESTRUCT_CALL
213 #define YYDESTRUCT_CALL(msg, psymb, val, loc) yydestruct(msg, psymb, val, loc)
214 #endif
215
216 extern int YYPARSE_DECL();
217
218 #define PREFIX 257
219 #define POSTFIX 258
220 #define ID 259
221 #define CONSTANT 260
222 #define EXTERN 261
223 #define REGISTER 262
224 #define STATIC 263
225 #define CONST 264
226 #define VOLATILE 265
227 #define IF 266
228 #define THEN 267
229 #define ELSE 268
230 #define CLCL 269
231 #define YYERRCODE 256
232 typedef short YYINT;
233 static const YYINT demo_lhs[] = {                        -1,
234    15,   15,   15,   12,   18,    0,    4,   19,    4,   20,
235     2,   21,    2,   10,   10,   13,   13,   11,   11,   11,
236    11,   11,   14,   14,   22,   23,    3,    3,    8,    8,
237    24,   25,    8,    8,    8,    8,   16,   16,   17,   17,
238     9,    1,    1,    1,    1,    1,    1,    1,    1,    5,
239    26,    5,   27,   28,    5,    5,   29,    5,    6,    6,
240     7,
241 };
242 static const YYINT demo_len[] = {                         2,
243     0,    1,    3,    2,    0,    2,    0,    0,    3,    0,
244     5,    0,    6,    1,    3,    0,    2,    1,    1,    1,
245     1,    1,    1,    1,    0,    0,    5,    1,    0,    1,
246     0,    0,    5,    5,    5,    6,    0,    1,    4,    1,
247     4,    4,    4,    4,    4,    4,    3,    1,    1,    1,
248     0,    3,    0,    0,   11,    8,    0,    2,    0,    3,
249     4,
250 };
251 static const YYINT demo_defred[] = {                      5,
252     0,    7,    0,    0,   20,   21,   22,   23,   24,    2,
253     9,    8,   14,   19,   18,    0,    0,    0,   15,    0,
254     3,   16,   31,   30,    0,    0,    0,   32,   11,   25,
255    25,   25,    0,   17,   26,    0,   26,    0,    0,    8,
256    13,    0,    0,    0,   40,    8,    0,    0,    8,   48,
257    49,    0,   59,    0,   33,    0,    0,   16,   31,    0,
258    31,   31,   31,   31,   31,   35,    0,    0,    0,    0,
259    47,    0,    0,    0,    0,    0,   61,    0,    0,   39,
260     0,    0,   44,   46,   45,    0,   50,   60,    0,    0,
261    31,    0,   58,    0,   52,    0,    0,   53,    0,    0,
262    54,    0,   55,
263 };
264 static const YYINT demo_stos[] = {                        0,
265   271,  289,  275,  290,  261,  262,  263,  264,  265,  269,
266   273,  281,  282,  283,  285,  286,  290,  259,  282,  291,
267   269,   42,   40,  259,  274,  279,  284,  295,   59,   44,
268    40,   91,  292,  285,  293,  296,  293,  293,  293,  123,
269   278,  294,  279,  294,  280,  281,  287,  288,   42,  259,
270   260,  272,  290,  279,   41,  279,  290,   41,   44,  290,
271    43,   45,   42,   47,   37,   93,  277,  291,  284,  295,
272   272,  295,  295,  295,  295,  295,  125,  290,  279,  280,
273   272,  272,  272,  272,  272,  266,  273,  276,  297,  300,
274    40,  272,  278,  295,   59,  272,   41,  267,  298,  276,
275   268,  299,  276,
276 };
277 static const YYINT demo_dgoto[] = {                       1,
278    52,   87,   25,    3,   88,   67,   41,   26,   45,   12,
279    13,   14,   27,   15,   16,   47,   48,    2,    4,   20,
280    33,   35,   42,   28,   36,   89,   99,  102,   90,
281 };
282 static const YYINT demo_sindex[] = {                      0,
283     0,    0,    0, -124,    0,    0,    0,    0,    0,    0,
284     0,    0,    0,    0,    0, -256, -124,    0,    0,  -33,
285     0,    0,    0,    0,   34,   -4, -205,    0,    0,    0,
286     0,    0, -110,    0,    0,  -33,    0, -124,  -15,    0,
287     0,  -33,  -36,  -33,    0,    0,    4,    7,    0,    0,
288     0,    5,    0,   -4,    0,   -4, -124,    0,    0,  -15,
289     0,    0,    0,    0,    0,    0,  -46,  -33, -205, -124,
290     0,  -15,  -15,  -15,  -15,  -15,    0,  -91,   -4,    0,
291   122,  122,    0,    0,    0,   40,    0,    0,  -15, -110,
292     0,  106,    0,  -15,    0,  113, -183,    0,  -91,    0,
293     0,  -91,    0,
294 };
295 static const YYINT demo_rindex[] = {                      0,
296     0,    0,    1, -157,    0,    0,    0,    0,    0,    0,
297     0,    0,    0,    0,    0,    0,  -28,  -22,    0,  -29,
298     0,    0,    0,    0,    0,  -27,  -34,    0,    0,    0,
299     0,    0,    0,    0,    0,    8,    0,  -12,    0,    0,
300     0,  -20,    0,   32,    0,    0,    0,   69,    0,    0,
301     0,    0,    0,  -18,    0,   56,   33,    0,    0,    0,
302     0,    0,    0,    0,    0,    0,  -31,   -1,   -6, -157,
303     0,    0,    0,    0,    0,    0,    0,  -14,   63,    0,
304    13,   23,    0,    0,    0,    0,    0,    0,    0,    0,
305     0,    0,    0,    0,    0,    0,    0,    0,  -14,  -42,
306     0,  -14,    0,
307 };
308 #if YYBTYACC
309 static const YYINT demo_cindex[] = {                      0,
310     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
311     0,    0,    0,    0,    0,    0, -145, -150,    0,   81,
312     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
313     0,    0,    0,    0,    0,   82,    0,    0,    0,    0,
314     0,   91,    0,  112,    0,    0,    0,    0,    0,    0,
315     0,    0,    0,    0,    0,    0, -113,    0,    0,    0,
316     0,    0,    0,    0,    0,    0,    0,  117,    0,    0,
317     0,    0,    0,    0,    0,    0,    0,  -98,    0,    0,
318     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
319     0,    0,    0,    0,    0,    0,    0,    0,  -96,  -92,
320     0,  -82,    0,
321 };
322 #endif
323 static const YYINT demo_gindex[] = {                      0,
324    53,  175,    0,    0,    9,    0,   90,   76,  111,   27,
325    29,    0,  124,  -25,    0,    0,    0,    0,   21,  126,
326     0,  136,  147,   71,    0,    0,    0,    0,    0,
327 };
328 #define YYTABLESIZE 270
329 static const YYINT demo_table[] = {                      56,
330     6,   34,   18,   31,   55,   25,   25,   25,   22,   25,
331     8,   10,   40,   10,   29,   10,   28,    4,    4,    4,
332    29,    4,   34,   29,   25,   34,   49,   51,   37,   29,
333    10,   28,   17,   36,   36,   31,    4,   36,   29,   29,
334    34,   65,   29,   34,   58,   19,   63,   61,   29,   62,
335    59,   64,   36,   42,   32,   42,   25,   42,    8,    9,
336    53,   29,   10,   43,   46,   43,   57,   43,    4,   60,
337    29,   42,   10,   10,   10,   29,   10,   30,   77,   91,
338    56,   43,   56,   98,   36,   19,   32,   78,   25,   29,
339    29,    8,   29,   29,   10,   12,   46,   66,   29,   27,
340     4,    1,   29,   41,   34,   42,   41,  100,   57,   38,
341   103,   43,   71,    0,   27,   43,   36,   54,    4,   56,
342     7,    7,   29,   10,   81,   82,   83,   84,   85,   70,
343     7,   72,   73,   74,   75,   76,    5,    6,    7,    8,
344     9,   92,   65,   79,   10,    0,   96,   63,   61,   65,
345    62,    7,   64,   97,   63,   61,    7,   62,   65,   64,
346     9,   94,    9,   63,   95,   37,   38,   39,   64,    5,
347     6,    7,    8,    9,   86,   13,    9,   10,   11,   93,
348    80,   69,   68,   44,    0,    0,    0,    0,    0,    0,
349     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
350     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
351     0,    0,    0,    0,    0,    0,   56,   56,   56,   56,
352    56,   56,   56,   56,   25,   24,   56,    8,    8,    8,
353     8,    8,    8,    8,    8,    0,    4,    8,    4,    4,
354     4,    4,    4,   50,   51,   51,    1,    0,    0,    0,
355     0,    0,    0,    0,    0,    0,    0,    0,    0,    8,
356     0,    8,    8,    8,    8,    8,    0,    0,    0,    8,
357 };
358 static const YYINT demo_check[] = {                      42,
359     0,   27,  259,   40,   41,   40,   41,   42,   42,   44,
360    42,   40,  123,   42,   44,   44,   44,   40,   41,   42,
361    41,   44,   41,   44,   59,   44,   42,   42,   41,   59,
362    59,   59,   12,   40,   41,   40,   59,   44,   59,   41,
363    59,   37,   44,   69,   41,   17,   42,   43,   41,   45,
364    44,   47,   59,   41,   91,   43,   91,   45,  264,  265,
365    40,   91,   91,   41,   38,   43,   46,   45,   91,   49,
366    91,   59,   40,   41,   42,   44,   44,   44,  125,   40,
367   123,   59,  125,  267,   91,   57,   91,   67,  123,   91,
368    59,  123,   59,  123,  123,  123,   70,   93,   91,   44,
369   123,  259,  123,   41,  123,   93,   44,   99,  123,   41,
370   102,   36,   60,  259,   59,   93,  123,   42,  269,   44,
371    40,   40,   91,   91,   72,   73,   74,   75,   76,   59,
372    40,   61,   62,   63,   64,   65,  261,  262,  263,  264,
373   265,   89,   37,   68,  269,  259,   94,   42,   43,   37,
374    45,   40,   47,   41,   42,   43,   40,   45,   37,   47,
375   259,   91,  259,   42,   59,   30,   31,   32,   47,  261,
376   262,  263,  264,  265,  266,  268,  259,  269,    4,   90,
377    70,   58,   57,   37,   -1,   -1,   -1,   -1,   -1,   -1,
378    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
379    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
380    -1,   -1,   -1,   -1,   -1,   -1,  259,  260,  261,  262,
381   263,  264,  265,  266,  259,  259,  269,  259,  260,  261,
382   262,  263,  264,  265,  266,   -1,  259,  269,  261,  262,
383   263,  264,  265,  259,  260,  260,  259,   -1,   -1,   -1,
384    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  259,
385    -1,  261,  262,  263,  264,  265,   -1,   -1,   -1,  269,
386 };
387 #if YYBTYACC
388 static const YYINT demo_ctable[] = {                     -1,
389     1,   10,   -1,   21,    4,   -1,   23,   29,   -1,    1,
390    51,   -1,  101,   56,   -1,   -1,   -1,   -1,   -1,   -1,
391    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
392    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
393    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
394    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
395    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
396    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
397    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
398    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
399    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
400    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
401    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
402    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
403    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
404    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
405    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
406    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
407    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
408    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
409    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
410    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
411    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
412    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
413    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
414    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
415    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
416 };
417 #endif
418 #define YYFINAL 1
419 #ifndef YYDEBUG
420 #define YYDEBUG 0
421 #endif
422 #define YYMAXTOKEN 269
423 #define YYUNDFTOKEN 301
424 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
425 #if YYDEBUG
426 static const char *const demo_name[] = {
427
428 "$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
429 "'%'",0,0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,0,0,0,0,0,0,0,0,0,
430 "';'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,
431 "']'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,
432 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
433 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
434 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
435 0,0,0,0,0,0,0,0,0,"error","PREFIX","POSTFIX","ID","CONSTANT","EXTERN",
436 "REGISTER","STATIC","CONST","VOLATILE","IF","THEN","ELSE","CLCL","$accept",
437 "input","expr","decl","declarator_list","decl_list","statement",
438 "statement_list","block_statement","declarator","formal_arg","decl_specs",
439 "decl_spec","typename","cv_quals","cv_qual","opt_scope","formal_arg_list",
440 "nonempty_formal_arg_list","$$1","$$2","$$3","$$4","$$5","$$6","$$7","$$8",
441 "$$9","$$10","$$11","$$12","illegal-symbol",
442 };
443 static const char *const demo_rule[] = {
444 "$accept : input",
445 "opt_scope :",
446 "opt_scope : CLCL",
447 "opt_scope : opt_scope ID CLCL",
448 "typename : opt_scope ID",
449 "$$1 :",
450 "input : $$1 decl_list",
451 "decl_list :",
452 "$$2 :",
453 "decl_list : decl_list $$2 decl",
454 "$$3 :",
455 "decl : decl_specs $$2 $$3 declarator_list ';'",
456 "$$4 :",
457 "decl : decl_specs $$2 $$3 declarator $$4 block_statement",
458 "decl_specs : decl_spec",
459 "decl_specs : decl_specs $$2 decl_spec",
460 "cv_quals :",
461 "cv_quals : cv_quals cv_qual",
462 "decl_spec : cv_qual",
463 "decl_spec : typename",
464 "decl_spec : EXTERN",
465 "decl_spec : REGISTER",
466 "decl_spec : STATIC",
467 "cv_qual : CONST",
468 "cv_qual : VOLATILE",
469 "$$5 :",
470 "$$6 :",
471 "declarator_list : declarator_list ',' $$5 $$6 declarator",
472 "declarator_list : declarator",
473 "declarator :",
474 "declarator : ID",
475 "$$7 :",
476 "$$8 :",
477 "declarator : '(' $$7 $$8 declarator ')'",
478 "declarator : '*' cv_quals $$5 $$6 declarator",
479 "declarator : declarator '[' $$5 expr ']'",
480 "declarator : declarator '(' $$5 formal_arg_list ')' cv_quals",
481 "formal_arg_list :",
482 "formal_arg_list : nonempty_formal_arg_list",
483 "nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$7 formal_arg",
484 "nonempty_formal_arg_list : formal_arg",
485 "formal_arg : decl_specs $$2 $$3 declarator",
486 "expr : expr '+' $$7 expr",
487 "expr : expr '-' $$7 expr",
488 "expr : expr '*' $$7 expr",
489 "expr : expr '%' $$7 expr",
490 "expr : expr '/' $$7 expr",
491 "expr : '*' $$2 expr",
492 "expr : ID",
493 "expr : CONSTANT",
494 "statement : decl",
495 "$$9 :",
496 "statement : $$9 expr ';'",
497 "$$10 :",
498 "$$11 :",
499 "statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE $$11 statement",
500 "statement : IF '(' $$7 expr ')' THEN $$10 statement",
501 "$$12 :",
502 "statement : $$12 block_statement",
503 "statement_list :",
504 "statement_list : statement_list $$2 statement",
505 "block_statement : '{' $$2 statement_list '}'",
506
507 };
508 #endif
509
510 int      yydebug;
511 int      yynerrs;
512
513 int      yyerrflag;
514 int      yychar;
515 YYSTYPE  yyval;
516 YYSTYPE  yylval;
517 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
518 YYLTYPE  yyloc; /* position returned by actions */
519 YYLTYPE  yylloc; /* position from the lexer */
520 #endif
521
522 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
523 #ifndef YYLLOC_DEFAULT
524 #define YYLLOC_DEFAULT(loc, rhs, n) \
525 do \
526 { \
527     if (n == 0) \
528     { \
529         (loc).first_line   = ((rhs)[-1]).last_line; \
530         (loc).first_column = ((rhs)[-1]).last_column; \
531         (loc).last_line    = ((rhs)[-1]).last_line; \
532         (loc).last_column  = ((rhs)[-1]).last_column; \
533     } \
534     else \
535     { \
536         (loc).first_line   = ((rhs)[ 0 ]).first_line; \
537         (loc).first_column = ((rhs)[ 0 ]).first_column; \
538         (loc).last_line    = ((rhs)[n-1]).last_line; \
539         (loc).last_column  = ((rhs)[n-1]).last_column; \
540     } \
541 } while (0)
542 #endif /* YYLLOC_DEFAULT */
543 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
544 #if YYBTYACC
545
546 #ifndef YYLVQUEUEGROWTH
547 #define YYLVQUEUEGROWTH 32
548 #endif
549 #endif /* YYBTYACC */
550
551 /* define the initial stack-sizes */
552 #ifdef YYSTACKSIZE
553 #undef YYMAXDEPTH
554 #define YYMAXDEPTH  YYSTACKSIZE
555 #else
556 #ifdef YYMAXDEPTH
557 #define YYSTACKSIZE YYMAXDEPTH
558 #else
559 #define YYSTACKSIZE 10000
560 #define YYMAXDEPTH  10000
561 #endif
562 #endif
563
564 #ifndef YYINITSTACKSIZE
565 #define YYINITSTACKSIZE 200
566 #endif
567
568 typedef struct {
569     unsigned stacksize;
570     short    *s_base;
571     short    *s_mark;
572     short    *s_last;
573     YYSTYPE  *l_base;
574     YYSTYPE  *l_mark;
575 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
576     YYLTYPE  *p_base;
577     YYLTYPE  *p_mark;
578 #endif
579 } YYSTACKDATA;
580 #if YYBTYACC
581
582 struct YYParseState_s
583 {
584     struct YYParseState_s *save;    /* Previously saved parser state */
585     YYSTACKDATA            yystack; /* saved parser stack */
586     int                    state;   /* saved parser state */
587     int                    errflag; /* saved error recovery status */
588     int                    lexeme;  /* saved index of the conflict lexeme in the lexical queue */
589     YYINT                  ctry;    /* saved index in yyctable[] for this conflict */
590 };
591 typedef struct YYParseState_s YYParseState;
592 #endif /* YYBTYACC */
593 /* variables for the parser stack */
594 static YYSTACKDATA yystack;
595 #if YYBTYACC
596
597 /* Current parser state */
598 static YYParseState *yyps = 0;
599
600 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
601 static YYParseState *yypath = 0;
602
603 /* Base of the lexical value queue */
604 static YYSTYPE *yylvals = 0;
605
606 /* Current position at lexical value queue */
607 static YYSTYPE *yylvp = 0;
608
609 /* End position of lexical value queue */
610 static YYSTYPE *yylve = 0;
611
612 /* The last allocated position at the lexical value queue */
613 static YYSTYPE *yylvlim = 0;
614
615 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
616 /* Base of the lexical position queue */
617 static YYLTYPE *yylpsns = 0;
618
619 /* Current position at lexical position queue */
620 static YYLTYPE *yylpp = 0;
621
622 /* End position of lexical position queue */
623 static YYLTYPE *yylpe = 0;
624
625 /* The last allocated position at the lexical position queue */
626 static YYLTYPE *yylplim = 0;
627 #endif
628
629 /* Current position at lexical token queue */
630 static short  *yylexp = 0;
631
632 static short  *yylexemes = 0;
633 #endif /* YYBTYACC */
634 #line 200 "btyacc_demo.y"
635
636 extern int YYLEX_DECL();
637 extern void YYERROR_DECL();
638
639 extern Scope *global_scope;
640
641 extern Decl * lookup(Scope *scope, char *id);
642 extern Scope * new_scope(Scope *outer_scope);
643 extern Scope * start_fn_def(Scope *scope, Decl *fn_decl);
644 extern void finish_fn_def(Decl *fn_decl, Code *block);
645 extern Type * type_combine(Type *specs, Type *spec);
646 extern Type * bare_extern(void);
647 extern Type * bare_register(void);
648 extern Type * bare_static(void);
649 extern Type * bare_const(void);
650 extern Type * bare_volatile(void);
651 extern Decl * declare(Scope *scope, char *id, Type *type);
652 extern Decl * make_pointer(Decl *decl, Type *type);
653 extern Decl * make_array(Type *type, Expr *expr);
654 extern Decl * build_function(Decl *decl, Decl_List *dlist, Type *type);
655 extern Decl_List * append_dlist(Decl_List *dlist, Decl *decl);
656 extern Decl_List * build_dlist(Decl *decl);
657 extern Expr * build_expr(Expr *left, enum Operator op, Expr *right);
658 extern Expr * var_expr(Scope *scope, char *id);
659 extern Code * build_expr_code(Expr *expr);
660 extern Code * build_if(Expr *cond_expr, Code *then_stmt, Code *else_stmt);
661 extern Code * code_append(Code *stmt_list, Code *stmt);
662 #line 663 "btyacc_demo.tab.c"
663
664 /* Release memory associated with symbol. */
665 #if ! defined YYDESTRUCT_IS_DECLARED
666 static void
667 YYDESTRUCT_DECL()
668 {
669     switch (psymb)
670     {
671         case 43:
672 #line 83 "btyacc_demo.y"
673         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
674                          msg,
675                          (*loc).first_line, (*loc).first_column,
676                          (*loc).last_line, (*loc).last_column);
677                   /* in this example, we don't know what to do here */ }
678         break;
679 #line 680 "btyacc_demo.tab.c"
680         case 45:
681 #line 83 "btyacc_demo.y"
682         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
683                          msg,
684                          (*loc).first_line, (*loc).first_column,
685                          (*loc).last_line, (*loc).last_column);
686                   /* in this example, we don't know what to do here */ }
687         break;
688 #line 689 "btyacc_demo.tab.c"
689         case 42:
690 #line 83 "btyacc_demo.y"
691         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
692                          msg,
693                          (*loc).first_line, (*loc).first_column,
694                          (*loc).last_line, (*loc).last_column);
695                   /* in this example, we don't know what to do here */ }
696         break;
697 #line 698 "btyacc_demo.tab.c"
698         case 47:
699 #line 83 "btyacc_demo.y"
700         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
701                          msg,
702                          (*loc).first_line, (*loc).first_column,
703                          (*loc).last_line, (*loc).last_column);
704                   /* in this example, we don't know what to do here */ }
705         break;
706 #line 707 "btyacc_demo.tab.c"
707         case 37:
708 #line 83 "btyacc_demo.y"
709         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
710                          msg,
711                          (*loc).first_line, (*loc).first_column,
712                          (*loc).last_line, (*loc).last_column);
713                   /* in this example, we don't know what to do here */ }
714         break;
715 #line 716 "btyacc_demo.tab.c"
716         case 257:
717 #line 83 "btyacc_demo.y"
718         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
719                          msg,
720                          (*loc).first_line, (*loc).first_column,
721                          (*loc).last_line, (*loc).last_column);
722                   /* in this example, we don't know what to do here */ }
723         break;
724 #line 725 "btyacc_demo.tab.c"
725         case 258:
726 #line 83 "btyacc_demo.y"
727         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
728                          msg,
729                          (*loc).first_line, (*loc).first_column,
730                          (*loc).last_line, (*loc).last_column);
731                   /* in this example, we don't know what to do here */ }
732         break;
733 #line 734 "btyacc_demo.tab.c"
734         case 40:
735 #line 83 "btyacc_demo.y"
736         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
737                          msg,
738                          (*loc).first_line, (*loc).first_column,
739                          (*loc).last_line, (*loc).last_column);
740                   /* in this example, we don't know what to do here */ }
741         break;
742 #line 743 "btyacc_demo.tab.c"
743         case 91:
744 #line 83 "btyacc_demo.y"
745         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
746                          msg,
747                          (*loc).first_line, (*loc).first_column,
748                          (*loc).last_line, (*loc).last_column);
749                   /* in this example, we don't know what to do here */ }
750         break;
751 #line 752 "btyacc_demo.tab.c"
752         case 46:
753 #line 83 "btyacc_demo.y"
754         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
755                          msg,
756                          (*loc).first_line, (*loc).first_column,
757                          (*loc).last_line, (*loc).last_column);
758                   /* in this example, we don't know what to do here */ }
759         break;
760 #line 761 "btyacc_demo.tab.c"
761         case 259:
762 #line 78 "btyacc_demo.y"
763         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
764                          msg,
765                          (*loc).first_line, (*loc).first_column,
766                          (*loc).last_line, (*loc).last_column);
767                   free((*val).id); }
768         break;
769 #line 770 "btyacc_demo.tab.c"
770         case 260:
771 #line 78 "btyacc_demo.y"
772         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
773                          msg,
774                          (*loc).first_line, (*loc).first_column,
775                          (*loc).last_line, (*loc).last_column);
776                   free((*val).expr); }
777         break;
778 #line 779 "btyacc_demo.tab.c"
779         case 261:
780 #line 83 "btyacc_demo.y"
781         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
782                          msg,
783                          (*loc).first_line, (*loc).first_column,
784                          (*loc).last_line, (*loc).last_column);
785                   /* in this example, we don't know what to do here */ }
786         break;
787 #line 788 "btyacc_demo.tab.c"
788         case 262:
789 #line 83 "btyacc_demo.y"
790         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
791                          msg,
792                          (*loc).first_line, (*loc).first_column,
793                          (*loc).last_line, (*loc).last_column);
794                   /* in this example, we don't know what to do here */ }
795         break;
796 #line 797 "btyacc_demo.tab.c"
797         case 263:
798 #line 83 "btyacc_demo.y"
799         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
800                          msg,
801                          (*loc).first_line, (*loc).first_column,
802                          (*loc).last_line, (*loc).last_column);
803                   /* in this example, we don't know what to do here */ }
804         break;
805 #line 806 "btyacc_demo.tab.c"
806         case 264:
807 #line 83 "btyacc_demo.y"
808         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
809                          msg,
810                          (*loc).first_line, (*loc).first_column,
811                          (*loc).last_line, (*loc).last_column);
812                   /* in this example, we don't know what to do here */ }
813         break;
814 #line 815 "btyacc_demo.tab.c"
815         case 265:
816 #line 83 "btyacc_demo.y"
817         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
818                          msg,
819                          (*loc).first_line, (*loc).first_column,
820                          (*loc).last_line, (*loc).last_column);
821                   /* in this example, we don't know what to do here */ }
822         break;
823 #line 824 "btyacc_demo.tab.c"
824         case 266:
825 #line 83 "btyacc_demo.y"
826         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
827                          msg,
828                          (*loc).first_line, (*loc).first_column,
829                          (*loc).last_line, (*loc).last_column);
830                   /* in this example, we don't know what to do here */ }
831         break;
832 #line 833 "btyacc_demo.tab.c"
833         case 267:
834 #line 83 "btyacc_demo.y"
835         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
836                          msg,
837                          (*loc).first_line, (*loc).first_column,
838                          (*loc).last_line, (*loc).last_column);
839                   /* in this example, we don't know what to do here */ }
840         break;
841 #line 842 "btyacc_demo.tab.c"
842         case 268:
843 #line 83 "btyacc_demo.y"
844         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
845                          msg,
846                          (*loc).first_line, (*loc).first_column,
847                          (*loc).last_line, (*loc).last_column);
848                   /* in this example, we don't know what to do here */ }
849         break;
850 #line 851 "btyacc_demo.tab.c"
851         case 269:
852 #line 83 "btyacc_demo.y"
853         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
854                          msg,
855                          (*loc).first_line, (*loc).first_column,
856                          (*loc).last_line, (*loc).last_column);
857                   /* in this example, we don't know what to do here */ }
858         break;
859 #line 860 "btyacc_demo.tab.c"
860         case 59:
861 #line 83 "btyacc_demo.y"
862         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
863                          msg,
864                          (*loc).first_line, (*loc).first_column,
865                          (*loc).last_line, (*loc).last_column);
866                   /* in this example, we don't know what to do here */ }
867         break;
868 #line 869 "btyacc_demo.tab.c"
869         case 44:
870 #line 83 "btyacc_demo.y"
871         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
872                          msg,
873                          (*loc).first_line, (*loc).first_column,
874                          (*loc).last_line, (*loc).last_column);
875                   /* in this example, we don't know what to do here */ }
876         break;
877 #line 878 "btyacc_demo.tab.c"
878         case 41:
879 #line 83 "btyacc_demo.y"
880         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
881                          msg,
882                          (*loc).first_line, (*loc).first_column,
883                          (*loc).last_line, (*loc).last_column);
884                   /* in this example, we don't know what to do here */ }
885         break;
886 #line 887 "btyacc_demo.tab.c"
887         case 93:
888 #line 83 "btyacc_demo.y"
889         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
890                          msg,
891                          (*loc).first_line, (*loc).first_column,
892                          (*loc).last_line, (*loc).last_column);
893                   /* in this example, we don't know what to do here */ }
894         break;
895 #line 896 "btyacc_demo.tab.c"
896         case 123:
897 #line 83 "btyacc_demo.y"
898         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
899                          msg,
900                          (*loc).first_line, (*loc).first_column,
901                          (*loc).last_line, (*loc).last_column);
902                   /* in this example, we don't know what to do here */ }
903         break;
904 #line 905 "btyacc_demo.tab.c"
905         case 125:
906 #line 83 "btyacc_demo.y"
907         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
908                          msg,
909                          (*loc).first_line, (*loc).first_column,
910                          (*loc).last_line, (*loc).last_column);
911                   /* in this example, we don't know what to do here */ }
912         break;
913 #line 914 "btyacc_demo.tab.c"
914         case 270:
915 #line 83 "btyacc_demo.y"
916         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
917                          msg,
918                          (*loc).first_line, (*loc).first_column,
919                          (*loc).last_line, (*loc).last_column);
920                   /* in this example, we don't know what to do here */ }
921         break;
922 #line 923 "btyacc_demo.tab.c"
923         case 271:
924 #line 83 "btyacc_demo.y"
925         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
926                          msg,
927                          (*loc).first_line, (*loc).first_column,
928                          (*loc).last_line, (*loc).last_column);
929                   /* in this example, we don't know what to do here */ }
930         break;
931 #line 932 "btyacc_demo.tab.c"
932         case 272:
933 #line 78 "btyacc_demo.y"
934         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
935                          msg,
936                          (*loc).first_line, (*loc).first_column,
937                          (*loc).last_line, (*loc).last_column);
938                   free((*val).expr); }
939         break;
940 #line 941 "btyacc_demo.tab.c"
941         case 273:
942 #line 67 "btyacc_demo.y"
943         { /* 'msg' is a 'char *' indicating the context of destructor invocation*/
944                   printf("%s accessed by symbol \"decl\" (case s.b. 273) @ position[%d,%d..%d,%d]\n",
945                          msg,
946                          (*loc).first_line, (*loc).first_column,
947                          (*loc).last_line, (*loc).last_column);
948                   free((*val).decl->scope); free((*val).decl->type); }
949         break;
950 #line 951 "btyacc_demo.tab.c"
951         case 274:
952 #line 83 "btyacc_demo.y"
953         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
954                          msg,
955                          (*loc).first_line, (*loc).first_column,
956                          (*loc).last_line, (*loc).last_column);
957                   /* in this example, we don't know what to do here */ }
958         break;
959 #line 960 "btyacc_demo.tab.c"
960         case 275:
961 #line 83 "btyacc_demo.y"
962         { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
963                          msg,
964                          (*loc).first_line, (*loc).first_column,
965                          (*loc).last_line, (*loc).last_column);
966                   /* in this example, we don't know what to do here */ }
967         break;
968 #line 969 "btyacc_demo.tab.c"
969         case 276:
970 #line 78 "btyacc_demo.y"
971         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
972                          msg,
973                          (*loc).first_line, (*loc).first_column,
974                          (*loc).last_line, (*loc).last_column);
975                   free((*val).code); }
976         break;
977 #line 978 "btyacc_demo.tab.c"
978         case 277:
979 #line 78 "btyacc_demo.y"
980         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
981                          msg,
982                          (*loc).first_line, (*loc).first_column,
983                          (*loc).last_line, (*loc).last_column);
984                   free((*val).code); }
985         break;
986 #line 987 "btyacc_demo.tab.c"
987         case 278:
988 #line 78 "btyacc_demo.y"
989         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
990                          msg,
991                          (*loc).first_line, (*loc).first_column,
992                          (*loc).last_line, (*loc).last_column);
993                   free((*val).code); }
994         break;
995 #line 996 "btyacc_demo.tab.c"
996         case 279:
997 #line 73 "btyacc_demo.y"
998         { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
999                          msg,
1000                          (*loc).first_line, (*loc).first_column,
1001                          (*loc).last_line, (*loc).last_column);
1002                   free((*val).decl); }
1003         break;
1004 #line 1005 "btyacc_demo.tab.c"
1005         case 280:
1006 #line 73 "btyacc_demo.y"
1007         { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
1008                          msg,
1009                          (*loc).first_line, (*loc).first_column,
1010                          (*loc).last_line, (*loc).last_column);
1011                   free((*val).decl); }
1012         break;
1013 #line 1014 "btyacc_demo.tab.c"
1014         case 281:
1015 #line 78 "btyacc_demo.y"
1016         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1017                          msg,
1018                          (*loc).first_line, (*loc).first_column,
1019                          (*loc).last_line, (*loc).last_column);
1020                   free((*val).type); }
1021         break;
1022 #line 1023 "btyacc_demo.tab.c"
1023         case 282:
1024 #line 78 "btyacc_demo.y"
1025         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1026                          msg,
1027                          (*loc).first_line, (*loc).first_column,
1028                          (*loc).last_line, (*loc).last_column);
1029                   free((*val).type); }
1030         break;
1031 #line 1032 "btyacc_demo.tab.c"
1032         case 283:
1033 #line 78 "btyacc_demo.y"
1034         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1035                          msg,
1036                          (*loc).first_line, (*loc).first_column,
1037                          (*loc).last_line, (*loc).last_column);
1038                   free((*val).type); }
1039         break;
1040 #line 1041 "btyacc_demo.tab.c"
1041         case 284:
1042 #line 78 "btyacc_demo.y"
1043         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1044                          msg,
1045                          (*loc).first_line, (*loc).first_column,
1046                          (*loc).last_line, (*loc).last_column);
1047                   free((*val).type); }
1048         break;
1049 #line 1050 "btyacc_demo.tab.c"
1050         case 285:
1051 #line 78 "btyacc_demo.y"
1052         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1053                          msg,
1054                          (*loc).first_line, (*loc).first_column,
1055                          (*loc).last_line, (*loc).last_column);
1056                   free((*val).type); }
1057         break;
1058 #line 1059 "btyacc_demo.tab.c"
1059         case 286:
1060 #line 78 "btyacc_demo.y"
1061         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1062                          msg,
1063                          (*loc).first_line, (*loc).first_column,
1064                          (*loc).last_line, (*loc).last_column);
1065                   free((*val).scope); }
1066         break;
1067 #line 1068 "btyacc_demo.tab.c"
1068         case 287:
1069 #line 78 "btyacc_demo.y"
1070         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1071                          msg,
1072                          (*loc).first_line, (*loc).first_column,
1073                          (*loc).last_line, (*loc).last_column);
1074                   free((*val).dlist); }
1075         break;
1076 #line 1077 "btyacc_demo.tab.c"
1077         case 288:
1078 #line 78 "btyacc_demo.y"
1079         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1080                          msg,
1081                          (*loc).first_line, (*loc).first_column,
1082                          (*loc).last_line, (*loc).last_column);
1083                   free((*val).dlist); }
1084         break;
1085 #line 1086 "btyacc_demo.tab.c"
1086         case 289:
1087 #line 78 "btyacc_demo.y"
1088         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1089                          msg,
1090                          (*loc).first_line, (*loc).first_column,
1091                          (*loc).last_line, (*loc).last_column);
1092                   free((*val).scope); }
1093         break;
1094 #line 1095 "btyacc_demo.tab.c"
1095         case 290:
1096 #line 78 "btyacc_demo.y"
1097         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1098                          msg,
1099                          (*loc).first_line, (*loc).first_column,
1100                          (*loc).last_line, (*loc).last_column);
1101                   free((*val).scope); }
1102         break;
1103 #line 1104 "btyacc_demo.tab.c"
1104         case 291:
1105 #line 78 "btyacc_demo.y"
1106         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1107                          msg,
1108                          (*loc).first_line, (*loc).first_column,
1109                          (*loc).last_line, (*loc).last_column);
1110                   free((*val).type); }
1111         break;
1112 #line 1113 "btyacc_demo.tab.c"
1113         case 292:
1114 #line 78 "btyacc_demo.y"
1115         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1116                          msg,
1117                          (*loc).first_line, (*loc).first_column,
1118                          (*loc).last_line, (*loc).last_column);
1119                   free((*val).scope); }
1120         break;
1121 #line 1122 "btyacc_demo.tab.c"
1122         case 293:
1123 #line 78 "btyacc_demo.y"
1124         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1125                          msg,
1126                          (*loc).first_line, (*loc).first_column,
1127                          (*loc).last_line, (*loc).last_column);
1128                   free((*val).scope); }
1129         break;
1130 #line 1131 "btyacc_demo.tab.c"
1131         case 294:
1132 #line 78 "btyacc_demo.y"
1133         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1134                          msg,
1135                          (*loc).first_line, (*loc).first_column,
1136                          (*loc).last_line, (*loc).last_column);
1137                   free((*val).type); }
1138         break;
1139 #line 1140 "btyacc_demo.tab.c"
1140         case 295:
1141 #line 78 "btyacc_demo.y"
1142         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1143                          msg,
1144                          (*loc).first_line, (*loc).first_column,
1145                          (*loc).last_line, (*loc).last_column);
1146                   free((*val).scope); }
1147         break;
1148 #line 1149 "btyacc_demo.tab.c"
1149         case 296:
1150 #line 78 "btyacc_demo.y"
1151         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1152                          msg,
1153                          (*loc).first_line, (*loc).first_column,
1154                          (*loc).last_line, (*loc).last_column);
1155                   free((*val).type); }
1156         break;
1157 #line 1158 "btyacc_demo.tab.c"
1158         case 297:
1159 #line 78 "btyacc_demo.y"
1160         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1161                          msg,
1162                          (*loc).first_line, (*loc).first_column,
1163                          (*loc).last_line, (*loc).last_column);
1164                   free((*val).scope); }
1165         break;
1166 #line 1167 "btyacc_demo.tab.c"
1167         case 298:
1168 #line 78 "btyacc_demo.y"
1169         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1170                          msg,
1171                          (*loc).first_line, (*loc).first_column,
1172                          (*loc).last_line, (*loc).last_column);
1173                   free((*val).scope); }
1174         break;
1175 #line 1176 "btyacc_demo.tab.c"
1176         case 299:
1177 #line 78 "btyacc_demo.y"
1178         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1179                          msg,
1180                          (*loc).first_line, (*loc).first_column,
1181                          (*loc).last_line, (*loc).last_column);
1182                   free((*val).scope); }
1183         break;
1184 #line 1185 "btyacc_demo.tab.c"
1185         case 300:
1186 #line 78 "btyacc_demo.y"
1187         { printf("%s accessed by symbol of any type other than <decl>  @ position[%d,%d..%d,%d]\n",
1188                          msg,
1189                          (*loc).first_line, (*loc).first_column,
1190                          (*loc).last_line, (*loc).last_column);
1191                   free((*val).scope); }
1192         break;
1193 #line 1194 "btyacc_demo.tab.c"
1194     }
1195 }
1196 #define YYDESTRUCT_IS_DECLARED 1
1197 #endif
1198
1199 /* For use in generated program */
1200 #define yydepth (int)(yystack.s_mark - yystack.s_base)
1201 #if YYBTYACC
1202 #define yytrial (yyps->save)
1203 #endif /* YYBTYACC */
1204
1205 #if YYDEBUG
1206 #include <stdio.h>         /* needed for printf */
1207 #endif
1208
1209 #include <stdlib.h>        /* needed for malloc, etc */
1210 #include <string.h>        /* needed for memset */
1211
1212 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
1213 static int yygrowstack(YYSTACKDATA *data)
1214 {
1215     int i;
1216     unsigned newsize;
1217     short *newss;
1218     YYSTYPE *newvs;
1219 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1220     YYLTYPE *newps;
1221 #endif
1222
1223     if ((newsize = data->stacksize) == 0)
1224         newsize = YYINITSTACKSIZE;
1225     else if (newsize >= YYMAXDEPTH)
1226         return YYENOMEM;
1227     else if ((newsize *= 2) > YYMAXDEPTH)
1228         newsize = YYMAXDEPTH;
1229
1230     i = (int) (data->s_mark - data->s_base);
1231     newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
1232     if (newss == 0)
1233         return YYENOMEM;
1234
1235     data->s_base = newss;
1236     data->s_mark = newss + i;
1237
1238     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
1239     if (newvs == 0)
1240         return YYENOMEM;
1241
1242     data->l_base = newvs;
1243     data->l_mark = newvs + i;
1244
1245 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1246     newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
1247     if (newps == 0)
1248         return YYENOMEM;
1249
1250     data->p_base = newps;
1251     data->p_mark = newps + i;
1252 #endif
1253
1254     data->stacksize = newsize;
1255     data->s_last = data->s_base + newsize - 1;
1256
1257 #if YYDEBUG
1258     if (yydebug)
1259         fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
1260 #endif
1261     return 0;
1262 }
1263
1264 #if YYPURE || defined(YY_NO_LEAKS)
1265 static void yyfreestack(YYSTACKDATA *data)
1266 {
1267     free(data->s_base);
1268     free(data->l_base);
1269 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1270     free(data->p_base);
1271 #endif
1272     memset(data, 0, sizeof(*data));
1273 }
1274 #else
1275 #define yyfreestack(data) /* nothing */
1276 #endif /* YYPURE || defined(YY_NO_LEAKS) */
1277 #if YYBTYACC
1278
1279 static YYParseState *
1280 yyNewState(unsigned size)
1281 {
1282     YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
1283     if (p == NULL) return NULL;
1284
1285     p->yystack.stacksize = size;
1286     if (size == 0)
1287     {
1288         p->yystack.s_base = NULL;
1289         p->yystack.l_base = NULL;
1290 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1291         p->yystack.p_base = NULL;
1292 #endif
1293         return p;
1294     }
1295     p->yystack.s_base    = (short *) malloc(size * sizeof(short));
1296     if (p->yystack.s_base == NULL) return NULL;
1297     p->yystack.l_base    = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
1298     if (p->yystack.l_base == NULL) return NULL;
1299     memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
1300 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1301     p->yystack.p_base    = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
1302     if (p->yystack.p_base == NULL) return NULL;
1303     memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
1304 #endif
1305
1306     return p;
1307 }
1308
1309 static void
1310 yyFreeState(YYParseState *p)
1311 {
1312     yyfreestack(&p->yystack);
1313     free(p);
1314 }
1315 #endif /* YYBTYACC */
1316
1317 #define YYABORT  goto yyabort
1318 #define YYREJECT goto yyabort
1319 #define YYACCEPT goto yyaccept
1320 #define YYERROR  goto yyerrlab
1321 #if YYBTYACC
1322 #define YYVALID        do { if (yyps->save)            goto yyvalid; } while(0)
1323 #define YYVALID_NESTED do { if (yyps->save && \
1324                                 yyps->save->save == 0) goto yyvalid; } while(0)
1325 #endif /* YYBTYACC */
1326
1327 int
1328 YYPARSE_DECL()
1329 {
1330     int yym, yyn, yystate, yyresult;
1331 #if YYBTYACC
1332     int yynewerrflag;
1333     YYParseState *yyerrctx = NULL;
1334 #endif /* YYBTYACC */
1335 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1336     YYLTYPE  yyerror_loc_range[2]; /* position of error start & end */
1337 #endif
1338 #if YYDEBUG
1339     const char *yys;
1340
1341     if ((yys = getenv("YYDEBUG")) != 0)
1342     {
1343         yyn = *yys;
1344         if (yyn >= '0' && yyn <= '9')
1345             yydebug = yyn - '0';
1346     }
1347     if (yydebug)
1348         fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
1349 #endif
1350
1351 #if YYBTYACC
1352     yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
1353     yyps->save = 0;
1354 #endif /* YYBTYACC */
1355     yynerrs = 0;
1356     yyerrflag = 0;
1357     yychar = YYEMPTY;
1358     yystate = 0;
1359
1360 #if YYPURE
1361     memset(&yystack, 0, sizeof(yystack));
1362 #endif
1363
1364     if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1365     yystack.s_mark = yystack.s_base;
1366     yystack.l_mark = yystack.l_base;
1367 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1368     yystack.p_mark = yystack.p_base;
1369 #endif
1370     yystate = 0;
1371     *yystack.s_mark = 0;
1372
1373 yyloop:
1374     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
1375     if (yychar < 0)
1376     {
1377 #if YYBTYACC
1378         do {
1379         if (yylvp < yylve)
1380         {
1381             /* we're currently re-reading tokens */
1382             yylval = *yylvp++;
1383 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1384             yylloc = *yylpp++;
1385 #endif
1386             yychar = *yylexp++;
1387             break;
1388         }
1389         if (yyps->save)
1390         {
1391             /* in trial mode; save scanner results for future parse attempts */
1392             if (yylvp == yylvlim)
1393             {   /* Enlarge lexical value queue */
1394                 size_t p = (size_t) (yylvp - yylvals);
1395                 size_t s = (size_t) (yylvlim - yylvals);
1396
1397                 s += YYLVQUEUEGROWTH;
1398                 if ((yylexemes = (short *)   realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
1399                 if ((yylvals   = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
1400 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1401                 if ((yylpsns   = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
1402 #endif
1403                 yylvp   = yylve = yylvals + p;
1404                 yylvlim = yylvals + s;
1405 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1406                 yylpp   = yylpe = yylpsns + p;
1407                 yylplim = yylpsns + s;
1408 #endif
1409                 yylexp  = yylexemes + p;
1410             }
1411             *yylexp = (short) YYLEX;
1412             *yylvp++ = yylval;
1413             yylve++;
1414 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1415             *yylpp++ = yylloc;
1416             yylpe++;
1417 #endif
1418             yychar = *yylexp++;
1419             break;
1420         }
1421         /* normal operation, no conflict encountered */
1422 #endif /* YYBTYACC */
1423         yychar = YYLEX;
1424 #if YYBTYACC
1425         } while (0);
1426 #endif /* YYBTYACC */
1427         if (yychar < 0) yychar = YYEOF;
1428         /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1429 #if YYDEBUG
1430         if (yydebug)
1431         {
1432             yys = yyname[YYTRANSLATE(yychar)];
1433             fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
1434                             YYDEBUGSTR, yydepth, yystate, yychar, yys);
1435 #ifdef YYSTYPE_TOSTRING
1436 #if YYBTYACC
1437             if (!yytrial)
1438 #endif /* YYBTYACC */
1439                 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
1440 #endif
1441             fputc('\n', stderr);
1442         }
1443 #endif
1444     }
1445 #if YYBTYACC
1446
1447     /* Do we have a conflict? */
1448     if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1449         yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1450     {
1451         YYINT ctry;
1452
1453         if (yypath)
1454         {
1455             YYParseState *save;
1456 #if YYDEBUG
1457             if (yydebug)
1458                 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
1459                                 YYDEBUGSTR, yydepth, yystate);
1460 #endif
1461             /* Switch to the next conflict context */
1462             save = yypath;
1463             yypath = save->save;
1464             save->save = NULL;
1465             ctry = save->ctry;
1466             if (save->state != yystate) YYABORT;
1467             yyFreeState(save);
1468
1469         }
1470         else
1471         {
1472
1473             /* Unresolved conflict - start/continue trial parse */
1474             YYParseState *save;
1475 #if YYDEBUG
1476             if (yydebug)
1477             {
1478                 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
1479                 if (yyps->save)
1480                     fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
1481                 else
1482                     fputs("Starting trial parse.\n", stderr);
1483             }
1484 #endif
1485             save                  = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1486             if (save == NULL) goto yyenomem;
1487             save->save            = yyps->save;
1488             save->state           = yystate;
1489             save->errflag         = yyerrflag;
1490             save->yystack.s_mark  = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
1491             memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1492             save->yystack.l_mark  = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
1493             memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1494 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1495             save->yystack.p_mark  = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
1496             memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1497 #endif
1498             ctry                  = yytable[yyn];
1499             if (yyctable[ctry] == -1)
1500             {
1501 #if YYDEBUG
1502                 if (yydebug && yychar >= YYEOF)
1503                     fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
1504 #endif
1505                 ctry++;
1506             }
1507             save->ctry = ctry;
1508             if (yyps->save == NULL)
1509             {
1510                 /* If this is a first conflict in the stack, start saving lexemes */
1511                 if (!yylexemes)
1512                 {
1513                     yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
1514                     if (yylexemes == NULL) goto yyenomem;
1515                     yylvals   = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
1516                     if (yylvals == NULL) goto yyenomem;
1517                     yylvlim   = yylvals + YYLVQUEUEGROWTH;
1518 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1519                     yylpsns   = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
1520                     if (yylpsns == NULL) goto yyenomem;
1521                     yylplim   = yylpsns + YYLVQUEUEGROWTH;
1522 #endif
1523                 }
1524                 if (yylvp == yylve)
1525                 {
1526                     yylvp  = yylve = yylvals;
1527 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1528                     yylpp  = yylpe = yylpsns;
1529 #endif
1530                     yylexp = yylexemes;
1531                     if (yychar >= YYEOF)
1532                     {
1533                         *yylve++ = yylval;
1534 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1535                         *yylpe++ = yylloc;
1536 #endif
1537                         *yylexp  = (short) yychar;
1538                         yychar   = YYEMPTY;
1539                     }
1540                 }
1541             }
1542             if (yychar >= YYEOF)
1543             {
1544                 yylvp--;
1545 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1546                 yylpp--;
1547 #endif
1548                 yylexp--;
1549                 yychar = YYEMPTY;
1550             }
1551             save->lexeme = (int) (yylvp - yylvals);
1552             yyps->save   = save;
1553         }
1554         if (yytable[yyn] == ctry)
1555         {
1556 #if YYDEBUG
1557             if (yydebug)
1558                 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1559                                 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
1560 #endif
1561             if (yychar < 0)
1562             {
1563                 yylvp++;
1564 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1565                 yylpp++;
1566 #endif
1567                 yylexp++;
1568             }
1569             if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
1570                 goto yyoverflow;
1571             yystate = yyctable[ctry];
1572             *++yystack.s_mark = (short) yystate;
1573             *++yystack.l_mark = yylval;
1574 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1575             *++yystack.p_mark = yylloc;
1576 #endif
1577             yychar  = YYEMPTY;
1578             if (yyerrflag > 0) --yyerrflag;
1579             goto yyloop;
1580         }
1581         else
1582         {
1583             yyn = yyctable[ctry];
1584             goto yyreduce;
1585         }
1586     } /* End of code dealing with conflicts */
1587 #endif /* YYBTYACC */
1588     if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1589             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1590     {
1591 #if YYDEBUG
1592         if (yydebug)
1593             fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1594                             YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
1595 #endif
1596         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1597         yystate = yytable[yyn];
1598         *++yystack.s_mark = yytable[yyn];
1599         *++yystack.l_mark = yylval;
1600 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1601         *++yystack.p_mark = yylloc;
1602 #endif
1603         yychar = YYEMPTY;
1604         if (yyerrflag > 0)  --yyerrflag;
1605         goto yyloop;
1606     }
1607     if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1608             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1609     {
1610         yyn = yytable[yyn];
1611         goto yyreduce;
1612     }
1613     if (yyerrflag != 0) goto yyinrecovery;
1614 #if YYBTYACC
1615
1616     yynewerrflag = 1;
1617     goto yyerrhandler;
1618     goto yyerrlab;
1619
1620 yyerrlab:
1621     yynewerrflag = 0;
1622 yyerrhandler:
1623     while (yyps->save)
1624     {
1625         int ctry;
1626         YYParseState *save = yyps->save;
1627 #if YYDEBUG
1628         if (yydebug)
1629             fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
1630                             YYDEBUGSTR, yydepth, yystate, yyps->save->state,
1631                     (int)(yylvp - yylvals - yyps->save->lexeme));
1632 #endif
1633         /* Memorize most forward-looking error state in case it's really an error. */
1634         if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
1635         {
1636             /* Free old saved error context state */
1637             if (yyerrctx) yyFreeState(yyerrctx);
1638             /* Create and fill out new saved error context state */
1639             yyerrctx                 = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1640             if (yyerrctx == NULL) goto yyenomem;
1641             yyerrctx->save           = yyps->save;
1642             yyerrctx->state          = yystate;
1643             yyerrctx->errflag        = yyerrflag;
1644             yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1645             memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1646             yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
1647             memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1648 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1649             yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
1650             memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1651 #endif
1652             yyerrctx->lexeme         = (int) (yylvp - yylvals);
1653         }
1654         yylvp          = yylvals   + save->lexeme;
1655 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1656         yylpp          = yylpsns   + save->lexeme;
1657 #endif
1658         yylexp         = yylexemes + save->lexeme;
1659         yychar         = YYEMPTY;
1660         yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1661         memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1662         yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1663         memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1664 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1665         yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1666         memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1667 #endif
1668         ctry           = ++save->ctry;
1669         yystate        = save->state;
1670         /* We tried shift, try reduce now */
1671         if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1672         yyps->save     = save->save;
1673         save->save     = NULL;
1674         yyFreeState(save);
1675
1676         /* Nothing left on the stack -- error */
1677         if (!yyps->save)
1678         {
1679 #if YYDEBUG
1680             if (yydebug)
1681                 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1682                                 YYPREFIX, yydepth);
1683 #endif
1684             /* Restore state as it was in the most forward-advanced error */
1685             yylvp          = yylvals   + yyerrctx->lexeme;
1686 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1687             yylpp          = yylpsns   + yyerrctx->lexeme;
1688 #endif
1689             yylexp         = yylexemes + yyerrctx->lexeme;
1690             yychar         = yylexp[-1];
1691             yylval         = yylvp[-1];
1692 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1693             yylloc         = yylpp[-1];
1694 #endif
1695             yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1696             memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1697             yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1698             memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1699 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1700             yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1701             memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1702 #endif
1703             yystate        = yyerrctx->state;
1704             yyFreeState(yyerrctx);
1705             yyerrctx       = NULL;
1706         }
1707         yynewerrflag = 1;
1708     }
1709     if (yynewerrflag == 0) goto yyinrecovery;
1710 #endif /* YYBTYACC */
1711
1712     YYERROR_CALL("syntax error");
1713 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1714     yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1715 #endif
1716
1717 #if !YYBTYACC
1718     goto yyerrlab;
1719 yyerrlab:
1720 #endif
1721     ++yynerrs;
1722
1723 yyinrecovery:
1724     if (yyerrflag < 3)
1725     {
1726         yyerrflag = 3;
1727         for (;;)
1728         {
1729             if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1730                     yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1731             {
1732 #if YYDEBUG
1733                 if (yydebug)
1734                     fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1735                                     YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1736 #endif
1737                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1738                 yystate = yytable[yyn];
1739                 *++yystack.s_mark = yytable[yyn];
1740                 *++yystack.l_mark = yylval;
1741 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1742                 /* lookahead position is error end position */
1743                 yyerror_loc_range[1] = yylloc;
1744                 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1745                 *++yystack.p_mark = yyloc;
1746 #endif
1747                 goto yyloop;
1748             }
1749             else
1750             {
1751 #if YYDEBUG
1752                 if (yydebug)
1753                     fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1754                                     YYDEBUGSTR, yydepth, *yystack.s_mark);
1755 #endif
1756                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1757 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1758                 /* the current TOS position is the error start position */
1759                 yyerror_loc_range[0] = *yystack.p_mark;
1760 #endif
1761 #if defined(YYDESTRUCT_CALL)
1762 #if YYBTYACC
1763                 if (!yytrial)
1764 #endif /* YYBTYACC */
1765 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1766                     YYDESTRUCT_CALL("error: discarding state",
1767                                     yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1768 #else
1769                     YYDESTRUCT_CALL("error: discarding state",
1770                                     yystos[*yystack.s_mark], yystack.l_mark);
1771 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1772 #endif /* defined(YYDESTRUCT_CALL) */
1773                 --yystack.s_mark;
1774                 --yystack.l_mark;
1775 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1776                 --yystack.p_mark;
1777 #endif
1778             }
1779         }
1780     }
1781     else
1782     {
1783         if (yychar == YYEOF) goto yyabort;
1784 #if YYDEBUG
1785         if (yydebug)
1786         {
1787             yys = yyname[YYTRANSLATE(yychar)];
1788             fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1789                             YYDEBUGSTR, yydepth, yystate, yychar, yys);
1790         }
1791 #endif
1792 #if defined(YYDESTRUCT_CALL)
1793 #if YYBTYACC
1794         if (!yytrial)
1795 #endif /* YYBTYACC */
1796 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1797             YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1798 #else
1799             YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1800 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1801 #endif /* defined(YYDESTRUCT_CALL) */
1802         yychar = YYEMPTY;
1803         goto yyloop;
1804     }
1805
1806 yyreduce:
1807     yym = yylen[yyn];
1808 #if YYDEBUG
1809     if (yydebug)
1810     {
1811         fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1812                         YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1813 #ifdef YYSTYPE_TOSTRING
1814 #if YYBTYACC
1815         if (!yytrial)
1816 #endif /* YYBTYACC */
1817             if (yym > 0)
1818             {
1819                 int i;
1820                 fputc('<', stderr);
1821                 for (i = yym; i > 0; i--)
1822                 {
1823                     if (i != yym) fputs(", ", stderr);
1824                     fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1825                                            yystack.l_mark[1-i]), stderr);
1826                 }
1827                 fputc('>', stderr);
1828             }
1829 #endif
1830         fputc('\n', stderr);
1831     }
1832 #endif
1833     if (yym > 0)
1834         yyval = yystack.l_mark[1-yym];
1835     else
1836         memset(&yyval, 0, sizeof yyval);
1837 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1838
1839     /* Perform position reduction */
1840     memset(&yyloc, 0, sizeof(yyloc));
1841 #if YYBTYACC
1842     if (!yytrial)
1843 #endif /* YYBTYACC */
1844     {
1845         YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1846         /* just in case YYERROR is invoked within the action, save
1847            the start of the rhs as the error start position */
1848         yyerror_loc_range[0] = yystack.p_mark[1-yym];
1849     }
1850 #endif
1851
1852     switch (yyn)
1853     {
1854 case 1:
1855 #line 93 "btyacc_demo.y"
1856 { yyval.scope = yystack.l_mark[0].scope; }
1857 break;
1858 case 2:
1859 #line 94 "btyacc_demo.y"
1860 { yyval.scope = global_scope; }
1861 break;
1862 case 3:
1863 #line 95 "btyacc_demo.y"
1864 { Decl *d = lookup(yystack.l_mark[-2].scope, yystack.l_mark[-1].id);
1865                           if (!d || !d->scope) YYERROR;
1866                           yyval.scope = d->scope; }
1867 break;
1868 case 4:
1869 #line 101 "btyacc_demo.y"
1870 { Decl *d = lookup(yystack.l_mark[-1].scope, yystack.l_mark[0].id);
1871         if (d == NULL || d->istype() == 0) YYERROR;
1872         yyval.type = d->type; }
1873 break;
1874 case 5:
1875 #line 106 "btyacc_demo.y"
1876 yyval.scope = global_scope = new_scope(0);
1877 break;
1878 case 8:
1879 #line 107 "btyacc_demo.y"
1880 yyval.scope = yystack.l_mark[-1].scope;
1881 break;
1882 case 10:
1883 #line 109 "btyacc_demo.y"
1884 yyval.type = yystack.l_mark[-1].type;
1885 break;
1886 case 11:
1887 #line 109 "btyacc_demo.y"
1888 {YYVALID;}
1889 break;
1890 case 12:
1891 #line 110 "btyacc_demo.y"
1892 yyval.scope = start_fn_def(yystack.l_mark[-4].scope, yystack.l_mark[0].decl);
1893 break;
1894 case 13:
1895   if (!yytrial)
1896 #line 111 "btyacc_demo.y"
1897         { /* demonstrate use of @$ & @N, although this is just the
1898            default computation and so is not necessary */
1899         yyloc.first_line   = yystack.p_mark[-5].first_line;
1900         yyloc.first_column = yystack.p_mark[-5].first_column;
1901         yyloc.last_line    = yystack.p_mark[0].last_line;
1902         yyloc.last_column  = yystack.p_mark[0].last_column;
1903         finish_fn_def(yystack.l_mark[-2].decl, yystack.l_mark[0].code); }
1904 break;
1905 case 14:
1906 #line 121 "btyacc_demo.y"
1907 { yyval.type = yystack.l_mark[0].type; }
1908 break;
1909 case 15:
1910 #line 122 "btyacc_demo.y"
1911 { yyval.type = type_combine(yystack.l_mark[-2].type, yystack.l_mark[0].type); }
1912 break;
1913 case 16:
1914 #line 125 "btyacc_demo.y"
1915 { yyval.type = 0; }
1916 break;
1917 case 17:
1918 #line 126 "btyacc_demo.y"
1919 { yyval.type = type_combine(yystack.l_mark[-1].type, yystack.l_mark[0].type); }
1920 break;
1921 case 18:
1922 #line 130 "btyacc_demo.y"
1923 { yyval.type = yystack.l_mark[0].type; }
1924 break;
1925 case 19:
1926 #line 131 "btyacc_demo.y"
1927 { yyval.type = yystack.l_mark[0].type; }
1928 break;
1929 case 20:
1930 #line 132 "btyacc_demo.y"
1931 { yyval.type = bare_extern(); }
1932 break;
1933 case 21:
1934 #line 133 "btyacc_demo.y"
1935 { yyval.type = bare_register(); }
1936 break;
1937 case 22:
1938 #line 134 "btyacc_demo.y"
1939 { yyval.type = bare_static(); }
1940 break;
1941 case 23:
1942 #line 138 "btyacc_demo.y"
1943 { yyval.type = bare_const(); }
1944 break;
1945 case 24:
1946 #line 139 "btyacc_demo.y"
1947 { yyval.type = bare_volatile(); }
1948 break;
1949 case 25:
1950 #line 143 "btyacc_demo.y"
1951 yyval.scope = yystack.l_mark[-3].scope;
1952 break;
1953 case 26:
1954 #line 143 "btyacc_demo.y"
1955 yyval.type =  yystack.l_mark[-3].type;
1956 break;
1957 case 29:
1958 #line 148 "btyacc_demo.y"
1959 { if (!yystack.l_mark[0].type) YYERROR; }  if (!yytrial)
1960 #line 149 "btyacc_demo.y"
1961 { yyval.decl = declare(yystack.l_mark[-1].scope, 0, yystack.l_mark[0].type); }
1962 break;
1963 case 30:
1964   if (!yytrial)
1965 #line 150 "btyacc_demo.y"
1966         { yyval.decl = declare(yystack.l_mark[-2].scope, yystack.l_mark[0].id, yystack.l_mark[-1].type); }
1967 break;
1968 case 31:
1969 #line 151 "btyacc_demo.y"
1970 yyval.scope = yystack.l_mark[-2].scope;
1971 break;
1972 case 32:
1973 #line 151 "btyacc_demo.y"
1974 yyval.type =  yystack.l_mark[-2].type;
1975 break;
1976 case 33:
1977   if (!yytrial)
1978 #line 151 "btyacc_demo.y"
1979         { yyval.decl = yystack.l_mark[-1].decl; }
1980 break;
1981 case 34:
1982   if (!yytrial)
1983 #line 153 "btyacc_demo.y"
1984         { yyval.decl = make_pointer(yystack.l_mark[0].decl, yystack.l_mark[-3].type); }
1985 break;
1986 case 35:
1987   if (!yytrial)
1988 #line 155 "btyacc_demo.y"
1989         { yyval.decl = make_array(yystack.l_mark[-4].decl->type, yystack.l_mark[-1].expr); }
1990 break;
1991 case 36:
1992   if (!yytrial)
1993 #line 157 "btyacc_demo.y"
1994         { yyval.decl = build_function(yystack.l_mark[-5].decl, yystack.l_mark[-2].dlist, yystack.l_mark[0].type); }
1995 break;
1996 case 37:
1997   if (!yytrial)
1998 #line 160 "btyacc_demo.y"
1999         { yyval.dlist = 0; }
2000 break;
2001 case 38:
2002   if (!yytrial)
2003 #line 161 "btyacc_demo.y"
2004         { yyval.dlist = yystack.l_mark[0].dlist; }
2005 break;
2006 case 39:
2007   if (!yytrial)
2008 #line 164 "btyacc_demo.y"
2009         { yyval.dlist = append_dlist(yystack.l_mark[-3].dlist, yystack.l_mark[0].decl); }
2010 break;
2011 case 40:
2012   if (!yytrial)
2013 #line 165 "btyacc_demo.y"
2014         { yyval.dlist = build_dlist(yystack.l_mark[0].decl); }
2015 break;
2016 case 41:
2017   if (!yytrial)
2018 #line 168 "btyacc_demo.y"
2019         { yyval.decl = yystack.l_mark[0].decl; }
2020 break;
2021 case 42:
2022   if (!yytrial)
2023 #line 172 "btyacc_demo.y"
2024         { yyval.expr = build_expr(yystack.l_mark[-3].expr, ADD, yystack.l_mark[0].expr); }
2025 break;
2026 case 43:
2027   if (!yytrial)
2028 #line 173 "btyacc_demo.y"
2029         { yyval.expr = build_expr(yystack.l_mark[-3].expr, SUB, yystack.l_mark[0].expr); }
2030 break;
2031 case 44:
2032   if (!yytrial)
2033 #line 174 "btyacc_demo.y"
2034         { yyval.expr = build_expr(yystack.l_mark[-3].expr, MUL, yystack.l_mark[0].expr); }
2035 break;
2036 case 45:
2037   if (!yytrial)
2038 #line 175 "btyacc_demo.y"
2039         { yyval.expr = build_expr(yystack.l_mark[-3].expr, MOD, yystack.l_mark[0].expr); }
2040 break;
2041 case 46:
2042   if (!yytrial)
2043 #line 176 "btyacc_demo.y"
2044         { yyval.expr = build_expr(yystack.l_mark[-3].expr, DIV, yystack.l_mark[0].expr); }
2045 break;
2046 case 47:
2047   if (!yytrial)
2048 #line 177 "btyacc_demo.y"
2049         { yyval.expr = build_expr(0, DEREF, yystack.l_mark[0].expr); }
2050 break;
2051 case 48:
2052   if (!yytrial)
2053 #line 178 "btyacc_demo.y"
2054         { yyval.expr = var_expr(yystack.l_mark[-1].scope, yystack.l_mark[0].id); }
2055 break;
2056 case 49:
2057   if (!yytrial)
2058 #line 179 "btyacc_demo.y"
2059         { yyval.expr = yystack.l_mark[0].expr; }
2060 break;
2061 case 50:
2062   if (!yytrial)
2063 #line 183 "btyacc_demo.y"
2064         { yyval.code = 0; }
2065 break;
2066 case 51:
2067 #line 184 "btyacc_demo.y"
2068 yyval.scope = yystack.l_mark[0].scope;
2069 break;
2070 case 52:
2071 #line 184 "btyacc_demo.y"
2072 {YYVALID;}  if (!yytrial)
2073 #line 184 "btyacc_demo.y"
2074 { yyval.code = build_expr_code(yystack.l_mark[-1].expr); }
2075 break;
2076 case 53:
2077 #line 185 "btyacc_demo.y"
2078 yyval.scope = yystack.l_mark[-6].scope;
2079 break;
2080 case 54:
2081 #line 185 "btyacc_demo.y"
2082 yyval.scope = yystack.l_mark[-9].scope;
2083 break;
2084 case 55:
2085 #line 185 "btyacc_demo.y"
2086 {YYVALID;}  if (!yytrial)
2087 #line 186 "btyacc_demo.y"
2088 { yyval.code = build_if(yystack.l_mark[-7].expr, yystack.l_mark[-3].code, yystack.l_mark[0].code); }
2089 break;
2090 case 56:
2091 #line 187 "btyacc_demo.y"
2092 {YYVALID;}  if (!yytrial)
2093 #line 188 "btyacc_demo.y"
2094 { yyval.code = build_if(yystack.l_mark[-4].expr, yystack.l_mark[0].code, 0); }
2095 break;
2096 case 57:
2097 #line 189 "btyacc_demo.y"
2098 yyval.scope = new_scope(yystack.l_mark[0].scope);
2099 break;
2100 case 58:
2101 #line 189 "btyacc_demo.y"
2102 {YYVALID;}  if (!yytrial)
2103 #line 189 "btyacc_demo.y"
2104 { yyval.code = yystack.l_mark[0].code; }
2105 break;
2106 case 59:
2107   if (!yytrial)
2108 #line 192 "btyacc_demo.y"
2109         { yyval.code = 0; }
2110 break;
2111 case 60:
2112   if (!yytrial)
2113 #line 193 "btyacc_demo.y"
2114         { yyval.code = code_append(yystack.l_mark[-2].code, yystack.l_mark[0].code); }
2115 break;
2116 case 61:
2117   if (!yytrial)
2118 #line 197 "btyacc_demo.y"
2119         { yyval.code = yystack.l_mark[-1].code; }
2120 break;
2121 #line 2122 "btyacc_demo.tab.c"
2122     default:
2123         break;
2124     }
2125     yystack.s_mark -= yym;
2126     yystate = *yystack.s_mark;
2127     yystack.l_mark -= yym;
2128 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2129     yystack.p_mark -= yym;
2130 #endif
2131     yym = yylhs[yyn];
2132     if (yystate == 0 && yym == 0)
2133     {
2134 #if YYDEBUG
2135         if (yydebug)
2136         {
2137             fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
2138 #ifdef YYSTYPE_TOSTRING
2139 #if YYBTYACC
2140             if (!yytrial)
2141 #endif /* YYBTYACC */
2142                 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
2143 #endif
2144             fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
2145         }
2146 #endif
2147         yystate = YYFINAL;
2148         *++yystack.s_mark = YYFINAL;
2149         *++yystack.l_mark = yyval;
2150 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2151         *++yystack.p_mark = yyloc;
2152 #endif
2153         if (yychar < 0)
2154         {
2155 #if YYBTYACC
2156             do {
2157             if (yylvp < yylve)
2158             {
2159                 /* we're currently re-reading tokens */
2160                 yylval = *yylvp++;
2161 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2162                 yylloc = *yylpp++;
2163 #endif
2164                 yychar = *yylexp++;
2165                 break;
2166             }
2167             if (yyps->save)
2168             {
2169                 /* in trial mode; save scanner results for future parse attempts */
2170                 if (yylvp == yylvlim)
2171                 {   /* Enlarge lexical value queue */
2172                     size_t p = (size_t) (yylvp - yylvals);
2173                     size_t s = (size_t) (yylvlim - yylvals);
2174
2175                     s += YYLVQUEUEGROWTH;
2176                     if ((yylexemes = (short *)   realloc(yylexemes, s * sizeof(short))) == NULL)
2177                         goto yyenomem;
2178                     if ((yylvals   = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
2179                         goto yyenomem;
2180 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2181                     if ((yylpsns   = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
2182                         goto yyenomem;
2183 #endif
2184                     yylvp   = yylve = yylvals + p;
2185                     yylvlim = yylvals + s;
2186 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2187                     yylpp   = yylpe = yylpsns + p;
2188                     yylplim = yylpsns + s;
2189 #endif
2190                     yylexp  = yylexemes + p;
2191                 }
2192                 *yylexp = (short) YYLEX;
2193                 *yylvp++ = yylval;
2194                 yylve++;
2195 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2196                 *yylpp++ = yylloc;
2197                 yylpe++;
2198 #endif
2199                 yychar = *yylexp++;
2200                 break;
2201             }
2202             /* normal operation, no conflict encountered */
2203 #endif /* YYBTYACC */
2204             yychar = YYLEX;
2205 #if YYBTYACC
2206             } while (0);
2207 #endif /* YYBTYACC */
2208             if (yychar < 0) yychar = YYEOF;
2209             /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
2210 #if YYDEBUG
2211             if (yydebug)
2212             {
2213                 yys = yyname[YYTRANSLATE(yychar)];
2214                 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
2215                                 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
2216             }
2217 #endif
2218         }
2219         if (yychar == YYEOF) goto yyaccept;
2220         goto yyloop;
2221     }
2222     if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
2223             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
2224         yystate = yytable[yyn];
2225     else
2226         yystate = yydgoto[yym];
2227 #if YYDEBUG
2228     if (yydebug)
2229     {
2230         fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
2231 #ifdef YYSTYPE_TOSTRING
2232 #if YYBTYACC
2233         if (!yytrial)
2234 #endif /* YYBTYACC */
2235             fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
2236 #endif
2237         fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
2238     }
2239 #endif
2240     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
2241     *++yystack.s_mark = (short) yystate;
2242     *++yystack.l_mark = yyval;
2243 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2244     *++yystack.p_mark = yyloc;
2245 #endif
2246     goto yyloop;
2247 #if YYBTYACC
2248
2249     /* Reduction declares that this path is valid. Set yypath and do a full parse */
2250 yyvalid:
2251     if (yypath) YYABORT;
2252     while (yyps->save)
2253     {
2254         YYParseState *save = yyps->save;
2255         yyps->save = save->save;
2256         save->save = yypath;
2257         yypath = save;
2258     }
2259 #if YYDEBUG
2260     if (yydebug)
2261         fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
2262                         YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
2263 #endif
2264     if (yyerrctx)
2265     {
2266         yyFreeState(yyerrctx);
2267         yyerrctx = NULL;
2268     }
2269     yylvp          = yylvals + yypath->lexeme;
2270 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2271     yylpp          = yylpsns + yypath->lexeme;
2272 #endif
2273     yylexp         = yylexemes + yypath->lexeme;
2274     yychar         = YYEMPTY;
2275     yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
2276     memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
2277     yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
2278     memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
2279 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2280     yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
2281     memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
2282 #endif
2283     yystate        = yypath->state;
2284     goto yyloop;
2285 #endif /* YYBTYACC */
2286
2287 yyoverflow:
2288     YYERROR_CALL("yacc stack overflow");
2289 #if YYBTYACC
2290     goto yyabort_nomem;
2291 yyenomem:
2292     YYERROR_CALL("memory exhausted");
2293 yyabort_nomem:
2294 #endif /* YYBTYACC */
2295     yyresult = 2;
2296     goto yyreturn;
2297
2298 yyabort:
2299     yyresult = 1;
2300     goto yyreturn;
2301
2302 yyaccept:
2303 #if YYBTYACC
2304     if (yyps->save) goto yyvalid;
2305 #endif /* YYBTYACC */
2306     yyresult = 0;
2307
2308 yyreturn:
2309 #if defined(YYDESTRUCT_CALL)
2310     if (yychar != YYEOF && yychar != YYEMPTY)
2311 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2312         YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
2313 #else
2314         YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
2315 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
2316
2317     {
2318         YYSTYPE *pv;
2319 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2320         YYLTYPE *pp;
2321
2322         for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
2323              YYDESTRUCT_CALL("cleanup: discarding state",
2324                              yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
2325 #else
2326         for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
2327              YYDESTRUCT_CALL("cleanup: discarding state",
2328                              yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
2329 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
2330     }
2331 #endif /* defined(YYDESTRUCT_CALL) */
2332
2333 #if YYBTYACC
2334     if (yyerrctx)
2335     {
2336         yyFreeState(yyerrctx);
2337         yyerrctx = NULL;
2338     }
2339     while (yyps)
2340     {
2341         YYParseState *save = yyps;
2342         yyps = save->save;
2343         save->save = NULL;
2344         yyFreeState(save);
2345     }
2346     while (yypath)
2347     {
2348         YYParseState *save = yypath;
2349         yypath = save->save;
2350         save->save = NULL;
2351         yyFreeState(save);
2352     }
2353 #endif /* YYBTYACC */
2354     yyfreestack(&yystack);
2355     return (yyresult);
2356 }