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