1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
8 #define YYCHECK "yyyymmdd"
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
18 #define YYDEBUGSTR (yytrial ? YYPREFIX "debug(trial)" : YYPREFIX "debug")
21 #define yyparse demo_parse
25 #define yylex demo_lex
29 #define yyerror demo_error
33 #define yychar demo_char
37 #define yyval demo_val
41 #define yylval demo_lval
45 #define yydebug demo_debug
49 #define yynerrs demo_nerrs
53 #define yyerrflag demo_errflag
54 #endif /* yyerrflag */
57 #define yylhs demo_lhs
61 #define yylen demo_len
65 #define yydefred demo_defred
69 #define yystos demo_stos
73 #define yydgoto demo_dgoto
77 #define yysindex demo_sindex
81 #define yyrindex demo_rindex
85 #define yygindex demo_gindex
89 #define yytable demo_table
93 #define yycheck demo_check
97 #define yyname demo_name
101 #define yyrule demo_rule
105 #define yyloc demo_loc
109 #define yylloc demo_lloc
115 #define yycindex demo_cindex
116 #endif /* yycindex */
119 #define yyctable demo_ctable
120 #endif /* yyctable */
122 #endif /* YYBTYACC */
124 #define YYPREFIX "demo_"
128 #line 15 "btyacc_demo.y"
129 /* dummy types just for compile check */
131 typedef int Decl_List;
133 typedef int Expr_List;
136 enum Operator { ADD, SUB, MUL, MOD, DIV, DEREF };
138 typedef unsigned char bool;
139 typedef struct Decl {
142 bool (*istype)(void);
145 #include "btyacc_demo.tab.h"
148 #line 36 "btyacc_demo.y"
150 #undef YYSTYPE_IS_DECLARED
151 #define YYSTYPE_IS_DECLARED 1
153 #ifndef YYSTYPE_IS_DECLARED
154 #define YYSTYPE_IS_DECLARED 1
165 #endif /* !YYSTYPE_IS_DECLARED */
166 #line 167 "btyacc_demo.tab.c"
168 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
169 /* Default: YYLTYPE is the text position type. */
170 typedef struct YYLTYPE
177 #define YYLTYPE_IS_DECLARED 1
180 /* compatibility with bison */
182 /* compatibility with FreeBSD */
183 # ifdef YYPARSE_PARAM_TYPE
184 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
186 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
189 # define YYPARSE_DECL() yyparse(void)
192 /* Parameters sent to lex. */
194 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
195 # define YYLEX yylex(YYLEX_PARAM)
197 # define YYLEX_DECL() yylex(void)
198 # define YYLEX yylex()
201 /* Parameters sent to yyerror. */
203 #define YYERROR_DECL() yyerror(YYLTYPE loc, const char *s)
206 #define YYERROR_CALL(msg) yyerror(yylloc, msg)
209 #ifndef YYDESTRUCT_DECL
210 #define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, YYLTYPE *loc)
212 #ifndef YYDESTRUCT_CALL
213 #define YYDESTRUCT_CALL(msg, psymb, val, loc) yydestruct(msg, psymb, val, loc)
216 extern int YYPARSE_DECL();
231 #define YYERRCODE 256
233 static const YYINT demo_lhs[] = { -1,
234 15, 15, 15, 12, 18, 0, 4, 19, 4, 20,
235 2, 21, 2, 10, 10, 13, 13, 11, 11, 11,
236 11, 11, 14, 14, 22, 23, 3, 3, 8, 8,
237 24, 25, 8, 8, 8, 8, 16, 16, 17, 17,
238 9, 1, 1, 1, 1, 1, 1, 1, 1, 5,
239 26, 5, 27, 28, 5, 5, 29, 5, 6, 6,
242 static const YYINT demo_len[] = { 2,
243 0, 1, 3, 2, 0, 2, 0, 0, 3, 0,
244 5, 0, 6, 1, 3, 0, 2, 1, 1, 1,
245 1, 1, 1, 1, 0, 0, 5, 1, 0, 1,
246 0, 0, 5, 5, 5, 6, 0, 1, 4, 1,
247 4, 4, 4, 4, 4, 4, 3, 1, 1, 1,
248 0, 3, 0, 0, 11, 8, 0, 2, 0, 3,
251 static const YYINT demo_defred[] = { 5,
252 0, 7, 0, 0, 20, 21, 22, 23, 24, 2,
253 9, 8, 14, 19, 18, 0, 0, 0, 15, 0,
254 3, 16, 31, 30, 0, 0, 0, 32, 11, 25,
255 25, 25, 0, 17, 26, 0, 26, 0, 0, 8,
256 13, 0, 0, 0, 40, 8, 0, 0, 8, 48,
257 49, 0, 59, 0, 33, 0, 0, 16, 31, 0,
258 31, 31, 31, 31, 31, 35, 0, 0, 0, 0,
259 47, 0, 0, 0, 0, 0, 61, 0, 0, 39,
260 0, 0, 44, 46, 45, 0, 50, 60, 0, 0,
261 31, 0, 58, 0, 52, 0, 0, 53, 0, 0,
264 static const YYINT demo_stos[] = { 0,
265 271, 289, 275, 290, 261, 262, 263, 264, 265, 269,
266 273, 281, 282, 283, 285, 286, 290, 259, 282, 291,
267 269, 42, 40, 259, 274, 279, 284, 295, 59, 44,
268 40, 91, 292, 285, 293, 296, 293, 293, 293, 123,
269 278, 294, 279, 294, 280, 281, 287, 288, 42, 259,
270 260, 272, 290, 279, 41, 279, 290, 41, 44, 290,
271 43, 45, 42, 47, 37, 93, 277, 291, 284, 295,
272 272, 295, 295, 295, 295, 295, 125, 290, 279, 280,
273 272, 272, 272, 272, 272, 266, 273, 276, 297, 300,
274 40, 272, 278, 295, 59, 272, 41, 267, 298, 276,
277 static const YYINT demo_dgoto[] = { 1,
278 52, 87, 25, 3, 88, 67, 41, 26, 45, 12,
279 13, 14, 27, 15, 16, 47, 48, 2, 4, 20,
280 33, 35, 42, 28, 36, 89, 99, 102, 90,
282 static const YYINT demo_sindex[] = { 0,
283 0, 0, 0, -124, 0, 0, 0, 0, 0, 0,
284 0, 0, 0, 0, 0, -256, -124, 0, 0, -33,
285 0, 0, 0, 0, 34, -4, -205, 0, 0, 0,
286 0, 0, -110, 0, 0, -33, 0, -124, -15, 0,
287 0, -33, -36, -33, 0, 0, 4, 7, 0, 0,
288 0, 5, 0, -4, 0, -4, -124, 0, 0, -15,
289 0, 0, 0, 0, 0, 0, -46, -33, -205, -124,
290 0, -15, -15, -15, -15, -15, 0, -91, -4, 0,
291 122, 122, 0, 0, 0, 40, 0, 0, -15, -110,
292 0, 106, 0, -15, 0, 113, -183, 0, -91, 0,
295 static const YYINT demo_rindex[] = { 0,
296 0, 0, 1, -157, 0, 0, 0, 0, 0, 0,
297 0, 0, 0, 0, 0, 0, -28, -22, 0, -29,
298 0, 0, 0, 0, 0, -27, -34, 0, 0, 0,
299 0, 0, 0, 0, 0, 8, 0, -12, 0, 0,
300 0, -20, 0, 32, 0, 0, 0, 69, 0, 0,
301 0, 0, 0, -18, 0, 56, 33, 0, 0, 0,
302 0, 0, 0, 0, 0, 0, -31, -1, -6, -157,
303 0, 0, 0, 0, 0, 0, 0, -14, 63, 0,
304 13, 23, 0, 0, 0, 0, 0, 0, 0, 0,
305 0, 0, 0, 0, 0, 0, 0, 0, -14, -42,
309 static const YYINT demo_cindex[] = { 0,
310 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
311 0, 0, 0, 0, 0, 0, -145, -150, 0, 81,
312 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
313 0, 0, 0, 0, 0, 82, 0, 0, 0, 0,
314 0, 91, 0, 112, 0, 0, 0, 0, 0, 0,
315 0, 0, 0, 0, 0, 0, -113, 0, 0, 0,
316 0, 0, 0, 0, 0, 0, 0, 117, 0, 0,
317 0, 0, 0, 0, 0, 0, 0, -98, 0, 0,
318 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
319 0, 0, 0, 0, 0, 0, 0, 0, -96, -92,
323 static const YYINT demo_gindex[] = { 0,
324 53, 175, 0, 0, 9, 0, 90, 76, 111, 27,
325 29, 0, 124, -25, 0, 0, 0, 0, 21, 126,
326 0, 136, 147, 71, 0, 0, 0, 0, 0,
328 #define YYTABLESIZE 270
329 static const YYINT demo_table[] = { 56,
330 6, 34, 18, 31, 55, 25, 25, 25, 22, 25,
331 8, 10, 40, 10, 29, 10, 28, 4, 4, 4,
332 29, 4, 34, 29, 25, 34, 49, 51, 37, 29,
333 10, 28, 17, 36, 36, 31, 4, 36, 29, 29,
334 34, 65, 29, 34, 58, 19, 63, 61, 29, 62,
335 59, 64, 36, 42, 32, 42, 25, 42, 8, 9,
336 53, 29, 10, 43, 46, 43, 57, 43, 4, 60,
337 29, 42, 10, 10, 10, 29, 10, 30, 77, 91,
338 56, 43, 56, 98, 36, 19, 32, 78, 25, 29,
339 29, 8, 29, 29, 10, 12, 46, 66, 29, 27,
340 4, 1, 29, 41, 34, 42, 41, 100, 57, 38,
341 103, 43, 71, 0, 27, 43, 36, 54, 4, 56,
342 7, 7, 29, 10, 81, 82, 83, 84, 85, 70,
343 7, 72, 73, 74, 75, 76, 5, 6, 7, 8,
344 9, 92, 65, 79, 10, 0, 96, 63, 61, 65,
345 62, 7, 64, 97, 63, 61, 7, 62, 65, 64,
346 9, 94, 9, 63, 95, 37, 38, 39, 64, 5,
347 6, 7, 8, 9, 86, 13, 9, 10, 11, 93,
348 80, 69, 68, 44, 0, 0, 0, 0, 0, 0,
349 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
350 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
351 0, 0, 0, 0, 0, 0, 56, 56, 56, 56,
352 56, 56, 56, 56, 25, 24, 56, 8, 8, 8,
353 8, 8, 8, 8, 8, 0, 4, 8, 4, 4,
354 4, 4, 4, 50, 51, 51, 1, 0, 0, 0,
355 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,
356 0, 8, 8, 8, 8, 8, 0, 0, 0, 8,
358 static const YYINT demo_check[] = { 42,
359 0, 27, 259, 40, 41, 40, 41, 42, 42, 44,
360 42, 40, 123, 42, 44, 44, 44, 40, 41, 42,
361 41, 44, 41, 44, 59, 44, 42, 42, 41, 59,
362 59, 59, 12, 40, 41, 40, 59, 44, 59, 41,
363 59, 37, 44, 69, 41, 17, 42, 43, 41, 45,
364 44, 47, 59, 41, 91, 43, 91, 45, 264, 265,
365 40, 91, 91, 41, 38, 43, 46, 45, 91, 49,
366 91, 59, 40, 41, 42, 44, 44, 44, 125, 40,
367 123, 59, 125, 267, 91, 57, 91, 67, 123, 91,
368 59, 123, 59, 123, 123, 123, 70, 93, 91, 44,
369 123, 259, 123, 41, 123, 93, 44, 99, 123, 41,
370 102, 36, 60, 259, 59, 93, 123, 42, 269, 44,
371 40, 40, 91, 91, 72, 73, 74, 75, 76, 59,
372 40, 61, 62, 63, 64, 65, 261, 262, 263, 264,
373 265, 89, 37, 68, 269, 259, 94, 42, 43, 37,
374 45, 40, 47, 41, 42, 43, 40, 45, 37, 47,
375 259, 91, 259, 42, 59, 30, 31, 32, 47, 261,
376 262, 263, 264, 265, 266, 268, 259, 269, 4, 90,
377 70, 58, 57, 37, -1, -1, -1, -1, -1, -1,
378 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
379 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
380 -1, -1, -1, -1, -1, -1, 259, 260, 261, 262,
381 263, 264, 265, 266, 259, 259, 269, 259, 260, 261,
382 262, 263, 264, 265, 266, -1, 259, 269, 261, 262,
383 263, 264, 265, 259, 260, 260, 259, -1, -1, -1,
384 -1, -1, -1, -1, -1, -1, -1, -1, -1, 259,
385 -1, 261, 262, 263, 264, 265, -1, -1, -1, 269,
388 static const YYINT demo_ctable[] = { -1,
389 1, 10, -1, 21, 4, -1, 23, 29, -1, 1,
397 #define YYMAXTOKEN 269
398 #define YYUNDFTOKEN 301
399 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
401 static const char *const demo_name[] = {
403 "$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,
404 "'%'",0,0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,0,0,0,0,0,0,0,0,0,
405 "';'",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,
406 "']'",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,
407 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,
408 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,
409 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,
410 0,0,0,0,0,0,0,0,0,"error","PREFIX","POSTFIX","ID","CONSTANT","EXTERN",
411 "REGISTER","STATIC","CONST","VOLATILE","IF","THEN","ELSE","CLCL","$accept",
412 "input","expr","decl","declarator_list","decl_list","statement",
413 "statement_list","block_statement","declarator","formal_arg","decl_specs",
414 "decl_spec","typename","cv_quals","cv_qual","opt_scope","formal_arg_list",
415 "nonempty_formal_arg_list","$$1","$$2","$$3","$$4","$$5","$$6","$$7","$$8",
416 "$$9","$$10","$$11","$$12","illegal-symbol",
418 static const char *const demo_rule[] = {
422 "opt_scope : opt_scope ID CLCL",
423 "typename : opt_scope ID",
425 "input : $$1 decl_list",
428 "decl_list : decl_list $$2 decl",
430 "decl : decl_specs $$2 $$3 declarator_list ';'",
432 "decl : decl_specs $$2 $$3 declarator $$4 block_statement",
433 "decl_specs : decl_spec",
434 "decl_specs : decl_specs $$2 decl_spec",
436 "cv_quals : cv_quals cv_qual",
437 "decl_spec : cv_qual",
438 "decl_spec : typename",
439 "decl_spec : EXTERN",
440 "decl_spec : REGISTER",
441 "decl_spec : STATIC",
443 "cv_qual : VOLATILE",
446 "declarator_list : declarator_list ',' $$5 $$6 declarator",
447 "declarator_list : declarator",
452 "declarator : '(' $$7 $$8 declarator ')'",
453 "declarator : '*' cv_quals $$5 $$6 declarator",
454 "declarator : declarator '[' $$5 expr ']'",
455 "declarator : declarator '(' $$5 formal_arg_list ')' cv_quals",
457 "formal_arg_list : nonempty_formal_arg_list",
458 "nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$7 formal_arg",
459 "nonempty_formal_arg_list : formal_arg",
460 "formal_arg : decl_specs $$2 $$3 declarator",
461 "expr : expr '+' $$7 expr",
462 "expr : expr '-' $$7 expr",
463 "expr : expr '*' $$7 expr",
464 "expr : expr '%' $$7 expr",
465 "expr : expr '/' $$7 expr",
466 "expr : '*' $$2 expr",
471 "statement : $$9 expr ';'",
474 "statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE $$11 statement",
475 "statement : IF '(' $$7 expr ')' THEN $$10 statement",
477 "statement : $$12 block_statement",
479 "statement_list : statement_list $$2 statement",
480 "block_statement : '{' $$2 statement_list '}'",
492 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
493 YYLTYPE yyloc; /* position returned by actions */
494 YYLTYPE yylloc; /* position from the lexer */
497 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
498 #ifndef YYLLOC_DEFAULT
499 #define YYLLOC_DEFAULT(loc, rhs, n) \
504 (loc).first_line = ((rhs)[-1]).last_line; \
505 (loc).first_column = ((rhs)[-1]).last_column; \
506 (loc).last_line = ((rhs)[-1]).last_line; \
507 (loc).last_column = ((rhs)[-1]).last_column; \
511 (loc).first_line = ((rhs)[ 0 ]).first_line; \
512 (loc).first_column = ((rhs)[ 0 ]).first_column; \
513 (loc).last_line = ((rhs)[n-1]).last_line; \
514 (loc).last_column = ((rhs)[n-1]).last_column; \
517 #endif /* YYLLOC_DEFAULT */
518 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
521 #ifndef YYLVQUEUEGROWTH
522 #define YYLVQUEUEGROWTH 32
524 #endif /* YYBTYACC */
526 /* define the initial stack-sizes */
529 #define YYMAXDEPTH YYSTACKSIZE
532 #define YYSTACKSIZE YYMAXDEPTH
534 #define YYSTACKSIZE 10000
535 #define YYMAXDEPTH 10000
539 #ifndef YYINITSTACKSIZE
540 #define YYINITSTACKSIZE 200
550 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
557 struct YYParseState_s
559 struct YYParseState_s *save; /* Previously saved parser state */
560 YYSTACKDATA yystack; /* saved parser stack */
561 int state; /* saved parser state */
562 int errflag; /* saved error recovery status */
563 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
564 YYINT ctry; /* saved index in yyctable[] for this conflict */
566 typedef struct YYParseState_s YYParseState;
567 #endif /* YYBTYACC */
568 /* variables for the parser stack */
569 static YYSTACKDATA yystack;
572 /* Current parser state */
573 static YYParseState *yyps = 0;
575 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
576 static YYParseState *yypath = 0;
578 /* Base of the lexical value queue */
579 static YYSTYPE *yylvals = 0;
581 /* Current position at lexical value queue */
582 static YYSTYPE *yylvp = 0;
584 /* End position of lexical value queue */
585 static YYSTYPE *yylve = 0;
587 /* The last allocated position at the lexical value queue */
588 static YYSTYPE *yylvlim = 0;
590 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
591 /* Base of the lexical position queue */
592 static YYLTYPE *yylpsns = 0;
594 /* Current position at lexical position queue */
595 static YYLTYPE *yylpp = 0;
597 /* End position of lexical position queue */
598 static YYLTYPE *yylpe = 0;
600 /* The last allocated position at the lexical position queue */
601 static YYLTYPE *yylplim = 0;
604 /* Current position at lexical token queue */
605 static short *yylexp = 0;
607 static short *yylexemes = 0;
608 #endif /* YYBTYACC */
609 #line 200 "btyacc_demo.y"
611 extern int YYLEX_DECL();
612 extern void YYERROR_DECL();
614 extern Scope *global_scope;
616 extern Decl * lookup(Scope *scope, char *id);
617 extern Scope * new_scope(Scope *outer_scope);
618 extern Scope * start_fn_def(Scope *scope, Decl *fn_decl);
619 extern void finish_fn_def(Decl *fn_decl, Code *block);
620 extern Type * type_combine(Type *specs, Type *spec);
621 extern Type * bare_extern(void);
622 extern Type * bare_register(void);
623 extern Type * bare_static(void);
624 extern Type * bare_const(void);
625 extern Type * bare_volatile(void);
626 extern Decl * declare(Scope *scope, char *id, Type *type);
627 extern Decl * make_pointer(Decl *decl, Type *type);
628 extern Decl * make_array(Type *type, Expr *expr);
629 extern Decl * build_function(Decl *decl, Decl_List *dlist, Type *type);
630 extern Decl_List * append_dlist(Decl_List *dlist, Decl *decl);
631 extern Decl_List * build_dlist(Decl *decl);
632 extern Expr * build_expr(Expr *left, enum Operator op, Expr *right);
633 extern Expr * var_expr(Scope *scope, char *id);
634 extern Code * build_expr_code(Expr *expr);
635 extern Code * build_if(Expr *cond_expr, Code *then_stmt, Code *else_stmt);
636 extern Code * code_append(Code *stmt_list, Code *stmt);
637 #line 638 "btyacc_demo.tab.c"
639 /* Release memory associated with symbol. */
640 #if ! defined YYDESTRUCT_IS_DECLARED
647 #line 83 "btyacc_demo.y"
648 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
650 (*loc).first_line, (*loc).first_column,
651 (*loc).last_line, (*loc).last_column);
652 /* in this example, we don't know what to do here */ }
654 #line 655 "btyacc_demo.tab.c"
656 #line 83 "btyacc_demo.y"
657 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
659 (*loc).first_line, (*loc).first_column,
660 (*loc).last_line, (*loc).last_column);
661 /* in this example, we don't know what to do here */ }
663 #line 664 "btyacc_demo.tab.c"
665 #line 83 "btyacc_demo.y"
666 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
668 (*loc).first_line, (*loc).first_column,
669 (*loc).last_line, (*loc).last_column);
670 /* in this example, we don't know what to do here */ }
672 #line 673 "btyacc_demo.tab.c"
674 #line 83 "btyacc_demo.y"
675 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
677 (*loc).first_line, (*loc).first_column,
678 (*loc).last_line, (*loc).last_column);
679 /* in this example, we don't know what to do here */ }
681 #line 682 "btyacc_demo.tab.c"
683 #line 83 "btyacc_demo.y"
684 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
686 (*loc).first_line, (*loc).first_column,
687 (*loc).last_line, (*loc).last_column);
688 /* in this example, we don't know what to do here */ }
690 #line 691 "btyacc_demo.tab.c"
692 #line 83 "btyacc_demo.y"
693 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
695 (*loc).first_line, (*loc).first_column,
696 (*loc).last_line, (*loc).last_column);
697 /* in this example, we don't know what to do here */ }
699 #line 700 "btyacc_demo.tab.c"
701 #line 83 "btyacc_demo.y"
702 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
704 (*loc).first_line, (*loc).first_column,
705 (*loc).last_line, (*loc).last_column);
706 /* in this example, we don't know what to do here */ }
708 #line 709 "btyacc_demo.tab.c"
710 #line 83 "btyacc_demo.y"
711 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
713 (*loc).first_line, (*loc).first_column,
714 (*loc).last_line, (*loc).last_column);
715 /* in this example, we don't know what to do here */ }
717 #line 718 "btyacc_demo.tab.c"
719 #line 83 "btyacc_demo.y"
720 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
722 (*loc).first_line, (*loc).first_column,
723 (*loc).last_line, (*loc).last_column);
724 /* in this example, we don't know what to do here */ }
726 #line 727 "btyacc_demo.tab.c"
728 #line 83 "btyacc_demo.y"
729 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
731 (*loc).first_line, (*loc).first_column,
732 (*loc).last_line, (*loc).last_column);
733 /* in this example, we don't know what to do here */ }
735 #line 736 "btyacc_demo.tab.c"
737 #line 78 "btyacc_demo.y"
738 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
740 (*loc).first_line, (*loc).first_column,
741 (*loc).last_line, (*loc).last_column);
744 #line 745 "btyacc_demo.tab.c"
746 #line 78 "btyacc_demo.y"
747 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
749 (*loc).first_line, (*loc).first_column,
750 (*loc).last_line, (*loc).last_column);
753 #line 754 "btyacc_demo.tab.c"
755 #line 83 "btyacc_demo.y"
756 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
758 (*loc).first_line, (*loc).first_column,
759 (*loc).last_line, (*loc).last_column);
760 /* in this example, we don't know what to do here */ }
762 #line 763 "btyacc_demo.tab.c"
764 #line 83 "btyacc_demo.y"
765 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
767 (*loc).first_line, (*loc).first_column,
768 (*loc).last_line, (*loc).last_column);
769 /* in this example, we don't know what to do here */ }
771 #line 772 "btyacc_demo.tab.c"
773 #line 83 "btyacc_demo.y"
774 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
776 (*loc).first_line, (*loc).first_column,
777 (*loc).last_line, (*loc).last_column);
778 /* in this example, we don't know what to do here */ }
780 #line 781 "btyacc_demo.tab.c"
782 #line 83 "btyacc_demo.y"
783 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
785 (*loc).first_line, (*loc).first_column,
786 (*loc).last_line, (*loc).last_column);
787 /* in this example, we don't know what to do here */ }
789 #line 790 "btyacc_demo.tab.c"
791 #line 83 "btyacc_demo.y"
792 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
794 (*loc).first_line, (*loc).first_column,
795 (*loc).last_line, (*loc).last_column);
796 /* in this example, we don't know what to do here */ }
798 #line 799 "btyacc_demo.tab.c"
800 #line 83 "btyacc_demo.y"
801 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
803 (*loc).first_line, (*loc).first_column,
804 (*loc).last_line, (*loc).last_column);
805 /* in this example, we don't know what to do here */ }
807 #line 808 "btyacc_demo.tab.c"
809 #line 83 "btyacc_demo.y"
810 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
812 (*loc).first_line, (*loc).first_column,
813 (*loc).last_line, (*loc).last_column);
814 /* in this example, we don't know what to do here */ }
816 #line 817 "btyacc_demo.tab.c"
818 #line 83 "btyacc_demo.y"
819 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
821 (*loc).first_line, (*loc).first_column,
822 (*loc).last_line, (*loc).last_column);
823 /* in this example, we don't know what to do here */ }
825 #line 826 "btyacc_demo.tab.c"
827 #line 83 "btyacc_demo.y"
828 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
830 (*loc).first_line, (*loc).first_column,
831 (*loc).last_line, (*loc).last_column);
832 /* in this example, we don't know what to do here */ }
834 #line 835 "btyacc_demo.tab.c"
836 #line 83 "btyacc_demo.y"
837 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
839 (*loc).first_line, (*loc).first_column,
840 (*loc).last_line, (*loc).last_column);
841 /* in this example, we don't know what to do here */ }
843 #line 844 "btyacc_demo.tab.c"
845 #line 83 "btyacc_demo.y"
846 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
848 (*loc).first_line, (*loc).first_column,
849 (*loc).last_line, (*loc).last_column);
850 /* in this example, we don't know what to do here */ }
852 #line 853 "btyacc_demo.tab.c"
854 #line 83 "btyacc_demo.y"
855 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
857 (*loc).first_line, (*loc).first_column,
858 (*loc).last_line, (*loc).last_column);
859 /* in this example, we don't know what to do here */ }
861 #line 862 "btyacc_demo.tab.c"
863 #line 83 "btyacc_demo.y"
864 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
866 (*loc).first_line, (*loc).first_column,
867 (*loc).last_line, (*loc).last_column);
868 /* in this example, we don't know what to do here */ }
870 #line 871 "btyacc_demo.tab.c"
872 #line 83 "btyacc_demo.y"
873 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
875 (*loc).first_line, (*loc).first_column,
876 (*loc).last_line, (*loc).last_column);
877 /* in this example, we don't know what to do here */ }
879 #line 880 "btyacc_demo.tab.c"
881 #line 83 "btyacc_demo.y"
882 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
884 (*loc).first_line, (*loc).first_column,
885 (*loc).last_line, (*loc).last_column);
886 /* in this example, we don't know what to do here */ }
888 #line 889 "btyacc_demo.tab.c"
890 #line 83 "btyacc_demo.y"
891 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
893 (*loc).first_line, (*loc).first_column,
894 (*loc).last_line, (*loc).last_column);
895 /* in this example, we don't know what to do here */ }
897 #line 898 "btyacc_demo.tab.c"
899 #line 83 "btyacc_demo.y"
900 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
902 (*loc).first_line, (*loc).first_column,
903 (*loc).last_line, (*loc).last_column);
904 /* in this example, we don't know what to do here */ }
906 #line 907 "btyacc_demo.tab.c"
908 #line 78 "btyacc_demo.y"
909 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
911 (*loc).first_line, (*loc).first_column,
912 (*loc).last_line, (*loc).last_column);
915 #line 916 "btyacc_demo.tab.c"
917 #line 67 "btyacc_demo.y"
918 { /* 'msg' is a 'char *' indicating the context of destructor invocation*/
919 printf("%s accessed by symbol \"decl\" (case s.b. 273) @ position[%d,%d..%d,%d]\n",
921 (*loc).first_line, (*loc).first_column,
922 (*loc).last_line, (*loc).last_column);
923 free((*val).decl->scope); free((*val).decl->type); }
925 #line 926 "btyacc_demo.tab.c"
927 #line 83 "btyacc_demo.y"
928 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
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 */ }
934 #line 935 "btyacc_demo.tab.c"
936 #line 83 "btyacc_demo.y"
937 { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
939 (*loc).first_line, (*loc).first_column,
940 (*loc).last_line, (*loc).last_column);
941 /* in this example, we don't know what to do here */ }
943 #line 944 "btyacc_demo.tab.c"
945 #line 78 "btyacc_demo.y"
946 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
948 (*loc).first_line, (*loc).first_column,
949 (*loc).last_line, (*loc).last_column);
952 #line 953 "btyacc_demo.tab.c"
954 #line 78 "btyacc_demo.y"
955 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
957 (*loc).first_line, (*loc).first_column,
958 (*loc).last_line, (*loc).last_column);
961 #line 962 "btyacc_demo.tab.c"
963 #line 78 "btyacc_demo.y"
964 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
966 (*loc).first_line, (*loc).first_column,
967 (*loc).last_line, (*loc).last_column);
970 #line 971 "btyacc_demo.tab.c"
972 #line 73 "btyacc_demo.y"
973 { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
975 (*loc).first_line, (*loc).first_column,
976 (*loc).last_line, (*loc).last_column);
979 #line 980 "btyacc_demo.tab.c"
981 #line 73 "btyacc_demo.y"
982 { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
984 (*loc).first_line, (*loc).first_column,
985 (*loc).last_line, (*loc).last_column);
988 #line 989 "btyacc_demo.tab.c"
990 #line 78 "btyacc_demo.y"
991 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
993 (*loc).first_line, (*loc).first_column,
994 (*loc).last_line, (*loc).last_column);
997 #line 998 "btyacc_demo.tab.c"
999 #line 78 "btyacc_demo.y"
1000 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1002 (*loc).first_line, (*loc).first_column,
1003 (*loc).last_line, (*loc).last_column);
1004 free((*val).type); }
1006 #line 1007 "btyacc_demo.tab.c"
1008 #line 78 "btyacc_demo.y"
1009 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1011 (*loc).first_line, (*loc).first_column,
1012 (*loc).last_line, (*loc).last_column);
1013 free((*val).type); }
1015 #line 1016 "btyacc_demo.tab.c"
1017 #line 78 "btyacc_demo.y"
1018 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1020 (*loc).first_line, (*loc).first_column,
1021 (*loc).last_line, (*loc).last_column);
1022 free((*val).type); }
1024 #line 1025 "btyacc_demo.tab.c"
1026 #line 78 "btyacc_demo.y"
1027 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1029 (*loc).first_line, (*loc).first_column,
1030 (*loc).last_line, (*loc).last_column);
1031 free((*val).type); }
1033 #line 1034 "btyacc_demo.tab.c"
1035 #line 78 "btyacc_demo.y"
1036 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1038 (*loc).first_line, (*loc).first_column,
1039 (*loc).last_line, (*loc).last_column);
1040 free((*val).scope); }
1042 #line 1043 "btyacc_demo.tab.c"
1044 #line 78 "btyacc_demo.y"
1045 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1047 (*loc).first_line, (*loc).first_column,
1048 (*loc).last_line, (*loc).last_column);
1049 free((*val).dlist); }
1051 #line 1052 "btyacc_demo.tab.c"
1053 #line 78 "btyacc_demo.y"
1054 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1056 (*loc).first_line, (*loc).first_column,
1057 (*loc).last_line, (*loc).last_column);
1058 free((*val).dlist); }
1060 #line 1061 "btyacc_demo.tab.c"
1062 #line 78 "btyacc_demo.y"
1063 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1065 (*loc).first_line, (*loc).first_column,
1066 (*loc).last_line, (*loc).last_column);
1067 free((*val).scope); }
1069 #line 1070 "btyacc_demo.tab.c"
1071 #line 78 "btyacc_demo.y"
1072 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1074 (*loc).first_line, (*loc).first_column,
1075 (*loc).last_line, (*loc).last_column);
1076 free((*val).scope); }
1078 #line 1079 "btyacc_demo.tab.c"
1080 #line 78 "btyacc_demo.y"
1081 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1083 (*loc).first_line, (*loc).first_column,
1084 (*loc).last_line, (*loc).last_column);
1085 free((*val).type); }
1087 #line 1088 "btyacc_demo.tab.c"
1089 #line 78 "btyacc_demo.y"
1090 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1092 (*loc).first_line, (*loc).first_column,
1093 (*loc).last_line, (*loc).last_column);
1094 free((*val).scope); }
1096 #line 1097 "btyacc_demo.tab.c"
1098 #line 78 "btyacc_demo.y"
1099 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1101 (*loc).first_line, (*loc).first_column,
1102 (*loc).last_line, (*loc).last_column);
1103 free((*val).scope); }
1105 #line 1106 "btyacc_demo.tab.c"
1107 #line 78 "btyacc_demo.y"
1108 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1110 (*loc).first_line, (*loc).first_column,
1111 (*loc).last_line, (*loc).last_column);
1112 free((*val).type); }
1114 #line 1115 "btyacc_demo.tab.c"
1116 #line 78 "btyacc_demo.y"
1117 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1119 (*loc).first_line, (*loc).first_column,
1120 (*loc).last_line, (*loc).last_column);
1121 free((*val).scope); }
1123 #line 1124 "btyacc_demo.tab.c"
1125 #line 78 "btyacc_demo.y"
1126 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1128 (*loc).first_line, (*loc).first_column,
1129 (*loc).last_line, (*loc).last_column);
1130 free((*val).type); }
1132 #line 1133 "btyacc_demo.tab.c"
1134 #line 78 "btyacc_demo.y"
1135 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1137 (*loc).first_line, (*loc).first_column,
1138 (*loc).last_line, (*loc).last_column);
1139 free((*val).scope); }
1141 #line 1142 "btyacc_demo.tab.c"
1143 #line 78 "btyacc_demo.y"
1144 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1146 (*loc).first_line, (*loc).first_column,
1147 (*loc).last_line, (*loc).last_column);
1148 free((*val).scope); }
1150 #line 1151 "btyacc_demo.tab.c"
1152 #line 78 "btyacc_demo.y"
1153 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1155 (*loc).first_line, (*loc).first_column,
1156 (*loc).last_line, (*loc).last_column);
1157 free((*val).scope); }
1159 #line 1160 "btyacc_demo.tab.c"
1161 #line 78 "btyacc_demo.y"
1162 { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1164 (*loc).first_line, (*loc).first_column,
1165 (*loc).last_line, (*loc).last_column);
1166 free((*val).scope); }
1168 #line 1169 "btyacc_demo.tab.c"
1171 #define YYDESTRUCT_IS_DECLARED 1
1174 /* For use in generated program */
1175 #define yydepth (int)(yystack.s_mark - yystack.s_base)
1177 #define yytrial (yyps->save)
1178 #endif /* YYBTYACC */
1181 #include <stdio.h> /* needed for printf */
1184 #include <stdlib.h> /* needed for malloc, etc */
1185 #include <string.h> /* needed for memset */
1187 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
1188 static int yygrowstack(YYSTACKDATA *data)
1194 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1198 if ((newsize = data->stacksize) == 0)
1199 newsize = YYINITSTACKSIZE;
1200 else if (newsize >= YYMAXDEPTH)
1202 else if ((newsize *= 2) > YYMAXDEPTH)
1203 newsize = YYMAXDEPTH;
1205 i = (int) (data->s_mark - data->s_base);
1206 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
1210 data->s_base = newss;
1211 data->s_mark = newss + i;
1213 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
1217 data->l_base = newvs;
1218 data->l_mark = newvs + i;
1220 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1221 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
1225 data->p_base = newps;
1226 data->p_mark = newps + i;
1229 data->stacksize = newsize;
1230 data->s_last = data->s_base + newsize - 1;
1234 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
1239 #if YYPURE || defined(YY_NO_LEAKS)
1240 static void yyfreestack(YYSTACKDATA *data)
1244 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1247 memset(data, 0, sizeof(*data));
1250 #define yyfreestack(data) /* nothing */
1251 #endif /* YYPURE || defined(YY_NO_LEAKS) */
1254 static YYParseState *
1255 yyNewState(unsigned size)
1257 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
1258 if (p == NULL) return NULL;
1260 p->yystack.stacksize = size;
1263 p->yystack.s_base = NULL;
1264 p->yystack.l_base = NULL;
1265 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1266 p->yystack.p_base = NULL;
1270 p->yystack.s_base = (short *) malloc(size * sizeof(short));
1271 if (p->yystack.s_base == NULL) return NULL;
1272 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
1273 if (p->yystack.l_base == NULL) return NULL;
1274 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
1275 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1276 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
1277 if (p->yystack.p_base == NULL) return NULL;
1278 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
1285 yyFreeState(YYParseState *p)
1287 yyfreestack(&p->yystack);
1290 #endif /* YYBTYACC */
1292 #define YYABORT goto yyabort
1293 #define YYREJECT goto yyabort
1294 #define YYACCEPT goto yyaccept
1295 #define YYERROR goto yyerrlab
1297 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
1298 #define YYVALID_NESTED do { if (yyps->save && \
1299 yyps->save->save == 0) goto yyvalid; } while(0)
1300 #endif /* YYBTYACC */
1305 int yym, yyn, yystate, yyresult;
1308 YYParseState *yyerrctx = NULL;
1309 #endif /* YYBTYACC */
1310 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1311 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
1316 if ((yys = getenv("YYDEBUG")) != 0)
1319 if (yyn >= '0' && yyn <= '9')
1320 yydebug = yyn - '0';
1323 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
1327 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
1329 #endif /* YYBTYACC */
1336 memset(&yystack, 0, sizeof(yystack));
1339 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1340 yystack.s_mark = yystack.s_base;
1341 yystack.l_mark = yystack.l_base;
1342 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1343 yystack.p_mark = yystack.p_base;
1346 *yystack.s_mark = 0;
1349 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
1356 /* we're currently re-reading tokens */
1358 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1366 /* in trial mode; save scanner results for future parse attempts */
1367 if (yylvp == yylvlim)
1368 { /* Enlarge lexical value queue */
1369 int p = yylvp - yylvals;
1370 int s = yylvlim - yylvals;
1372 s += YYLVQUEUEGROWTH;
1373 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
1374 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
1375 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1376 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
1378 yylvp = yylve = yylvals + p;
1379 yylvlim = yylvals + s;
1380 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1381 yylpp = yylpe = yylpsns + p;
1382 yylplim = yylpsns + s;
1384 yylexp = yylexemes + p;
1386 *yylexp = (short) YYLEX;
1389 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1396 /* normal operation, no conflict encountered */
1397 #endif /* YYBTYACC */
1401 #endif /* YYBTYACC */
1402 if (yychar < 0) yychar = YYEOF;
1403 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1407 yys = yyname[YYTRANSLATE(yychar)];
1408 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
1409 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1410 #ifdef YYSTYPE_TOSTRING
1413 #endif /* YYBTYACC */
1414 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
1416 fputc('\n', stderr);
1422 /* Do we have a conflict? */
1423 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1424 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1433 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
1434 YYDEBUGSTR, yydepth, yystate);
1436 /* Switch to the next conflict context */
1438 yypath = save->save;
1441 if (save->state != yystate) YYABORT;
1448 /* Unresolved conflict - start/continue trial parse */
1453 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
1455 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
1457 fputs("Starting trial parse.\n", stderr);
1460 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1461 if (save == NULL) goto yyenomem;
1462 save->save = yyps->save;
1463 save->state = yystate;
1464 save->errflag = yyerrflag;
1465 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
1466 memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1467 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
1468 memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1469 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1470 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
1471 memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1473 ctry = yytable[yyn];
1474 if (yyctable[ctry] == -1)
1477 if (yydebug && yychar >= YYEOF)
1478 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
1483 if (yyps->save == NULL)
1485 /* If this is a first conflict in the stack, start saving lexemes */
1488 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
1489 if (yylexemes == NULL) goto yyenomem;
1490 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
1491 if (yylvals == NULL) goto yyenomem;
1492 yylvlim = yylvals + YYLVQUEUEGROWTH;
1493 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1494 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
1495 if (yylpsns == NULL) goto yyenomem;
1496 yylplim = yylpsns + YYLVQUEUEGROWTH;
1501 yylvp = yylve = yylvals;
1502 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1503 yylpp = yylpe = yylpsns;
1506 if (yychar >= YYEOF)
1509 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1512 *yylexp = (short) yychar;
1517 if (yychar >= YYEOF)
1520 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1526 save->lexeme = yylvp - yylvals;
1529 if (yytable[yyn] == ctry)
1533 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1534 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
1539 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1544 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
1546 yystate = yyctable[ctry];
1547 *++yystack.s_mark = (short) yystate;
1548 *++yystack.l_mark = yylval;
1549 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1550 *++yystack.p_mark = yylloc;
1553 if (yyerrflag > 0) --yyerrflag;
1558 yyn = yyctable[ctry];
1561 } /* End of code dealing with conflicts */
1562 #endif /* YYBTYACC */
1563 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1564 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1568 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1569 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
1571 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1572 yystate = yytable[yyn];
1573 *++yystack.s_mark = yytable[yyn];
1574 *++yystack.l_mark = yylval;
1575 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1576 *++yystack.p_mark = yylloc;
1579 if (yyerrflag > 0) --yyerrflag;
1582 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1583 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1588 if (yyerrflag != 0) goto yyinrecovery;
1601 YYParseState *save = yyps->save;
1604 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
1605 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
1606 (int)(yylvp - yylvals - yyps->save->lexeme));
1608 /* Memorize most forward-looking error state in case it's really an error. */
1609 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
1611 /* Free old saved error context state */
1612 if (yyerrctx) yyFreeState(yyerrctx);
1613 /* Create and fill out new saved error context state */
1614 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1615 if (yyerrctx == NULL) goto yyenomem;
1616 yyerrctx->save = yyps->save;
1617 yyerrctx->state = yystate;
1618 yyerrctx->errflag = yyerrflag;
1619 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1620 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1621 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
1622 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1623 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1624 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
1625 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1627 yyerrctx->lexeme = yylvp - yylvals;
1629 yylvp = yylvals + save->lexeme;
1630 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1631 yylpp = yylpsns + save->lexeme;
1633 yylexp = yylexemes + save->lexeme;
1635 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1636 memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1637 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1638 memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1639 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1640 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1641 memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1643 ctry = ++save->ctry;
1644 yystate = save->state;
1645 /* We tried shift, try reduce now */
1646 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1647 yyps->save = save->save;
1651 /* Nothing left on the stack -- error */
1656 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1659 /* Restore state as it was in the most forward-advanced error */
1660 yylvp = yylvals + yyerrctx->lexeme;
1661 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1662 yylpp = yylpsns + yyerrctx->lexeme;
1664 yylexp = yylexemes + yyerrctx->lexeme;
1665 yychar = yylexp[-1];
1667 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1670 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1671 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1672 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1673 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1674 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1675 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1676 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1678 yystate = yyerrctx->state;
1679 yyFreeState(yyerrctx);
1684 if (yynewerrflag == 0) goto yyinrecovery;
1685 #endif /* YYBTYACC */
1687 YYERROR_CALL("syntax error");
1688 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1689 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1704 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1705 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1709 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1710 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1712 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1713 yystate = yytable[yyn];
1714 *++yystack.s_mark = yytable[yyn];
1715 *++yystack.l_mark = yylval;
1716 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1717 /* lookahead position is error end position */
1718 yyerror_loc_range[1] = yylloc;
1719 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1720 *++yystack.p_mark = yyloc;
1728 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1729 YYDEBUGSTR, yydepth, *yystack.s_mark);
1731 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1732 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1733 /* the current TOS position is the error start position */
1734 yyerror_loc_range[0] = *yystack.p_mark;
1736 #if defined(YYDESTRUCT_CALL)
1739 #endif /* YYBTYACC */
1740 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1741 YYDESTRUCT_CALL("error: discarding state",
1742 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1744 YYDESTRUCT_CALL("error: discarding state",
1745 yystos[*yystack.s_mark], yystack.l_mark);
1746 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1747 #endif /* defined(YYDESTRUCT_CALL) */
1750 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1758 if (yychar == YYEOF) goto yyabort;
1762 yys = yyname[YYTRANSLATE(yychar)];
1763 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1764 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1767 #if defined(YYDESTRUCT_CALL)
1770 #endif /* YYBTYACC */
1771 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1772 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1774 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1775 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1776 #endif /* defined(YYDESTRUCT_CALL) */
1786 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1787 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1788 #ifdef YYSTYPE_TOSTRING
1791 #endif /* YYBTYACC */
1796 for (i = yym; i > 0; i--)
1798 if (i != yym) fputs(", ", stderr);
1799 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1800 yystack.l_mark[1-i]), stderr);
1805 fputc('\n', stderr);
1809 yyval = yystack.l_mark[1-yym];
1811 memset(&yyval, 0, sizeof yyval);
1812 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1814 /* Perform position reduction */
1815 memset(&yyloc, 0, sizeof(yyloc));
1818 #endif /* YYBTYACC */
1820 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1821 /* just in case YYERROR is invoked within the action, save
1822 the start of the rhs as the error start position */
1823 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1830 #line 93 "btyacc_demo.y"
1831 { yyval.scope = yystack.l_mark[0].scope; }
1834 #line 94 "btyacc_demo.y"
1835 { yyval.scope = global_scope; }
1838 #line 95 "btyacc_demo.y"
1839 { Decl *d = lookup(yystack.l_mark[-2].scope, yystack.l_mark[-1].id);
1840 if (!d || !d->scope) YYERROR;
1841 yyval.scope = d->scope; }
1844 #line 101 "btyacc_demo.y"
1845 { Decl *d = lookup(yystack.l_mark[-1].scope, yystack.l_mark[0].id);
1846 if (d == NULL || d->istype() == 0) YYERROR;
1847 yyval.type = d->type; }
1850 #line 106 "btyacc_demo.y"
1851 yyval.scope = global_scope = new_scope(0);
1854 #line 107 "btyacc_demo.y"
1855 yyval.scope = yystack.l_mark[-1].scope;
1858 #line 109 "btyacc_demo.y"
1859 yyval.type = yystack.l_mark[-1].type;
1862 #line 109 "btyacc_demo.y"
1866 #line 110 "btyacc_demo.y"
1867 yyval.scope = start_fn_def(yystack.l_mark[-4].scope, yystack.l_mark[0].decl);
1871 #line 111 "btyacc_demo.y"
1872 { /* demonstrate use of @$ & @N, although this is just the
1873 default computation and so is not necessary */
1874 yyloc.first_line = yystack.p_mark[-5].first_line;
1875 yyloc.first_column = yystack.p_mark[-5].first_column;
1876 yyloc.last_line = yystack.p_mark[0].last_line;
1877 yyloc.last_column = yystack.p_mark[0].last_column;
1878 finish_fn_def(yystack.l_mark[-2].decl, yystack.l_mark[0].code); }
1881 #line 121 "btyacc_demo.y"
1882 { yyval.type = yystack.l_mark[0].type; }
1885 #line 122 "btyacc_demo.y"
1886 { yyval.type = type_combine(yystack.l_mark[-2].type, yystack.l_mark[0].type); }
1889 #line 125 "btyacc_demo.y"
1893 #line 126 "btyacc_demo.y"
1894 { yyval.type = type_combine(yystack.l_mark[-1].type, yystack.l_mark[0].type); }
1897 #line 130 "btyacc_demo.y"
1898 { yyval.type = yystack.l_mark[0].type; }
1901 #line 131 "btyacc_demo.y"
1902 { yyval.type = yystack.l_mark[0].type; }
1905 #line 132 "btyacc_demo.y"
1906 { yyval.type = bare_extern(); }
1909 #line 133 "btyacc_demo.y"
1910 { yyval.type = bare_register(); }
1913 #line 134 "btyacc_demo.y"
1914 { yyval.type = bare_static(); }
1917 #line 138 "btyacc_demo.y"
1918 { yyval.type = bare_const(); }
1921 #line 139 "btyacc_demo.y"
1922 { yyval.type = bare_volatile(); }
1925 #line 143 "btyacc_demo.y"
1926 yyval.scope = yystack.l_mark[-3].scope;
1929 #line 143 "btyacc_demo.y"
1930 yyval.type = yystack.l_mark[-3].type;
1933 #line 148 "btyacc_demo.y"
1934 { if (!yystack.l_mark[0].type) YYERROR; } if (!yytrial)
1935 #line 149 "btyacc_demo.y"
1936 { yyval.decl = declare(yystack.l_mark[-1].scope, 0, yystack.l_mark[0].type); }
1940 #line 150 "btyacc_demo.y"
1941 { yyval.decl = declare(yystack.l_mark[-2].scope, yystack.l_mark[0].id, yystack.l_mark[-1].type); }
1944 #line 151 "btyacc_demo.y"
1945 yyval.scope = yystack.l_mark[-2].scope;
1948 #line 151 "btyacc_demo.y"
1949 yyval.type = yystack.l_mark[-2].type;
1953 #line 151 "btyacc_demo.y"
1954 { yyval.decl = yystack.l_mark[-1].decl; }
1958 #line 153 "btyacc_demo.y"
1959 { yyval.decl = make_pointer(yystack.l_mark[0].decl, yystack.l_mark[-3].type); }
1963 #line 155 "btyacc_demo.y"
1964 { yyval.decl = make_array(yystack.l_mark[-4].decl->type, yystack.l_mark[-1].expr); }
1968 #line 157 "btyacc_demo.y"
1969 { yyval.decl = build_function(yystack.l_mark[-5].decl, yystack.l_mark[-2].dlist, yystack.l_mark[0].type); }
1973 #line 160 "btyacc_demo.y"
1974 { yyval.dlist = 0; }
1978 #line 161 "btyacc_demo.y"
1979 { yyval.dlist = yystack.l_mark[0].dlist; }
1983 #line 164 "btyacc_demo.y"
1984 { yyval.dlist = append_dlist(yystack.l_mark[-3].dlist, yystack.l_mark[0].decl); }
1988 #line 165 "btyacc_demo.y"
1989 { yyval.dlist = build_dlist(yystack.l_mark[0].decl); }
1993 #line 168 "btyacc_demo.y"
1994 { yyval.decl = yystack.l_mark[0].decl; }
1998 #line 172 "btyacc_demo.y"
1999 { yyval.expr = build_expr(yystack.l_mark[-3].expr, ADD, yystack.l_mark[0].expr); }
2003 #line 173 "btyacc_demo.y"
2004 { yyval.expr = build_expr(yystack.l_mark[-3].expr, SUB, yystack.l_mark[0].expr); }
2008 #line 174 "btyacc_demo.y"
2009 { yyval.expr = build_expr(yystack.l_mark[-3].expr, MUL, yystack.l_mark[0].expr); }
2013 #line 175 "btyacc_demo.y"
2014 { yyval.expr = build_expr(yystack.l_mark[-3].expr, MOD, yystack.l_mark[0].expr); }
2018 #line 176 "btyacc_demo.y"
2019 { yyval.expr = build_expr(yystack.l_mark[-3].expr, DIV, yystack.l_mark[0].expr); }
2023 #line 177 "btyacc_demo.y"
2024 { yyval.expr = build_expr(0, DEREF, yystack.l_mark[0].expr); }
2028 #line 178 "btyacc_demo.y"
2029 { yyval.expr = var_expr(yystack.l_mark[-1].scope, yystack.l_mark[0].id); }
2033 #line 179 "btyacc_demo.y"
2034 { yyval.expr = yystack.l_mark[0].expr; }
2038 #line 183 "btyacc_demo.y"
2042 #line 184 "btyacc_demo.y"
2043 yyval.scope = yystack.l_mark[0].scope;
2046 #line 184 "btyacc_demo.y"
2047 {YYVALID;} if (!yytrial)
2048 #line 184 "btyacc_demo.y"
2049 { yyval.code = build_expr_code(yystack.l_mark[-1].expr); }
2052 #line 185 "btyacc_demo.y"
2053 yyval.scope = yystack.l_mark[-6].scope;
2056 #line 185 "btyacc_demo.y"
2057 yyval.scope = yystack.l_mark[-9].scope;
2060 #line 185 "btyacc_demo.y"
2061 {YYVALID;} if (!yytrial)
2062 #line 186 "btyacc_demo.y"
2063 { yyval.code = build_if(yystack.l_mark[-7].expr, yystack.l_mark[-3].code, yystack.l_mark[0].code); }
2066 #line 187 "btyacc_demo.y"
2067 {YYVALID;} if (!yytrial)
2068 #line 188 "btyacc_demo.y"
2069 { yyval.code = build_if(yystack.l_mark[-4].expr, yystack.l_mark[0].code, 0); }
2072 #line 189 "btyacc_demo.y"
2073 yyval.scope = new_scope(yystack.l_mark[0].scope);
2076 #line 189 "btyacc_demo.y"
2077 {YYVALID;} if (!yytrial)
2078 #line 189 "btyacc_demo.y"
2079 { yyval.code = yystack.l_mark[0].code; }
2083 #line 192 "btyacc_demo.y"
2088 #line 193 "btyacc_demo.y"
2089 { yyval.code = code_append(yystack.l_mark[-2].code, yystack.l_mark[0].code); }
2093 #line 197 "btyacc_demo.y"
2094 { yyval.code = yystack.l_mark[-1].code; }
2096 #line 2097 "btyacc_demo.tab.c"
2100 yystack.s_mark -= yym;
2101 yystate = *yystack.s_mark;
2102 yystack.l_mark -= yym;
2103 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2104 yystack.p_mark -= yym;
2107 if (yystate == 0 && yym == 0)
2112 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
2113 #ifdef YYSTYPE_TOSTRING
2116 #endif /* YYBTYACC */
2117 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
2119 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
2123 *++yystack.s_mark = YYFINAL;
2124 *++yystack.l_mark = yyval;
2125 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2126 *++yystack.p_mark = yyloc;
2134 /* we're currently re-reading tokens */
2136 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2144 /* in trial mode; save scanner results for future parse attempts */
2145 if (yylvp == yylvlim)
2146 { /* Enlarge lexical value queue */
2147 int p = yylvp - yylvals;
2148 int s = yylvlim - yylvals;
2150 s += YYLVQUEUEGROWTH;
2151 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
2153 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
2155 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2156 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
2159 yylvp = yylve = yylvals + p;
2160 yylvlim = yylvals + s;
2161 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2162 yylpp = yylpe = yylpsns + p;
2163 yylplim = yylpsns + s;
2165 yylexp = yylexemes + p;
2167 *yylexp = (short) YYLEX;
2170 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2177 /* normal operation, no conflict encountered */
2178 #endif /* YYBTYACC */
2182 #endif /* YYBTYACC */
2183 if (yychar < 0) yychar = YYEOF;
2184 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
2188 yys = yyname[YYTRANSLATE(yychar)];
2189 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
2190 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
2194 if (yychar == YYEOF) goto yyaccept;
2197 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
2198 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
2199 yystate = yytable[yyn];
2201 yystate = yydgoto[yym];
2205 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
2206 #ifdef YYSTYPE_TOSTRING
2209 #endif /* YYBTYACC */
2210 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
2212 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
2215 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
2216 *++yystack.s_mark = (short) yystate;
2217 *++yystack.l_mark = yyval;
2218 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2219 *++yystack.p_mark = yyloc;
2224 /* Reduction declares that this path is valid. Set yypath and do a full parse */
2226 if (yypath) YYABORT;
2229 YYParseState *save = yyps->save;
2230 yyps->save = save->save;
2231 save->save = yypath;
2236 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
2237 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
2241 yyFreeState(yyerrctx);
2244 yylvp = yylvals + yypath->lexeme;
2245 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2246 yylpp = yylpsns + yypath->lexeme;
2248 yylexp = yylexemes + yypath->lexeme;
2250 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
2251 memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
2252 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
2253 memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
2254 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2255 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
2256 memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
2258 yystate = yypath->state;
2260 #endif /* YYBTYACC */
2263 YYERROR_CALL("yacc stack overflow");
2267 YYERROR_CALL("memory exhausted");
2269 #endif /* YYBTYACC */
2279 if (yyps->save) goto yyvalid;
2280 #endif /* YYBTYACC */
2284 #if defined(YYDESTRUCT_CALL)
2285 if (yychar != YYEOF && yychar != YYEMPTY)
2286 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2287 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
2289 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
2290 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
2294 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2297 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
2298 YYDESTRUCT_CALL("cleanup: discarding state",
2299 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
2301 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
2302 YYDESTRUCT_CALL("cleanup: discarding state",
2303 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
2304 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
2306 #endif /* defined(YYDESTRUCT_CALL) */
2311 yyFreeState(yyerrctx);
2316 YYParseState *save = yyps;
2323 YYParseState *save = yypath;
2324 yypath = save->save;
2328 #endif /* YYBTYACC */
2329 yyfreestack(&yystack);