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