diff -ur bacisrc/ccomp/baccutil.c bacisrc.ok/ccomp/baccutil.c --- bacisrc/ccomp/baccutil.c 2004-04-15 13:31:24.000000000 +0200 +++ bacisrc.ok/ccomp/baccutil.c 2005-10-26 22:11:03.000000000 +0200 @@ -13,6 +13,7 @@ #include "../include/computil.h" #include "../include/pcode.h" #include "../include/incfiles.h" +#include "../include/writetab.h" extern int fprintf(FILE*,const char*,...); @@ -165,9 +166,13 @@ /* when name of main pgm is seen in parsing, it's next stid */ } /* global_init */ + /* * * $Log$ + * Revision 2.6 2004/07/21 19:16:54 bynum + * add writetab.h include + * * Revision 2.5 2003/06/25 17:09:46 bynum * change to Moti Ben-Ari's filename suffix convention * diff -ur bacisrc/ccomp/bac.l bacisrc.ok/ccomp/bac.l --- bacisrc/ccomp/bac.l 2004-04-15 13:31:23.000000000 +0200 +++ bacisrc.ok/ccomp/bac.l 2005-10-26 22:11:03.000000000 +0200 @@ -342,7 +342,7 @@ } } while (reading); } - return ((esc < 256) ? esc : 0x20); + return esc; } @@ -409,6 +409,9 @@ /* * * $Log$ + * Revision 2.15 2005/10/26 20:03:23 bynum + * remove extraneous test in get_escape + * * Revision 2.14 2004/04/13 15:39:50 bynum * add \r case to get rid of errors when reading MS-DOS/WIN source files * diff -ur bacisrc/ccomp/bac.y bacisrc.ok/ccomp/bac.y --- bacisrc/ccomp/bac.y 2004-04-15 13:31:23.000000000 +0200 +++ bacisrc.ok/ccomp/bac.y 2005-10-26 22:11:03.000000000 +0200 @@ -49,6 +49,7 @@ BUFFER pbuf; /* string buffer for parsing */ /* constants for passing synthesized information back up the parse tree */ int dx,level=0; +int maxlevel = 0; /* for passing type of constant back to constant productions */ TYPES consttype; /* for passing back information to productions using 'type' prod */ @@ -103,7 +104,6 @@ int in_func_decl; /* 1 if declaring a function, 0 otherwise */ int void_function; /* 1 if function has VOID return type, 0 otherwise */ -int func_tab; /* tab index of function being declared */ #define MAXBREAK 200 /* max # breaks in a nest of loop and switch stmts */ @@ -360,6 +360,7 @@ prt = last_tab; enter_block(&last_btab,&level,last_tab); btab[last_btab].lastpar = last_tab; /* no parms */ + if (maxlevel < level) maxlevel = level; main_declared = 1; $$ = prt; btab[0].lastpar = prt; /* save main's tabix for the interp */ @@ -385,6 +386,7 @@ if (main_declared) yyerror("main() proc must be last"); if (void_function) { + if (curr_ret >= 0) process_returns(); if (tab[$1].mon) emit(EXITMON); emit(EXIT_PROC); } @@ -464,9 +466,9 @@ vis_level = real_level = level; } $$ = prt = enter(lastident(),function,real_level,vis_level); - func_tab = prt; if (in_mon_decl) tab[prt].mon = mtab[mon] - last_predeclared; enter_block(&last_btab,&level,prt); + if (maxlevel < level) maxlevel = level; curr_parm_offset = btab[display[level]].vsize; delta_vsize = curr_parm_offset - btab[display[level]].psize; tab[$$].adr = (extern_decl ? -1 : lc); @@ -511,8 +513,9 @@ elem_ref = 0; elem_size = 1; /* a pointer */ elem_typ = strings; - elem_tix = -1; + elem_tix = -1; /* not in symbol table */ by_value = 0; /* pass-by-reference */ + $$ = -1; /* not in symbol table */ } ; @@ -536,6 +539,7 @@ yyerror("Monitors can only be declared at the global level"); enter_block(&last_btab,&level,last_tab); btab[last_btab].lastpar = last_tab; /* no parms */ + if (maxlevel < level) maxlevel = level; } ; @@ -868,7 +872,9 @@ ; for_expr_list : expr + { free_expr($1); } | for_expr_list ',' expr + { free_expr($3); } ; stmt : selection_stmt @@ -1014,10 +1020,10 @@ /* the current case of the enclosing switch block is one */ /* less than the first case of this block */ curr_case = switch_block[switch_level].first_case - 1; + free_expr(switch_block[switch_level].expr_index); switch_level--; process_breaks(); leave_break_block(&break_level,&curr_break,&curr_cont); - free_expr($1); } ; @@ -1297,23 +1303,31 @@ return_stmt : the_return opt_expr ';' { if (void_function) { - if ($2 < 0) - emit(EXIT_PROC); + if ($2 < 0) { + if (++curr_ret == MAXRETURN) + cfatal( + "No more thn %d 'return' statements can appear in a function",MAXRETURN); + else + return_loc[curr_ret] = lc; /* mark the JUMP loc */ + emit(JUMP); + } else yyerror("Cannot return a value from a 'void' function"); } - if ($2 >= 0) - gen_exprval($2); - else /* no expression to push */ - emit1(PUSH_LIT,0); - emit(STORE); - if (++curr_ret == MAXRETURN) - cfatal( + else { // non void function + if ($2 >= 0) + gen_exprval($2); + else /* no expression to push */ + emit1(PUSH_LIT,0); + emit(STORE); + if (++curr_ret == MAXRETURN) + cfatal( "No more thn %d 'return' statements can appear in a function",MAXRETURN); - else - return_loc[curr_ret] = lc; /* mark the JUMP loc */ - emit(JUMP); /* jump to fcn exit*/ - } + else + return_loc[curr_ret] = lc; /* mark the JUMP loc */ + emit(JUMP); /* jump to fcn exit*/ + } + } ; the_return : RETURN @@ -1321,7 +1335,7 @@ if (!in_func_decl) yyerror("'return' is inappropriate outside a function"); else if (!void_function) - emit2(LOAD_ADDR,tab[func_tab].lev+1,0); + emit2(LOAD_ADDR,tab[prt].lev+1,0); } ; @@ -1369,6 +1383,7 @@ emit1(READ,expr[$3].typ); } else /* array element */ emit1(READ,expr[$3].typ); + free_expr($3); } ; @@ -1377,6 +1392,7 @@ opt_expr : /* empty */ { $$ = -1; } | expr + { free_expr($1); } ; expr_stmt : expr ';' @@ -1410,6 +1426,7 @@ else yyerror("Type mismatch in assignment"); $$ = $2; + expr[$$].tix = $1; assign_cnt--; } | array_var_becomes expr @@ -1420,7 +1437,7 @@ (expr[$1].typ == conds)) yyerror("Cannot assign to 'semaphore' or 'condition'"); else if (expr[$1].typ == arrays) - emit1(COPY_BLOCK,atab[tab[$1].ref].size); + emit1(COPY_BLOCK,atab[expr[$1].ref].size); else /* standard types */ if (assign_cnt > 1) /* multiple assignments */ emit(STORE_KEEP); @@ -1429,6 +1446,7 @@ } else yyerror("Type mismatch in assignment"); + free_expr($2); expr[$1].isval = 1; $$ = $1; assign_cnt--; @@ -1439,9 +1457,6 @@ { assign_cnt++; if ((tab[$1].obj == variable)||(tab[$1].obj == ext_variable)) { - if ((tab[$1].typ == sems)||(tab[$1].typ == bsems)) - yyerror("Must use `initialsem' to initialize a 'semaphore'"); - else emit_push_addr(tab[$1]); } else @@ -1758,7 +1773,7 @@ else{ /* legal func call */ pfstack[toppfs].tix = last_pf; pfstack[toppfs].pct = parmct = 0; - first_stringerr = first_parmcterr = 1; + first_parmcterr = 1; if (tab[$1].lev != -1){ /* regular proc call */ if ((tab[$1].mon)&&(tab[prt].mon)&& (tab[$1].mon != tab[prt].mon)) @@ -1811,6 +1826,7 @@ right_stringparm : ',' expr ')' { + $$ = $2; if (expr[$2].typ != strings) { yyerror("right parameter is not of type 'string'"); last_eltyp = notyp; @@ -2174,6 +2190,9 @@ /* * * $Log$ + * Revision 2.26 2004/07/21 19:17:28 bynum + * correct minor errors discovered in writing the Java version of bacc + * * Revision 2.25 2004/04/13 18:18:40 bynum * revise grammar to handle C-style expressions * diff -ur bacisrc/ccomp/gram.c bacisrc.ok/ccomp/gram.c --- bacisrc/ccomp/gram.c 2004-04-15 13:31:23.000000000 +0200 +++ bacisrc.ok/ccomp/gram.c 2005-10-26 22:11:03.000000000 +0200 @@ -1,61 +1,169 @@ -/* A Bison parser, made from bac.y - by GNU bison 1.35. */ +/* A Bison parser, made by GNU Bison 1.875. */ -#define YYBISON 1 /* Identify Bison output. */ +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. -# define UNSIGNED_INT 257 -# define STRING 258 -# define RAWSTRING 259 -# define STRINGCONCAT 260 -# define STRINGCOMPARE 261 -# define STRINGCOPY 262 -# define STRINGLENGTH 263 -# define IDENTIFIER 264 -# define CHARCON 265 -# define INCLUDE 266 -# define FNSTRING 267 -# define NE 268 -# define LE 269 -# define GE 270 -# define EQ 271 -# define OR 272 -# define AND 273 -# define PLPL 274 -# define MIMI 275 -# define IF 276 -# define ELSE 277 -# define SWITCH 278 -# define CASE 279 -# define DEFAULT 280 -# define WHILE 281 -# define DO 282 -# define FOR 283 -# define CBEGIN 284 -# define CONST 285 -# define TYPEDEF 286 -# define VOID 287 -# define INT 288 -# define CHAR 289 -# define CONTINUE 290 -# define BREAK 291 -# define RETURN 292 -# define COUT 293 -# define LTLT 294 -# define ENDL 295 -# define CIN 296 -# define GTGT 297 -# define MAIN 298 -# define MONITOR 299 -# define INIT 300 -# define ATOMIC 301 -# define SEND 302 -# define RECEIVE 303 -# define BROADCAST 304 -# define EXTERN 305 -# define SSCANF 306 -# define SPRINTF 307 -# define LOWER_THAN_ELSE 308 + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Written by Richard Stallman by simplifying the original so called + ``semantic'' parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + UNSIGNED_INT = 258, + STRING = 259, + RAWSTRING = 260, + STRINGCONCAT = 261, + STRINGCOMPARE = 262, + STRINGCOPY = 263, + STRINGLENGTH = 264, + IDENTIFIER = 265, + CHARCON = 266, + INCLUDE = 267, + FNSTRING = 268, + NE = 269, + LE = 270, + GE = 271, + EQ = 272, + OR = 273, + AND = 274, + PLPL = 275, + MIMI = 276, + IF = 277, + ELSE = 278, + SWITCH = 279, + CASE = 280, + DEFAULT = 281, + WHILE = 282, + DO = 283, + FOR = 284, + CBEGIN = 285, + CONST = 286, + TYPEDEF = 287, + VOID = 288, + INT = 289, + CHAR = 290, + CONTINUE = 291, + BREAK = 292, + RETURN = 293, + COUT = 294, + LTLT = 295, + ENDL = 296, + CIN = 297, + GTGT = 298, + MAIN = 299, + MONITOR = 300, + INIT = 301, + ATOMIC = 302, + SEND = 303, + RECEIVE = 304, + BROADCAST = 305, + EXTERN = 306, + SSCANF = 307, + SPRINTF = 308, + LOWER_THAN_ELSE = 309 + }; +#endif +#define UNSIGNED_INT 258 +#define STRING 259 +#define RAWSTRING 260 +#define STRINGCONCAT 261 +#define STRINGCOMPARE 262 +#define STRINGCOPY 263 +#define STRINGLENGTH 264 +#define IDENTIFIER 265 +#define CHARCON 266 +#define INCLUDE 267 +#define FNSTRING 268 +#define NE 269 +#define LE 270 +#define GE 271 +#define EQ 272 +#define OR 273 +#define AND 274 +#define PLPL 275 +#define MIMI 276 +#define IF 277 +#define ELSE 278 +#define SWITCH 279 +#define CASE 280 +#define DEFAULT 281 +#define WHILE 282 +#define DO 283 +#define FOR 284 +#define CBEGIN 285 +#define CONST 286 +#define TYPEDEF 287 +#define VOID 288 +#define INT 289 +#define CHAR 290 +#define CONTINUE 291 +#define BREAK 292 +#define RETURN 293 +#define COUT 294 +#define LTLT 295 +#define ENDL 296 +#define CIN 297 +#define GTGT 298 +#define MAIN 299 +#define MONITOR 300 +#define INIT 301 +#define ATOMIC 302 +#define SEND 303 +#define RECEIVE 304 +#define BROADCAST 305 +#define EXTERN 306 +#define SSCANF 307 +#define SPRINTF 308 +#define LOWER_THAN_ELSE 309 + + + +/* Copy the first part of user declarations. */ #line 1 "bac.y" /* yacc grammar for BenAri Concurrent C */ @@ -108,6 +216,7 @@ BUFFER pbuf; /* string buffer for parsing */ /* constants for passing synthesized information back up the parse tree */ int dx,level=0; +int maxlevel = 0; /* for passing type of constant back to constant productions */ TYPES consttype; /* for passing back information to productions using 'type' prod */ @@ -162,7 +271,6 @@ int in_func_decl; /* 1 if declaring a function, 0 otherwise */ int void_function; /* 1 if function has VOID return type, 0 otherwise */ -int func_tab; /* tab index of function being declared */ #define MAXBREAK 200 /* max # breaks in a nest of loop and switch stmts */ @@ -293,25 +401,153 @@ emit2(((x).normal ? LOAD_ADDR : LOAD_VALUE), (x).lev, (x).adr)) -#ifndef YYSTYPE -# define YYSTYPE int -# define YYSTYPE_IS_TRIVIAL 1 -#endif + + +/* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +/* Line 214 of yacc.c. */ +#line 432 "y.tab.c" + +#if ! defined (yyoverflow) || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# else +# ifndef YYSTACK_USE_ALLOCA +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free +# endif +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short yyss; + YYSTYPE yyvs; + }; +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) -#define YYFINAL 437 -#define YYFLAG -32768 -#define YYNTBASE 75 +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif -/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ -#define YYTRANSLATE(x) ((unsigned)(x) <= 308 ? yytranslate[x] : 218) +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) -/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ -static const char yytranslate[] = +#endif + +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short yysigned_char; +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 3 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 1059 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 75 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 144 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 261 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 437 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 309 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -338,166 +574,166 @@ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54 + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54 }; #if YYDEBUG -static const short yyprhs[] = -{ - 0, 0, 4, 7, 8, 10, 13, 15, 17, 19, - 21, 23, 25, 27, 30, 33, 34, 37, 42, 43, - 45, 47, 52, 56, 59, 62, 64, 67, 69, 71, - 74, 78, 82, 84, 88, 89, 91, 93, 95, 99, - 102, 104, 107, 109, 114, 117, 120, 122, 125, 127, - 129, 131, 132, 137, 139, 144, 147, 151, 153, 156, - 158, 160, 164, 166, 168, 173, 175, 177, 181, 183, - 187, 189, 192, 194, 197, 201, 206, 211, 213, 220, - 222, 225, 228, 230, 232, 234, 236, 238, 240, 242, - 244, 248, 250, 253, 256, 259, 261, 264, 267, 270, - 271, 273, 275, 279, 281, 283, 285, 287, 289, 291, - 293, 295, 297, 299, 301, 303, 305, 307, 309, 316, - 319, 322, 325, 330, 336, 338, 342, 345, 350, 356, - 361, 363, 365, 370, 372, 375, 379, 381, 384, 389, - 390, 391, 392, 395, 398, 403, 407, 414, 421, 423, - 427, 429, 430, 432, 436, 440, 443, 444, 446, 448, - 449, 451, 453, 456, 459, 463, 465, 469, 472, 476, - 478, 480, 482, 487, 489, 490, 492, 495, 497, 499, - 502, 505, 508, 511, 513, 517, 519, 521, 525, 527, - 529, 533, 535, 537, 539, 541, 543, 545, 547, 549, - 552, 555, 559, 561, 563, 565, 567, 571, 573, 575, - 577, 579, 581, 583, 585, 589, 592, 594, 597, 600, - 603, 606, 608, 610, 612, 614, 617, 619, 621, 623, - 626, 630, 634, 636, 638, 640, 642, 644, 646, 648, - 652, 656, 660, 662, 666, 670, 673, 677, 681, 686, - 692, 694, 698, 702, 708, 711, 713, 718, 722, 727, - 729 +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned short yyprhs[] = +{ + 0, 0, 3, 7, 10, 11, 13, 16, 18, 20, + 22, 24, 26, 28, 30, 33, 36, 37, 40, 45, + 46, 48, 50, 55, 59, 62, 65, 67, 70, 72, + 74, 77, 81, 85, 87, 91, 92, 94, 96, 98, + 102, 105, 107, 110, 112, 117, 120, 123, 125, 128, + 130, 132, 134, 135, 140, 142, 147, 150, 154, 156, + 159, 161, 163, 167, 169, 171, 176, 178, 180, 184, + 186, 190, 192, 195, 197, 200, 204, 209, 214, 216, + 223, 225, 228, 231, 233, 235, 237, 239, 241, 243, + 245, 247, 251, 253, 256, 259, 262, 264, 267, 270, + 273, 274, 276, 278, 282, 284, 286, 288, 290, 292, + 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, + 319, 322, 325, 328, 333, 339, 341, 345, 348, 353, + 359, 364, 366, 368, 373, 375, 378, 382, 384, 387, + 392, 393, 394, 395, 398, 401, 406, 410, 417, 424, + 426, 430, 432, 433, 435, 439, 443, 446, 447, 449, + 451, 452, 454, 456, 459, 462, 466, 468, 472, 475, + 479, 481, 483, 485, 490, 492, 493, 495, 498, 500, + 502, 505, 508, 511, 514, 516, 520, 522, 524, 528, + 530, 532, 536, 538, 540, 542, 544, 546, 548, 550, + 552, 555, 558, 562, 564, 566, 568, 570, 574, 576, + 578, 580, 582, 584, 586, 588, 592, 595, 597, 600, + 603, 606, 609, 611, 613, 615, 617, 620, 622, 624, + 626, 629, 633, 637, 639, 641, 643, 645, 647, 649, + 651, 655, 659, 663, 665, 669, 673, 676, 680, 684, + 689, 695, 697, 701, 705, 711, 714, 716, 721, 725, + 730, 732 }; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const short yyrhs[] = { - 76, 77, 81, 0, 76, 81, 0, 0, 78, 0, - 77, 78, 0, 79, 0, 85, 0, 96, 0, 114, - 0, 116, 0, 107, 0, 120, 0, 80, 13, 0, - 55, 12, 0, 0, 82, 84, 0, 83, 44, 56, - 57, 0, 0, 34, 0, 33, 0, 58, 105, 126, - 59, 0, 58, 126, 59, 0, 58, 59, 0, 86, - 84, 0, 87, 0, 47, 87, 0, 88, 0, 89, - 0, 90, 91, 0, 33, 90, 91, 0, 108, 90, - 91, 0, 10, 0, 56, 92, 57, 0, 0, 33, - 0, 93, 0, 94, 0, 93, 60, 94, 0, 95, - 217, 0, 108, 0, 108, 61, 0, 4, 0, 97, - 58, 98, 59, 0, 45, 217, 0, 99, 101, 0, - 100, 0, 99, 100, 0, 85, 0, 116, 0, 107, - 0, 0, 102, 58, 126, 59, 0, 46, 0, 97, - 58, 104, 59, 0, 86, 62, 0, 104, 86, 62, - 0, 106, 0, 105, 106, 0, 107, 0, 120, 0, - 108, 109, 62, 0, 34, 0, 35, 0, 4, 63, - 118, 64, 0, 216, 0, 110, 0, 109, 60, 110, - 0, 217, 0, 217, 65, 117, 0, 111, 0, 217, - 112, 0, 113, 0, 112, 113, 0, 63, 118, 64, - 0, 115, 108, 217, 62, 0, 115, 108, 111, 62, - 0, 32, 0, 31, 108, 217, 65, 117, 62, 0, - 118, 0, 66, 118, 0, 67, 118, 0, 11, 0, - 119, 0, 216, 0, 3, 0, 121, 0, 123, 0, - 124, 0, 125, 0, 122, 86, 62, 0, 51, 0, - 122, 107, 0, 122, 111, 0, 122, 103, 0, 129, - 0, 126, 129, 0, 1, 62, 0, 1, 59, 0, - 0, 128, 0, 175, 0, 128, 60, 175, 0, 137, - 0, 84, 0, 150, 0, 151, 0, 174, 0, 164, - 0, 165, 0, 166, 0, 168, 0, 171, 0, 172, - 0, 130, 0, 131, 0, 133, 0, 134, 0, 48, - 132, 60, 175, 57, 62, 0, 56, 203, 0, 56, - 175, 0, 50, 207, 0, 135, 60, 136, 57, 0, - 53, 56, 175, 60, 203, 0, 175, 0, 136, 60, - 175, 0, 138, 139, 0, 138, 139, 140, 129, 0, - 141, 58, 142, 148, 59, 0, 22, 56, 175, 57, - 0, 129, 0, 23, 0, 24, 56, 175, 57, 0, - 143, 0, 142, 143, 0, 144, 147, 126, 0, 145, - 0, 144, 145, 0, 25, 146, 175, 68, 0, 0, - 0, 0, 149, 126, 0, 26, 68, 0, 163, 58, - 126, 59, 0, 152, 153, 129, 0, 154, 155, 129, - 156, 157, 62, 0, 158, 160, 161, 162, 57, 129, - 0, 27, 0, 56, 175, 57, 0, 28, 0, 0, - 27, 0, 56, 175, 57, 0, 159, 127, 62, 0, - 29, 56, 0, 0, 175, 0, 62, 0, 0, 128, - 0, 30, 0, 36, 62, 0, 37, 62, 0, 167, - 173, 62, 0, 38, 0, 39, 169, 62, 0, 40, - 170, 0, 169, 40, 170, 0, 175, 0, 41, 0, - 5, 0, 42, 43, 175, 62, 0, 62, 0, 0, - 175, 0, 175, 62, 0, 179, 0, 176, 0, 177, - 175, 0, 178, 175, 0, 216, 65, 0, 212, 65, - 0, 181, 0, 180, 18, 181, 0, 179, 0, 183, - 0, 182, 19, 183, 0, 181, 0, 186, 0, 184, - 185, 186, 0, 186, 0, 17, 0, 69, 0, 70, - 0, 15, 0, 16, 0, 14, 0, 189, 0, 67, - 189, 0, 66, 189, 0, 187, 188, 189, 0, 186, - 0, 67, 0, 66, 0, 192, 0, 190, 191, 192, - 0, 189, 0, 71, 0, 72, 0, 73, 0, 193, - 0, 119, 0, 11, 0, 56, 175, 57, 0, 74, - 192, 0, 194, 0, 194, 20, 0, 20, 194, 0, - 194, 21, 0, 21, 194, 0, 195, 0, 212, 0, - 215, 0, 216, 0, 196, 197, 0, 200, 0, 211, - 0, 216, 0, 56, 57, 0, 56, 198, 57, 0, - 198, 60, 199, 0, 199, 0, 175, 0, 201, 0, - 204, 0, 205, 0, 206, 0, 208, 0, 6, 132, - 202, 0, 60, 175, 57, 0, 60, 203, 57, 0, - 5, 0, 8, 132, 202, 0, 7, 132, 202, 0, - 9, 207, 0, 56, 175, 57, 0, 56, 5, 57, - 0, 209, 60, 210, 57, 0, 52, 56, 175, 60, - 203, 0, 175, 0, 210, 60, 175, 0, 49, 132, - 57, 0, 49, 132, 60, 175, 57, 0, 213, 214, - 0, 216, 0, 214, 63, 175, 64, 0, 63, 175, - 64, 0, 34, 56, 175, 57, 0, 10, 0, 10, - 0 + 76, 0, -1, 77, 78, 82, -1, 77, 82, -1, + -1, 79, -1, 78, 79, -1, 80, -1, 86, -1, + 97, -1, 115, -1, 117, -1, 108, -1, 121, -1, + 81, 13, -1, 55, 12, -1, -1, 83, 85, -1, + 84, 44, 56, 57, -1, -1, 34, -1, 33, -1, + 58, 106, 127, 59, -1, 58, 127, 59, -1, 58, + 59, -1, 87, 85, -1, 88, -1, 47, 88, -1, + 89, -1, 90, -1, 91, 92, -1, 33, 91, 92, + -1, 109, 91, 92, -1, 10, -1, 56, 93, 57, + -1, -1, 33, -1, 94, -1, 95, -1, 94, 60, + 95, -1, 96, 218, -1, 109, -1, 109, 61, -1, + 4, -1, 98, 58, 99, 59, -1, 45, 218, -1, + 100, 102, -1, 101, -1, 100, 101, -1, 86, -1, + 117, -1, 108, -1, -1, 103, 58, 127, 59, -1, + 46, -1, 98, 58, 105, 59, -1, 87, 62, -1, + 105, 87, 62, -1, 107, -1, 106, 107, -1, 108, + -1, 121, -1, 109, 110, 62, -1, 34, -1, 35, + -1, 4, 63, 119, 64, -1, 217, -1, 111, -1, + 110, 60, 111, -1, 218, -1, 218, 65, 118, -1, + 112, -1, 218, 113, -1, 114, -1, 113, 114, -1, + 63, 119, 64, -1, 116, 109, 218, 62, -1, 116, + 109, 112, 62, -1, 32, -1, 31, 109, 218, 65, + 118, 62, -1, 119, -1, 66, 119, -1, 67, 119, + -1, 11, -1, 120, -1, 217, -1, 3, -1, 122, + -1, 124, -1, 125, -1, 126, -1, 123, 87, 62, + -1, 51, -1, 123, 108, -1, 123, 112, -1, 123, + 104, -1, 130, -1, 127, 130, -1, 1, 62, -1, + 1, 59, -1, -1, 129, -1, 176, -1, 129, 60, + 176, -1, 138, -1, 85, -1, 151, -1, 152, -1, + 175, -1, 165, -1, 166, -1, 167, -1, 169, -1, + 172, -1, 173, -1, 131, -1, 132, -1, 134, -1, + 135, -1, 48, 133, 60, 176, 57, 62, -1, 56, + 204, -1, 56, 176, -1, 50, 208, -1, 136, 60, + 137, 57, -1, 53, 56, 176, 60, 204, -1, 176, + -1, 137, 60, 176, -1, 139, 140, -1, 139, 140, + 141, 130, -1, 142, 58, 143, 149, 59, -1, 22, + 56, 176, 57, -1, 130, -1, 23, -1, 24, 56, + 176, 57, -1, 144, -1, 143, 144, -1, 145, 148, + 127, -1, 146, -1, 145, 146, -1, 25, 147, 176, + 68, -1, -1, -1, -1, 150, 127, -1, 26, 68, + -1, 164, 58, 127, 59, -1, 153, 154, 130, -1, + 155, 156, 130, 157, 158, 62, -1, 159, 161, 162, + 163, 57, 130, -1, 27, -1, 56, 176, 57, -1, + 28, -1, -1, 27, -1, 56, 176, 57, -1, 160, + 128, 62, -1, 29, 56, -1, -1, 176, -1, 62, + -1, -1, 129, -1, 30, -1, 36, 62, -1, 37, + 62, -1, 168, 174, 62, -1, 38, -1, 39, 170, + 62, -1, 40, 171, -1, 170, 40, 171, -1, 176, + -1, 41, -1, 5, -1, 42, 43, 176, 62, -1, + 62, -1, -1, 176, -1, 176, 62, -1, 180, -1, + 177, -1, 178, 176, -1, 179, 176, -1, 217, 65, + -1, 213, 65, -1, 182, -1, 181, 18, 182, -1, + 180, -1, 184, -1, 183, 19, 184, -1, 182, -1, + 187, -1, 185, 186, 187, -1, 187, -1, 17, -1, + 69, -1, 70, -1, 15, -1, 16, -1, 14, -1, + 190, -1, 67, 190, -1, 66, 190, -1, 188, 189, + 190, -1, 187, -1, 67, -1, 66, -1, 193, -1, + 191, 192, 193, -1, 190, -1, 71, -1, 72, -1, + 73, -1, 194, -1, 120, -1, 11, -1, 56, 176, + 57, -1, 74, 193, -1, 195, -1, 195, 20, -1, + 20, 195, -1, 195, 21, -1, 21, 195, -1, 196, + -1, 213, -1, 216, -1, 217, -1, 197, 198, -1, + 201, -1, 212, -1, 217, -1, 56, 57, -1, 56, + 199, 57, -1, 199, 60, 200, -1, 200, -1, 176, + -1, 202, -1, 205, -1, 206, -1, 207, -1, 209, + -1, 6, 133, 203, -1, 60, 176, 57, -1, 60, + 204, 57, -1, 5, -1, 8, 133, 203, -1, 7, + 133, 203, -1, 9, 208, -1, 56, 176, 57, -1, + 56, 5, 57, -1, 210, 60, 211, 57, -1, 52, + 56, 176, 60, 204, -1, 176, -1, 211, 60, 176, + -1, 49, 133, 57, -1, 49, 133, 60, 176, 57, + -1, 214, 215, -1, 217, -1, 215, 63, 176, 64, + -1, 63, 176, 64, -1, 34, 56, 176, 57, -1, + 10, -1, 10, -1 }; -#endif - -#if YYDEBUG -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const short yyrline[] = +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short yyrline[] = { - 0, 260, 267, 276, 292, 293, 296, 297, 298, 299, - 300, 301, 302, 305, 316, 320, 333, 356, 372, 373, - 375, 378, 379, 380, 383, 405, 407, 411, 417, 425, - 434, 441, 457, 477, 481, 482, 483, 486, 487, 490, - 505, 507, 509, 520, 527, 543, 546, 547, 550, 551, - 552, 555, 565, 575, 582, 591, 593, 597, 598, 601, - 602, 609, 612, 619, 626, 636, 649, 650, 653, 661, - 697, 701, 734, 736, 739, 756, 767, 782, 786, 798, - 800, 802, 804, 808, 810, 819, 823, 824, 825, 826, - 829, 837, 841, 845, 852, 856, 857, 858, 860, 865, - 867, 870, 871, 874, 875, 876, 877, 884, 885, 886, - 887, 888, 889, 890, 891, 894, 895, 896, 899, 926, - 928, 943, 957, 965, 976, 988, 1002, 1004, 1006, 1024, - 1028, 1032, 1036, 1050, 1051, 1054, 1057, 1059, 1063, 1083, - 1092, 1103, 1105, 1108, 1112, 1116, 1122, 1127, 1154, 1161, - 1170, 1176, 1180, 1184, 1194, 1200, 1213, 1215, 1225, 1232, - 1237, 1246, 1258, 1278, 1297, 1319, 1328, 1331, 1332, 1335, - 1351, 1353, 1360, 1375, 1377, 1379, 1382, 1390, 1391, 1394, - 1415, 1438, 1452, 1456, 1457, 1471, 1475, 1476, 1490, 1494, - 1495, 1512, 1516, 1517, 1518, 1519, 1520, 1521, 1524, 1525, - 1534, 1545, 1562, 1566, 1567, 1570, 1571, 1592, 1596, 1597, - 1598, 1601, 1602, 1610, 1618, 1620, 1633, 1634, 1646, 1658, - 1670, 1682, 1683, 1684, 1687, 1700, 1745, 1746, 1749, 1773, - 1774, 1777, 1778, 1781, 1792, 1793, 1794, 1795, 1796, 1799, - 1812, 1825, 1829, 1841, 1854, 1873, 1892, 1903, 1915, 1930, - 1941, 1950, 1961, 1975, 2000, 2013, 2043, 2053, 2065, 2072, - 2076 + 0, 260, 260, 267, 277, 292, 293, 296, 297, 298, + 299, 300, 301, 302, 305, 316, 321, 333, 356, 373, + 374, 376, 379, 380, 381, 384, 407, 409, 413, 419, + 427, 436, 443, 459, 479, 483, 484, 485, 488, 489, + 492, 507, 509, 511, 523, 530, 547, 550, 551, 554, + 555, 556, 560, 569, 579, 586, 595, 597, 601, 602, + 605, 606, 613, 616, 623, 630, 640, 653, 654, 657, + 665, 701, 705, 738, 740, 743, 760, 771, 786, 790, + 802, 804, 806, 808, 812, 814, 823, 827, 828, 829, + 830, 833, 841, 845, 849, 856, 860, 861, 862, 864, + 870, 871, 874, 876, 880, 881, 882, 883, 890, 891, + 892, 893, 894, 895, 896, 897, 900, 901, 902, 905, + 932, 934, 949, 963, 971, 982, 994, 1008, 1010, 1012, + 1030, 1034, 1038, 1042, 1056, 1057, 1060, 1063, 1065, 1069, + 1090, 1099, 1110, 1111, 1114, 1118, 1122, 1128, 1133, 1160, + 1167, 1176, 1183, 1186, 1190, 1200, 1206, 1220, 1221, 1231, + 1239, 1243, 1252, 1264, 1284, 1303, 1333, 1342, 1345, 1346, + 1349, 1365, 1367, 1374, 1390, 1393, 1394, 1398, 1406, 1407, + 1410, 1432, 1456, 1467, 1471, 1472, 1486, 1490, 1491, 1505, + 1509, 1510, 1527, 1531, 1532, 1533, 1534, 1535, 1536, 1539, + 1540, 1549, 1560, 1577, 1581, 1582, 1585, 1586, 1607, 1611, + 1612, 1613, 1616, 1617, 1625, 1633, 1635, 1648, 1649, 1661, + 1673, 1685, 1697, 1698, 1699, 1702, 1715, 1760, 1761, 1764, + 1788, 1789, 1792, 1793, 1796, 1807, 1808, 1809, 1810, 1811, + 1814, 1827, 1841, 1845, 1857, 1870, 1889, 1908, 1919, 1931, + 1946, 1957, 1966, 1977, 1991, 2016, 2029, 2059, 2069, 2081, + 2088, 2092 }; #endif - -#if (YYDEBUG) || defined YYERROR_VERBOSE - -/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ +#if YYDEBUG || YYERROR_VERBOSE +/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$", "error", "$undefined.", "UNSIGNED_INT", "STRING", "RAWSTRING", + "$end", "error", "$undefined", "UNSIGNED_INT", "STRING", "RAWSTRING", "STRINGCONCAT", "STRINGCOMPARE", "STRINGCOPY", "STRINGLENGTH", "IDENTIFIER", "CHARCON", "INCLUDE", "FNSTRING", "NE", "LE", "GE", "EQ", "OR", "AND", "PLPL", "MIMI", "IF", "ELSE", "SWITCH", "CASE", "DEFAULT", @@ -507,7 +743,7 @@ "BROADCAST", "EXTERN", "SSCANF", "SPRINTF", "LOWER_THAN_ELSE", "'#'", "'('", "')'", "'{'", "'}'", "','", "'&'", "';'", "'['", "']'", "'='", "'-'", "'+'", "':'", "'<'", "'>'", "'*'", "'/'", "'%'", "'!'", - "program", "init_outerscope", "outer_decls", "outer_decl", + "$accept", "program", "init_outerscope", "outer_decls", "outer_decl", "include_decl", "start_include", "opt_main_decl", "main_hdr", "opt_main_type", "compound_stmt", "function_decl", "func_proto", "func_hdr", "untyped_func_hdr", "typed_func_hdr", "function_id", @@ -545,572 +781,503 @@ }; #endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const short yyr1[] = +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 35, 40, 41, 123, 125, + 44, 38, 59, 91, 93, 61, 45, 43, 58, 60, + 62, 42, 47, 37, 33 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = { - 0, 75, 75, 76, 77, 77, 78, 78, 78, 78, - 78, 78, 78, 79, 80, 81, 81, 82, 83, 83, - 83, 84, 84, 84, 85, 86, 86, 87, 87, 88, - 89, 89, 90, 91, 92, 92, 92, 93, 93, 94, - 95, 95, 95, 96, 97, 98, 99, 99, 100, 100, - 100, 101, 101, 102, 103, 104, 104, 105, 105, 106, - 106, 107, 108, 108, 108, 108, 109, 109, 110, 110, - 110, 111, 112, 112, 113, 114, 114, 115, 116, 117, - 117, 117, 117, 118, 118, 119, 120, 120, 120, 120, - 121, 122, 123, 124, 125, 126, 126, 126, 126, 127, - 127, 128, 128, 129, 129, 129, 129, 129, 129, 129, - 129, 129, 129, 129, 129, 130, 130, 130, 131, 132, - 132, 133, 134, 135, 136, 136, 137, 137, 137, 138, - 139, 140, 141, 142, 142, 143, 144, 144, 145, 146, - 147, 148, 148, 149, 150, 151, 151, 151, 152, 153, - 154, 155, 156, 157, 158, 159, 160, 160, 161, 162, - 162, 163, 164, 165, 166, 167, 168, 169, 169, 170, - 170, 170, 171, 172, 173, 173, 174, 175, 175, 176, - 176, 177, 178, 179, 179, 180, 181, 181, 182, 183, - 183, 184, 185, 185, 185, 185, 185, 185, 186, 186, - 186, 186, 187, 188, 188, 189, 189, 190, 191, 191, - 191, 192, 192, 192, 192, 192, 193, 193, 193, 193, - 193, 193, 193, 193, 194, 195, 195, 195, 196, 197, - 197, 198, 198, 199, 200, 200, 200, 200, 200, 201, - 202, 202, 203, 204, 205, 206, 207, 207, 208, 209, - 210, 210, 211, 211, 212, 213, 214, 214, 215, 216, - 217 + 0, 75, 76, 76, 77, 78, 78, 79, 79, 79, + 79, 79, 79, 79, 80, 81, 82, 82, 83, 84, + 84, 84, 85, 85, 85, 86, 87, 87, 88, 88, + 89, 90, 90, 91, 92, 93, 93, 93, 94, 94, + 95, 96, 96, 96, 97, 98, 99, 100, 100, 101, + 101, 101, 102, 102, 103, 104, 105, 105, 106, 106, + 107, 107, 108, 109, 109, 109, 109, 110, 110, 111, + 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, + 118, 118, 118, 118, 119, 119, 120, 121, 121, 121, + 121, 122, 123, 124, 125, 126, 127, 127, 127, 127, + 128, 128, 129, 129, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 131, 131, 131, 132, + 133, 133, 134, 135, 136, 137, 137, 138, 138, 138, + 139, 140, 141, 142, 143, 143, 144, 145, 145, 146, + 147, 148, 149, 149, 150, 151, 152, 152, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 161, 162, + 163, 163, 164, 165, 166, 167, 168, 169, 170, 170, + 171, 171, 171, 172, 173, 174, 174, 175, 176, 176, + 177, 177, 178, 179, 180, 180, 181, 182, 182, 183, + 184, 184, 185, 186, 186, 186, 186, 186, 186, 187, + 187, 187, 187, 188, 189, 189, 190, 190, 191, 192, + 192, 192, 193, 193, 193, 193, 193, 194, 194, 194, + 194, 194, 194, 194, 194, 195, 196, 196, 196, 197, + 198, 198, 199, 199, 200, 201, 201, 201, 201, 201, + 202, 203, 203, 204, 205, 206, 207, 208, 208, 209, + 210, 211, 211, 212, 212, 213, 214, 215, 215, 216, + 217, 218 }; -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const short yyr2[] = +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const unsigned char yyr2[] = { - 0, 3, 2, 0, 1, 2, 1, 1, 1, 1, - 1, 1, 1, 2, 2, 0, 2, 4, 0, 1, - 1, 4, 3, 2, 2, 1, 2, 1, 1, 2, - 3, 3, 1, 3, 0, 1, 1, 1, 3, 2, - 1, 2, 1, 4, 2, 2, 1, 2, 1, 1, - 1, 0, 4, 1, 4, 2, 3, 1, 2, 1, - 1, 3, 1, 1, 4, 1, 1, 3, 1, 3, - 1, 2, 1, 2, 3, 4, 4, 1, 6, 1, - 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 1, 2, 2, 2, 1, 2, 2, 2, 0, - 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 6, 2, - 2, 2, 4, 5, 1, 3, 2, 4, 5, 4, - 1, 1, 4, 1, 2, 3, 1, 2, 4, 0, - 0, 0, 2, 2, 4, 3, 6, 6, 1, 3, - 1, 0, 1, 3, 3, 2, 0, 1, 1, 0, - 1, 1, 2, 2, 3, 1, 3, 2, 3, 1, - 1, 1, 4, 1, 0, 1, 2, 1, 1, 2, - 2, 2, 2, 1, 3, 1, 1, 3, 1, 1, - 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 2, 3, 1, 1, 1, 1, 3, 1, 1, 1, - 1, 1, 1, 1, 3, 2, 1, 2, 2, 2, - 2, 1, 1, 1, 1, 2, 1, 1, 1, 2, - 3, 3, 1, 1, 1, 1, 1, 1, 1, 3, - 3, 3, 1, 3, 3, 2, 3, 3, 4, 5, - 1, 3, 3, 5, 2, 1, 4, 3, 4, 1, - 1 + 0, 2, 3, 2, 0, 1, 2, 1, 1, 1, + 1, 1, 1, 1, 2, 2, 0, 2, 4, 0, + 1, 1, 4, 3, 2, 2, 1, 2, 1, 1, + 2, 3, 3, 1, 3, 0, 1, 1, 1, 3, + 2, 1, 2, 1, 4, 2, 2, 1, 2, 1, + 1, 1, 0, 4, 1, 4, 2, 3, 1, 2, + 1, 1, 3, 1, 1, 4, 1, 1, 3, 1, + 3, 1, 2, 1, 2, 3, 4, 4, 1, 6, + 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 1, 2, 2, 2, 1, 2, 2, 2, + 0, 1, 1, 3, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, + 2, 2, 2, 4, 5, 1, 3, 2, 4, 5, + 4, 1, 1, 4, 1, 2, 3, 1, 2, 4, + 0, 0, 0, 2, 2, 4, 3, 6, 6, 1, + 3, 1, 0, 1, 3, 3, 2, 0, 1, 1, + 0, 1, 1, 2, 2, 3, 1, 3, 2, 3, + 1, 1, 1, 4, 1, 0, 1, 2, 1, 1, + 2, 2, 2, 2, 1, 3, 1, 1, 3, 1, + 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 3, 1, 1, 1, 1, 3, 1, 1, + 1, 1, 1, 1, 1, 3, 2, 1, 2, 2, + 2, 2, 1, 1, 1, 1, 2, 1, 1, 1, + 2, 3, 3, 1, 1, 1, 1, 1, 1, 1, + 3, 3, 3, 1, 3, 3, 2, 3, 3, 4, + 5, 1, 3, 3, 5, 2, 1, 4, 3, 4, + 1, 1 }; -/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE - doesn't specify something else to do. Zero means the default is an - error. */ -static const short yydefact[] = -{ - 3, 15, 0, 32, 0, 77, 20, 19, 63, 0, - 0, 91, 0, 15, 4, 6, 0, 2, 0, 0, - 7, 0, 25, 27, 28, 0, 8, 0, 11, 0, - 9, 0, 10, 12, 86, 0, 87, 88, 89, 65, - 0, 259, 62, 0, 32, 0, 260, 44, 0, 26, - 0, 14, 5, 1, 13, 0, 16, 0, 24, 34, - 29, 0, 260, 0, 0, 66, 70, 68, 0, 32, - 0, 0, 94, 92, 93, 0, 85, 0, 83, 84, - 0, 30, 0, 0, 0, 0, 0, 213, 0, 0, - 0, 0, 148, 150, 0, 161, 62, 0, 0, 165, - 0, 0, 0, 0, 0, 0, 0, 0, 23, 173, - 0, 0, 0, 104, 0, 57, 59, 0, 212, 60, - 0, 95, 114, 115, 116, 117, 0, 103, 0, 0, - 105, 106, 0, 151, 156, 99, 0, 108, 109, 110, - 174, 111, 112, 113, 107, 0, 178, 0, 0, 177, - 0, 183, 0, 186, 0, 189, 0, 198, 0, 205, - 211, 216, 221, 0, 226, 234, 235, 236, 237, 238, - 0, 227, 222, 0, 223, 224, 0, 42, 35, 0, - 36, 37, 0, 40, 48, 0, 51, 46, 50, 49, - 31, 0, 61, 0, 0, 71, 72, 0, 0, 90, - 0, 64, 0, 98, 97, 0, 0, 0, 0, 0, - 245, 218, 224, 220, 0, 0, 155, 0, 162, 163, - 0, 0, 0, 0, 0, 121, 0, 0, 0, 0, - 224, 200, 222, 224, 199, 215, 58, 0, 22, 96, - 0, 130, 126, 0, 0, 0, 0, 0, 157, 0, - 100, 101, 0, 0, 175, 176, 179, 180, 0, 0, - 197, 195, 196, 192, 193, 194, 0, 204, 203, 0, - 208, 209, 210, 0, 217, 219, 0, 225, 0, 182, - 0, 254, 181, 17, 33, 0, 39, 41, 43, 53, - 47, 45, 0, 67, 0, 82, 0, 0, 69, 79, - 73, 76, 75, 0, 0, 0, 242, 120, 119, 0, - 239, 244, 243, 0, 0, 0, 0, 0, 171, 170, - 167, 169, 0, 166, 0, 0, 252, 0, 0, 0, - 214, 21, 0, 124, 131, 0, 139, 141, 133, 140, - 136, 0, 145, 0, 158, 159, 154, 0, 0, 164, - 184, 187, 190, 201, 206, 229, 233, 0, 232, 250, - 0, 0, 0, 38, 0, 74, 80, 81, 55, 54, - 0, 78, 0, 0, 247, 246, 129, 132, 258, 168, - 172, 0, 0, 0, 0, 122, 0, 127, 0, 0, - 134, 0, 0, 137, 0, 149, 152, 0, 160, 0, - 102, 144, 230, 0, 248, 0, 257, 0, 0, 56, - 240, 241, 0, 253, 249, 123, 125, 0, 143, 128, - 142, 135, 0, 0, 0, 231, 251, 256, 52, 118, - 138, 0, 146, 147, 153, 0, 0, 0 +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const unsigned short yydefact[] = +{ + 4, 0, 16, 1, 0, 33, 0, 78, 21, 20, + 64, 0, 0, 92, 0, 16, 5, 7, 0, 3, + 0, 0, 8, 0, 26, 28, 29, 0, 9, 0, + 12, 0, 10, 0, 11, 13, 87, 0, 88, 89, + 90, 66, 0, 260, 63, 0, 33, 0, 261, 45, + 0, 27, 0, 15, 6, 2, 14, 0, 17, 0, + 25, 35, 30, 0, 261, 0, 0, 67, 71, 69, + 0, 33, 0, 0, 95, 93, 94, 0, 86, 0, + 84, 85, 0, 31, 0, 0, 0, 0, 0, 214, + 0, 0, 0, 0, 149, 151, 0, 162, 63, 0, + 0, 166, 0, 0, 0, 0, 0, 0, 0, 0, + 24, 174, 0, 0, 0, 105, 0, 58, 60, 0, + 213, 61, 0, 96, 115, 116, 117, 118, 0, 104, + 0, 0, 106, 107, 0, 152, 157, 100, 0, 109, + 110, 111, 175, 112, 113, 114, 108, 0, 179, 0, + 0, 178, 0, 184, 0, 187, 0, 190, 0, 199, + 0, 206, 212, 217, 222, 0, 227, 235, 236, 237, + 238, 239, 0, 228, 223, 0, 224, 225, 0, 43, + 36, 0, 37, 38, 0, 41, 49, 0, 52, 47, + 51, 50, 32, 0, 62, 0, 0, 72, 73, 0, + 0, 91, 0, 65, 0, 99, 98, 0, 0, 0, + 0, 0, 246, 219, 225, 221, 0, 0, 156, 0, + 163, 164, 0, 0, 0, 0, 0, 122, 0, 0, + 0, 0, 225, 201, 223, 225, 200, 216, 59, 0, + 23, 97, 0, 131, 127, 0, 0, 0, 0, 0, + 158, 0, 101, 102, 0, 0, 176, 177, 180, 181, + 0, 0, 198, 196, 197, 193, 194, 195, 0, 205, + 204, 0, 209, 210, 211, 0, 218, 220, 0, 226, + 0, 183, 0, 255, 182, 18, 34, 0, 40, 42, + 44, 54, 48, 46, 0, 68, 0, 83, 0, 0, + 70, 80, 74, 77, 76, 0, 0, 0, 243, 121, + 120, 0, 240, 245, 244, 0, 0, 0, 0, 0, + 172, 171, 168, 170, 0, 167, 0, 0, 253, 0, + 0, 0, 215, 22, 0, 125, 132, 0, 140, 142, + 134, 141, 137, 0, 146, 0, 159, 160, 155, 0, + 0, 165, 185, 188, 191, 202, 207, 230, 234, 0, + 233, 251, 0, 0, 0, 39, 0, 75, 81, 82, + 56, 55, 0, 79, 0, 0, 248, 247, 130, 133, + 259, 169, 173, 0, 0, 0, 0, 123, 0, 128, + 0, 0, 135, 0, 0, 138, 0, 150, 153, 0, + 161, 0, 103, 145, 231, 0, 249, 0, 258, 0, + 0, 57, 241, 242, 0, 254, 250, 124, 126, 0, + 144, 129, 143, 136, 0, 0, 0, 232, 252, 257, + 53, 119, 139, 0, 147, 148, 154 }; +/* YYDEFGOTO[NTERM-NUM]. */ static const short yydefgoto[] = { - 435, 1, 13, 14, 15, 16, 17, 18, 19, 113, - 20, 21, 22, 23, 24, 25, 60, 179, 180, 181, - 182, 26, 27, 185, 186, 187, 291, 292, 72, 304, - 114, 115, 28, 29, 64, 65, 66, 195, 196, 30, - 31, 32, 298, 299, 118, 33, 34, 35, 36, 37, - 38, 120, 249, 250, 121, 122, 123, 206, 124, 125, - 126, 332, 127, 128, 242, 335, 129, 337, 338, 339, - 340, 388, 394, 391, 392, 130, 131, 132, 245, 133, - 246, 397, 423, 134, 135, 247, 345, 399, 136, 137, - 138, 139, 140, 141, 221, 320, 142, 143, 253, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 266, 155, 156, 269, 157, 158, 273, 159, 160, 161, - 162, 163, 277, 357, 358, 164, 165, 310, 308, 166, - 167, 168, 210, 169, 170, 360, 171, 172, 173, 281, - 174, 230, 67 + -1, 1, 2, 15, 16, 17, 18, 19, 20, 21, + 115, 22, 23, 24, 25, 26, 27, 62, 181, 182, + 183, 184, 28, 29, 187, 188, 189, 293, 294, 74, + 306, 116, 117, 30, 31, 66, 67, 68, 197, 198, + 32, 33, 34, 300, 301, 120, 35, 36, 37, 38, + 39, 40, 122, 251, 252, 123, 124, 125, 208, 126, + 127, 128, 334, 129, 130, 244, 337, 131, 339, 340, + 341, 342, 390, 396, 393, 394, 132, 133, 134, 247, + 135, 248, 399, 425, 136, 137, 249, 347, 401, 138, + 139, 140, 141, 142, 143, 223, 322, 144, 145, 255, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 268, 157, 158, 271, 159, 160, 275, 161, 162, + 163, 164, 165, 279, 359, 360, 166, 167, 312, 310, + 168, 169, 170, 212, 171, 172, 362, 173, 174, 175, + 283, 176, 232, 69 }; +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -303 static const short yypact[] = { - -32768, 1019, -40, 20, 223,-32768, 43, 54,-32768, 64, - 58,-32768, 72, 1019,-32768,-32768, 82,-32768, 41, 68, - -32768, 41,-32768,-32768,-32768, 91,-32768, 70,-32768, 145, - -32768, 223,-32768,-32768,-32768, 178,-32768,-32768,-32768,-32768, - 15,-32768,-32768, 64,-32768, 91,-32768,-32768, 43,-32768, - 43,-32768,-32768,-32768,-32768, 321,-32768, 103,-32768, 235, - -32768, 170, 107, 91, 44,-32768,-32768, 71, 64, 16, - 110, 141,-32768,-32768,-32768, 144,-32768, 150,-32768,-32768, - 154,-32768, -30, 168, 168, 168, 172,-32768, 216, 216, - 181, 193,-32768,-32768, 195,-32768, 197, 192, 201,-32768, - 194, 224, 168, 168, 172, 218, 219, 972,-32768,-32768, - 991, 991, 991,-32768, 390,-32768,-32768, 64,-32768,-32768, - 514,-32768,-32768,-32768,-32768,-32768, 217,-32768, 762, 222, - -32768,-32768, 220,-32768, 972, 972, 225,-32768,-32768,-32768, - 972,-32768,-32768,-32768,-32768, 226,-32768, 972, 972, 264, - 269, 271, 272,-32768, 31, 55, 84, 124, 159,-32768, - -32768, 96,-32768, 236,-32768,-32768,-32768,-32768,-32768,-32768, - 233,-32768, 229, 232,-32768, 10, 240, -40,-32768, 242, - 243,-32768, 64, 239,-32768, 247, 175,-32768,-32768,-32768, - -32768, 64,-32768, 15, 11, 144,-32768, 245, 114,-32768, - 231,-32768, 11,-32768,-32768, 851, 250, 250, 250, 921, - -32768,-32768,-32768,-32768, 972, 972,-32768, 972,-32768,-32768, - 832, 3, 972, 251, 26,-32768, 972, 972, 197, 255, - -7, 124,-32768, 33, 124,-32768,-32768, 576,-32768,-32768, - 972,-32768, 290, 289, 972, 762, 762, 256,-32768, 258, - 257,-32768, 452, 259,-32768,-32768,-32768,-32768, 972, 972, - -32768,-32768,-32768,-32768,-32768,-32768, 972,-32768,-32768, 991, - -32768,-32768,-32768, 991,-32768,-32768, 902,-32768, 972,-32768, - 972, 263,-32768,-32768,-32768, 238,-32768,-32768,-32768,-32768, - -32768,-32768, 275,-32768, 270,-32768, 15, 15,-32768,-32768, - -32768,-32768,-32768, 274, 119, 276,-32768,-32768,-32768, 851, - -32768,-32768,-32768, 280, 282, 283, 287, 295,-32768,-32768, - -32768,-32768, 832,-32768, 291, 972,-32768, 972, 301, 302, - -32768,-32768, 37,-32768,-32768, 762,-32768, 161,-32768, 289, - -32768, 307,-32768, 338,-32768, 972,-32768, 972, 638,-32768, - 271,-32768, 123, 124,-32768,-32768,-32768, 75,-32768,-32768, - 85, 303, 972,-32768, 452,-32768,-32768,-32768,-32768,-32768, - 304,-32768, 311, 318,-32768,-32768,-32768,-32768,-32768,-32768, - -32768, 319, 324, 373, 373,-32768, 972,-32768, 972, 314, - -32768, 325, 452,-32768, 452,-32768,-32768, 329, 257, 332, - -32768,-32768,-32768, 972,-32768, 972,-32768, 322, 700,-32768, - -32768,-32768, 328,-32768,-32768,-32768,-32768, 334,-32768,-32768, - 762, 762, 972, 330, 762,-32768,-32768,-32768,-32768,-32768, - -32768, 346,-32768,-32768,-32768, 404, 405,-32768 + -303, 32, 278, -303, -21, 45, 42, -303, 49, 78, + -303, 82, 191, -303, 85, 278, -303, -303, 123, -303, + 64, 96, -303, 64, -303, -303, -303, 99, -303, 118, + -303, 162, -303, 42, -303, -303, -303, 240, -303, -303, + -303, -303, 48, -303, -303, 82, -303, 99, -303, -303, + 49, -303, 49, -303, -303, -303, -303, 334, -303, 125, + -303, 293, -303, 387, 135, 99, 92, -303, -303, 129, + 82, 6, 122, 145, -303, -303, -303, 130, -303, 140, + -303, -303, 141, -303, 47, 158, 158, 158, 163, -303, + 217, 217, 177, 178, -303, -303, 183, -303, 185, 180, + 184, -303, 207, 205, 158, 158, 163, 193, 196, 934, + -303, -303, 985, 985, 985, -303, 403, -303, -303, 82, + -303, -303, 527, -303, -303, -303, -303, -303, 197, -303, + 775, 195, -303, -303, 208, -303, 934, 934, 209, -303, + -303, -303, 934, -303, -303, -303, -303, 201, -303, 934, + 934, 247, 248, 252, 253, -303, 147, 113, 1, 114, + 117, -303, -303, 84, -303, 221, -303, -303, -303, -303, + -303, -303, 218, -303, 215, 226, -303, 8, 233, -21, + -303, 234, 232, -303, 82, 238, -303, 236, 812, -303, + -303, -303, -303, 82, -303, 48, 12, 130, -303, 244, + 69, -303, 853, -303, 12, -303, -303, 845, 254, 254, + 254, 864, -303, -303, -303, -303, 934, 934, -303, 934, + -303, -303, 202, -6, 934, 256, 54, -303, 934, 934, + 185, 243, 24, 114, -303, -20, 114, -303, -303, 589, + -303, -303, 934, -303, 284, 294, 934, 775, 775, 262, + -303, 268, 274, -303, 465, 285, -303, -303, -303, -303, + 934, 934, -303, -303, -303, -303, -303, -303, 934, -303, + -303, 985, -303, -303, -303, 985, -303, -303, 915, -303, + 934, -303, 934, 273, -303, -303, -303, 91, -303, -303, + -303, -303, -303, -303, 288, -303, 286, -303, 48, 48, + -303, -303, -303, -303, -303, 287, 27, 289, -303, -303, + -303, 845, -303, -303, -303, 291, 295, 296, 300, 302, + -303, -303, -303, -303, 202, -303, 298, 934, -303, 934, + 305, 306, -303, -303, 61, -303, -303, 775, -303, 171, + -303, 294, -303, 310, -303, 347, -303, 934, -303, 934, + 651, -303, 252, -303, 50, 114, -303, -303, -303, 81, + -303, -303, 93, 311, 934, -303, 465, -303, -303, -303, + -303, -303, 315, -303, 321, 322, -303, -303, -303, -303, + -303, -303, -303, 323, 324, 383, 383, -303, 934, -303, + 934, 326, -303, 330, 465, -303, 465, -303, -303, 339, + 274, 341, -303, -303, -303, 934, -303, 934, -303, 335, + 713, -303, -303, -303, 340, -303, -303, -303, -303, 337, + -303, -303, 775, 775, 934, 353, 775, -303, -303, -303, + -303, -303, -303, 346, -303, -303, -303 }; +/* YYPGOTO[NTERM-NUM]. */ static const short yypgoto[] = { - -32768,-32768,-32768, 393,-32768,-32768, 394,-32768,-32768, 125, - -46, -33, 398,-32768,-32768, 32, -6,-32768,-32768, 128, - -32768,-32768, 374,-32768,-32768, 230,-32768,-32768,-32768,-32768, - -32768, 308, -11, 0,-32768, 244, -16,-32768, 228,-32768, - -32768, -45, 213, -35, -37, -38,-32768,-32768,-32768,-32768, - -32768, -108,-32768, 76, -119,-32768,-32768, 46,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 93,-32768, - 92,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768, 111,-32768,-32768,-32768,-32768, - -107,-32768,-32768,-32768,-32768,-32768, 176,-32768, 177,-32768, - -32768, 171,-32768,-32768, -99,-32768,-32768, -105,-32768, 104, - -32768,-32768,-32768,-32768, 42,-32768,-32768, 39, -296,-32768, - -32768,-32768, 340,-32768,-32768,-32768,-32768, -75,-32768,-32768, - -32768, 50, -1 + -303, -303, -303, -303, 401, -303, -303, 402, -303, -303, + 128, -53, -36, 407, -303, -303, 41, 0, -303, -303, + 139, -303, -303, 391, -303, -303, 241, -303, -303, -303, + -303, -303, 319, -13, -4, -303, 250, -16, -303, 239, + -303, -303, -49, 242, -37, -39, -31, -303, -303, -303, + -303, -303, -110, -303, 97, -105, -303, -303, -5, -303, + -303, -303, -303, -303, -303, -303, -303, -303, -303, 108, + -303, 107, -303, -303, -303, -303, -303, -303, -303, -303, + -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, + -303, -303, -303, -303, -303, -303, 126, -303, -303, -303, + -303, -109, -303, -303, -303, -303, -303, 189, -303, 199, + -303, -303, 190, -303, -303, -93, -303, -303, -107, -303, + 109, -303, -303, -303, -303, 52, -303, -303, 21, -302, + -303, -303, -303, 356, -303, -303, -303, -303, -101, -303, + -303, -303, 33, -7 }; - -#define YYLAST 1074 - - +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -262 static const short yytable[] = { - 229, 239, 70, 78, 43, 77, 237, 235, 47, 241, - 50, 231, 234, 373, 76, 184, 189, 119, 76, 74, - -65, 41, 295, 40, 73, 41, -259, 248, 251, 203, - -259, 68, 204, 254, 75, 232, 232, 232, 45, 81, - 256, 257, 80, 322, 116, 260, 261, 262, 263, -228, - 188, 39, 197, 44, 39, 117, -255, 190, 282, 183, - 39, 63, 2, 39, -62, 323, -228, 198, 3, -191, - -191, -191, -191, -255, 46, 282, 119, 296, 297, -260, - 45, 39, 63, 326, 51, 39, 327, 414, 415, -228, - 79, 48, 42, 8, 385, 54, -255, 386, 307, 55, - 264, 265, 314, 116, 191, 175, 192, 315, 316, 39, - 317, 39, 57, 321, 117, 324, 274, 275, 239, 328, - 329, -202, -202, 2, -191, -191, 342, 343, 61, 3, - 207, 208, 402, 333, 193, 403, 194, 341, 212, 212, - 184, 189, 404, 56, 348, 405, 58, 59, 223, 224, - 267, 268, 48, 42, 8, 62, 78, 78, 294, 176, - 233, 233, 233, -32, 175, 78, 10, 303, 354, 356, - 353, 359, 199, 361, 2, 188, 302, 193, 369, 2, - 3, 286, 2, 232, 232, 3, 336, 389, 69, -202, - -202, 232, 211, 213, 232, -207, -207, -207, 232, 200, - 50, 4, 372, 48, 42, 8, 4, 193, 48, 42, - 8, 48, 42, 8, 201, 321, 387, 10, 381, 202, - 382, 289, 10, 9, 205, 10, 41, 2, 209, 239, - 270, 271, 272, 41, 220, 2, 39, 214, 251, 177, - 400, 3, 177, 79, 79, 41, 311, 312, 41, 215, - 39, 216, 79, 217, 218, 407, 408, 42, 8, 78, - 78, 366, 367, 219, 48, 42, 8, 222, 178, 42, - 8, 370, 42, 8, 226, 227, 244, 240, 10, 416, - 243, 417, -185, 252, 420, 183, 421, 258, 255, 239, - -188, 259, 276, 278, 279, 280, 356, 283, 426, 284, - 287, 239, 239, 285, 50, 433, 288, 301, 233, 233, - 309, 325, 330, 334, 336, 431, 233, 347, 344, 233, - 346, 349, 82, 233, 76, 2, 362, 83, 84, 85, - 86, 41, 87, 364, 365, 39, 368, 374, 371, 375, - 376, 88, 89, 90, 377, 91, 79, 79, 92, 93, - 94, 95, 378, 380, 39, 96, 8, 97, 98, 99, - 100, 383, 384, 101, 395, 396, 409, 406, 410, 102, - 103, 104, 11, 105, 106, 411, 412, 107, 306, 55, - 108, 413, 418, 109, 419, 422, 427, 110, 111, 424, - 429, 82, 432, 76, 2, 112, 83, 84, 85, 86, - 41, 87, 430, 434, 436, 437, 52, 53, 49, 71, - 88, 89, 90, 363, 91, 305, 290, 92, 93, 94, - 95, 398, 236, 300, 96, 8, 97, 98, 99, 100, - 390, 393, 101, 379, 350, 293, 351, 352, 102, 103, - 104, 11, 105, 106, 225, 425, 107, 0, 55, 0, - 0, 0, 109, 82, 0, 76, 110, 111, 83, 84, - 85, 86, 41, 87, 112, 0, 0, 0, 0, 0, - 0, 0, 88, 89, 90, 0, 91, 0, 0, 92, - 93, 94, 95, 0, 0, 0, 228, 0, 97, 98, - 99, 100, 0, 0, 101, 0, 0, 0, 0, 0, - 102, 103, 104, 0, 105, 106, 0, 0, 107, 0, - 55, 0, 0, 0, 109, 0, 0, 76, 110, 111, - 83, 84, 85, 86, 41, 87, 112, 0, 0, 0, - 0, 0, 0, 0, 88, 89, 90, 0, 91, 0, - 0, 92, 93, 94, 95, 0, 0, 0, 228, 0, - 97, 98, 99, 100, 0, 0, 101, 0, 0, 0, - 0, 0, 102, 103, 104, 0, 105, 106, 0, 0, - 107, 0, 55, 238, 0, 0, 109, 0, 0, 76, - 110, 111, 83, 84, 85, 86, 41, 87, 112, 0, - 0, 0, 0, 0, 0, 0, 88, 89, 90, 0, - 91, 0, 0, 92, 93, 94, 95, 0, 0, 0, - 228, 0, 97, 98, 99, 100, 0, 0, 101, 0, - 0, 0, 0, 0, 102, 103, 104, 0, 105, 106, - 0, 0, 107, 0, 55, 331, 0, 0, 109, 0, - 0, 76, 110, 111, 83, 84, 85, 86, 41, 87, - 112, 0, 0, 0, 0, 0, 0, 0, 88, 89, - 90, 0, 91, 0, 0, 92, 93, 94, 95, 0, - 0, 0, 228, 0, 97, 98, 99, 100, 0, 0, - 101, 0, 0, 0, 0, 0, 102, 103, 104, 0, - 105, 106, 0, 0, 107, 0, 55, 401, 0, 0, - 109, 0, 0, 76, 110, 111, 83, 84, 85, 86, - 41, 87, 112, 0, 0, 0, 0, 0, 0, 0, - 88, 89, 90, 0, 91, 0, 0, 92, 93, 94, - 95, 0, 0, 0, 228, 0, 97, 98, 99, 100, - 0, 0, 101, 0, 0, 0, 0, 0, 102, 103, - 104, 0, 105, 106, 0, 0, 107, 0, 55, 428, - 0, 0, 109, 0, 0, 76, 110, 111, 83, 84, - 85, 86, 41, 87, 112, 0, 0, 0, 0, 0, - 0, 0, 88, 89, 90, 0, 91, 0, 0, 92, - 93, 94, 95, 0, 0, 0, 228, 0, 97, 98, - 99, 100, 0, 0, 101, 0, 0, 0, 0, 0, - 102, 103, 104, 0, 105, 106, 0, 0, 107, 0, - 55, 0, 0, 0, 109, 0, 0, 0, 110, 111, - 0, 0, 0, 0, 0, 76, 112, 318, 83, 84, - 85, 86, 41, 87, 0, 0, 0, 0, 0, 0, - 0, 0, 88, 89, 76, 0, 306, 83, 84, 85, - 86, 41, 87, 0, 0, 0, 228, 0, 0, 0, - 0, 88, 89, 319, 0, 0, 0, 0, 0, 0, - 0, 103, 0, 0, 105, 228, 0, 0, 107, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, - 103, 0, 0, 105, 0, 76, 112, 107, 83, 84, - 85, 86, 41, 87, 0, 0, 0, 110, 111, 0, - 0, 0, 88, 89, 76, 112, 313, 83, 84, 85, - 86, 41, 87, 0, 0, 0, 228, 0, 0, 0, - 0, 88, 89, 0, 0, 0, 0, 0, 0, 0, - 0, 103, 0, 0, 105, 228, 0, 0, 107, 355, - 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, - 103, 0, 0, 105, 0, 76, 112, 107, 83, 84, - 85, 86, 41, 87, 0, 0, 0, 110, 111, 0, - 0, 0, 88, 89, 76, 112, 0, 83, 84, 85, - 86, 41, 87, 0, 0, 0, 228, 0, 0, 0, - 0, 88, 89, 0, 0, 0, 0, 0, 0, 0, - 0, 103, 0, 2, 105, 228, 0, 0, 107, 3, - 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, - 103, 0, 0, 105, 0, 0, 112, 107, 0, 0, - 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, - 0, 0, 0, -18, 9, 112, 10, 0, 0, 0, - 11, 0, 0, 0, 12 + 231, 72, 45, 80, 49, 79, 239, 237, 52, 375, + 186, 234, 234, 234, 191, 78, -260, 241, -66, 233, + 236, 76, 43, 297, 75, 243, 121, 250, 253, 70, + 77, 4, 3, 256, 324, 41, -229, 5, 82, 41, + 258, 259, 42, -256, 118, 41, 4, 83, 41, 47, + 190, 78, 43, 119, 199, -260, 325, 185, 43, 46, + 50, 44, 10, 200, -229, 192, 41, 269, 270, -261, + 41, -256, 65, 284, 12, 81, 44, 10, 298, 299, + -229, 209, 210, 416, 417, 121, 371, -256, -63, 284, + 177, 47, 48, 65, 41, 179, 41, 53, 309, 225, + 226, 43, 316, 118, 276, 277, 205, 317, 318, 206, + 319, 328, 119, 323, 329, 326, -203, -203, 387, 330, + 331, 388, 57, 214, 214, 44, 10, -192, -192, -192, + -192, 304, 195, 335, 241, 186, 56, 343, 404, 191, + 59, 405, 344, 345, 350, 235, 235, 235, 58, 177, + 406, 60, 193, 407, 194, 61, 80, 80, 296, 234, + 234, 262, 263, 264, 265, 80, 305, 234, 356, 358, + 234, 361, 64, 363, 234, 190, 63, 288, 355, -203, + -203, 178, -192, -192, 201, -208, -208, -208, 272, 273, + 274, -33, 195, 195, 196, 4, 338, 391, 52, 213, + 215, 5, 374, 202, 203, 78, 204, 320, 85, 86, + 87, 88, 43, 89, 207, 323, 266, 267, 383, 211, + 384, 41, 90, 91, 50, 44, 10, 43, 81, 81, + 313, 314, 389, 216, 217, 41, 230, 81, 253, 218, + 402, 219, 220, 321, 4, 241, 221, 222, 224, 228, + 71, 105, 229, 245, 107, 409, 410, 242, 109, 80, + 80, 368, 369, 257, 246, -186, 260, 254, 112, 113, + 372, -189, 261, 50, 44, 10, 114, 278, 280, 418, + 281, 419, 4, 185, 422, 11, 423, 12, 5, 282, + 285, 286, 287, 235, 235, 290, 358, 179, 428, 289, + 332, 235, 52, 43, 235, 241, 303, 336, 235, 6, + 7, 8, 9, 10, 311, 433, 327, 241, 241, 338, + 41, 435, -19, 11, 346, 12, 180, 44, 10, 13, + 348, 81, 81, 14, 349, 84, 364, 78, 4, 41, + 85, 86, 87, 88, 43, 89, 366, 351, 376, 370, + 367, 373, 377, 378, 90, 91, 92, 379, 93, 380, + 382, 94, 95, 96, 97, 385, 386, 397, 98, 10, + 99, 100, 101, 102, 398, 408, 103, 411, 412, 413, + 414, 415, 104, 105, 106, 13, 107, 108, 308, 421, + 109, 4, 57, 110, 420, 424, 111, 5, 426, 429, + 112, 113, 431, 436, 84, 432, 78, 4, 114, 85, + 86, 87, 88, 43, 89, 434, 54, 55, 6, 51, + 50, 44, 10, 90, 91, 92, 365, 93, 73, 292, + 94, 95, 96, 97, 12, 238, 302, 98, 10, 99, + 100, 101, 102, 295, 400, 103, 307, 392, 395, 352, + 381, 104, 105, 106, 13, 107, 108, 427, 354, 109, + 353, 57, 227, 0, 0, 111, 84, 0, 78, 112, + 113, 85, 86, 87, 88, 43, 89, 114, 0, 0, + 0, 0, 0, 0, 0, 90, 91, 92, 0, 93, + 0, 0, 94, 95, 96, 97, 0, 0, 0, 230, + 0, 99, 100, 101, 102, 0, 0, 103, 0, 0, + 0, 0, 0, 104, 105, 106, 0, 107, 108, 0, + 0, 109, 0, 57, 0, 0, 0, 111, 0, 0, + 78, 112, 113, 85, 86, 87, 88, 43, 89, 114, + 0, 0, 0, 0, 0, 0, 0, 90, 91, 92, + 0, 93, 0, 0, 94, 95, 96, 97, 0, 0, + 0, 230, 0, 99, 100, 101, 102, 0, 0, 103, + 0, 0, 0, 0, 0, 104, 105, 106, 0, 107, + 108, 0, 0, 109, 0, 57, 240, 0, 0, 111, + 0, 0, 78, 112, 113, 85, 86, 87, 88, 43, + 89, 114, 0, 0, 0, 0, 0, 0, 0, 90, + 91, 92, 0, 93, 0, 0, 94, 95, 96, 97, + 0, 0, 0, 230, 0, 99, 100, 101, 102, 0, + 0, 103, 0, 0, 0, 0, 0, 104, 105, 106, + 0, 107, 108, 0, 0, 109, 0, 57, 333, 0, + 0, 111, 0, 0, 78, 112, 113, 85, 86, 87, + 88, 43, 89, 114, 0, 0, 0, 0, 0, 0, + 0, 90, 91, 92, 0, 93, 0, 0, 94, 95, + 96, 97, 0, 0, 0, 230, 0, 99, 100, 101, + 102, 0, 0, 103, 0, 0, 0, 0, 0, 104, + 105, 106, 0, 107, 108, 0, 0, 109, 0, 57, + 403, 0, 0, 111, 0, 0, 78, 112, 113, 85, + 86, 87, 88, 43, 89, 114, 0, 0, 0, 0, + 0, 0, 0, 90, 91, 92, 0, 93, 0, 0, + 94, 95, 96, 97, 0, 0, 0, 230, 0, 99, + 100, 101, 102, 0, 0, 103, 0, 0, 0, 0, + 0, 104, 105, 106, 0, 107, 108, 0, 0, 109, + 0, 57, 430, 0, 0, 111, 0, 0, 78, 112, + 113, 85, 86, 87, 88, 43, 89, 114, 0, 0, + 0, 0, 0, 0, 0, 90, 91, 92, 0, 93, + 0, 0, 94, 95, 96, 97, 0, 0, 0, 230, + 0, 99, 100, 101, 102, 0, 4, 103, 0, 0, + 0, 0, 5, 104, 105, 106, 0, 107, 108, 0, + 0, 109, 0, 57, 0, 0, 0, 111, 0, 0, + 0, 112, 113, 6, 0, 50, 44, 10, 78, 114, + 308, 85, 86, 87, 88, 43, 89, 4, 291, 12, + 0, 0, 0, 5, 0, 90, 91, 78, 0, 315, + 85, 86, 87, 88, 43, 89, 0, 0, 0, 230, + 0, 0, 0, 0, 90, 91, 50, 44, 10, 0, + 0, 0, 0, 0, 105, 0, 0, 107, 230, 0, + 12, 109, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 112, 113, 105, 0, 0, 107, 0, 78, 114, + 109, 85, 86, 87, 88, 43, 89, 0, 0, 0, + 112, 113, 0, 0, 0, 90, 91, 78, 114, 0, + 85, 86, 87, 88, 43, 89, 0, 0, 0, 230, + 0, 0, 0, 0, 90, 91, 0, 0, 0, 0, + 0, 0, 0, 0, 105, 0, 0, 107, 230, 0, + 0, 109, 357, 0, 0, 0, 0, 0, 0, 0, + 0, 112, 113, 105, 0, 0, 107, 0, 78, 114, + 109, 85, 86, 87, 88, 43, 89, 0, 0, 0, + 112, 113, 0, 0, 0, 90, 91, 0, 114, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 230, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 105, 0, 0, 107, 0, 0, + 0, 109, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 114 }; static const short yycheck[] = { - 107, 120, 35, 40, 4, 40, 114, 112, 9, 128, - 10, 110, 111, 309, 3, 61, 61, 55, 3, 35, - 10, 10, 11, 63, 35, 10, 10, 134, 135, 59, - 10, 31, 62, 140, 35, 110, 111, 112, 6, 45, - 147, 148, 43, 40, 55, 14, 15, 16, 17, 56, - 61, 1, 68, 10, 4, 55, 63, 63, 65, 59, - 10, 29, 4, 13, 10, 62, 56, 68, 10, 14, - 15, 16, 17, 63, 10, 65, 114, 66, 67, 63, - 48, 31, 50, 57, 12, 35, 60, 383, 384, 56, - 40, 33, 34, 35, 57, 13, 63, 60, 205, 58, - 69, 70, 209, 114, 60, 55, 62, 214, 215, 59, - 217, 61, 44, 220, 114, 222, 20, 21, 237, 226, - 227, 66, 67, 4, 69, 70, 245, 246, 58, 10, - 84, 85, 57, 240, 63, 60, 65, 244, 88, 89, - 186, 186, 57, 18, 252, 60, 21, 56, 102, 103, - 66, 67, 33, 34, 35, 10, 193, 194, 193, 56, - 110, 111, 112, 56, 114, 202, 47, 200, 273, 276, - 269, 278, 62, 280, 4, 186, 62, 63, 59, 4, - 10, 182, 4, 258, 259, 10, 25, 26, 10, 66, - 67, 266, 88, 89, 269, 71, 72, 73, 273, 58, - 200, 31, 309, 33, 34, 35, 31, 63, 33, 34, - 35, 33, 34, 35, 64, 322, 335, 47, 325, 65, - 327, 46, 47, 45, 56, 47, 10, 4, 56, 348, - 71, 72, 73, 10, 40, 4, 186, 56, 345, 4, - 347, 10, 4, 193, 194, 10, 207, 208, 10, 56, - 200, 56, 202, 56, 62, 362, 364, 34, 35, 296, - 297, 296, 297, 62, 33, 34, 35, 43, 33, 34, - 35, 304, 34, 35, 56, 56, 56, 60, 47, 386, - 58, 388, 18, 58, 392, 285, 394, 18, 62, 408, - 19, 19, 56, 60, 65, 63, 403, 57, 405, 57, - 61, 420, 421, 60, 304, 424, 59, 62, 258, 259, - 60, 60, 57, 23, 25, 422, 266, 60, 62, 269, - 62, 62, 1, 273, 3, 4, 63, 6, 7, 8, - 9, 10, 11, 58, 64, 285, 62, 57, 62, 57, - 57, 20, 21, 22, 57, 24, 296, 297, 27, 28, - 29, 30, 57, 62, 304, 34, 35, 36, 37, 38, - 39, 60, 60, 42, 57, 27, 62, 64, 57, 48, - 49, 50, 51, 52, 53, 57, 57, 56, 5, 58, - 59, 57, 68, 62, 59, 56, 64, 66, 67, 57, - 62, 1, 62, 3, 4, 74, 6, 7, 8, 9, - 10, 11, 68, 57, 0, 0, 13, 13, 10, 35, - 20, 21, 22, 285, 24, 202, 186, 27, 28, 29, - 30, 345, 114, 195, 34, 35, 36, 37, 38, 39, - 337, 339, 42, 322, 258, 191, 259, 266, 48, 49, - 50, 51, 52, 53, 104, 403, 56, -1, 58, -1, - -1, -1, 62, 1, -1, 3, 66, 67, 6, 7, - 8, 9, 10, 11, 74, -1, -1, -1, -1, -1, - -1, -1, 20, 21, 22, -1, 24, -1, -1, 27, - 28, 29, 30, -1, -1, -1, 34, -1, 36, 37, - 38, 39, -1, -1, 42, -1, -1, -1, -1, -1, - 48, 49, 50, -1, 52, 53, -1, -1, 56, -1, - 58, -1, -1, -1, 62, -1, -1, 3, 66, 67, - 6, 7, 8, 9, 10, 11, 74, -1, -1, -1, - -1, -1, -1, -1, 20, 21, 22, -1, 24, -1, - -1, 27, 28, 29, 30, -1, -1, -1, 34, -1, - 36, 37, 38, 39, -1, -1, 42, -1, -1, -1, - -1, -1, 48, 49, 50, -1, 52, 53, -1, -1, - 56, -1, 58, 59, -1, -1, 62, -1, -1, 3, - 66, 67, 6, 7, 8, 9, 10, 11, 74, -1, - -1, -1, -1, -1, -1, -1, 20, 21, 22, -1, - 24, -1, -1, 27, 28, 29, 30, -1, -1, -1, - 34, -1, 36, 37, 38, 39, -1, -1, 42, -1, - -1, -1, -1, -1, 48, 49, 50, -1, 52, 53, - -1, -1, 56, -1, 58, 59, -1, -1, 62, -1, - -1, 3, 66, 67, 6, 7, 8, 9, 10, 11, - 74, -1, -1, -1, -1, -1, -1, -1, 20, 21, - 22, -1, 24, -1, -1, 27, 28, 29, 30, -1, - -1, -1, 34, -1, 36, 37, 38, 39, -1, -1, - 42, -1, -1, -1, -1, -1, 48, 49, 50, -1, - 52, 53, -1, -1, 56, -1, 58, 59, -1, -1, - 62, -1, -1, 3, 66, 67, 6, 7, 8, 9, - 10, 11, 74, -1, -1, -1, -1, -1, -1, -1, - 20, 21, 22, -1, 24, -1, -1, 27, 28, 29, - 30, -1, -1, -1, 34, -1, 36, 37, 38, 39, - -1, -1, 42, -1, -1, -1, -1, -1, 48, 49, - 50, -1, 52, 53, -1, -1, 56, -1, 58, 59, - -1, -1, 62, -1, -1, 3, 66, 67, 6, 7, - 8, 9, 10, 11, 74, -1, -1, -1, -1, -1, - -1, -1, 20, 21, 22, -1, 24, -1, -1, 27, - 28, 29, 30, -1, -1, -1, 34, -1, 36, 37, - 38, 39, -1, -1, 42, -1, -1, -1, -1, -1, - 48, 49, 50, -1, 52, 53, -1, -1, 56, -1, - 58, -1, -1, -1, 62, -1, -1, -1, 66, 67, - -1, -1, -1, -1, -1, 3, 74, 5, 6, 7, - 8, 9, 10, 11, -1, -1, -1, -1, -1, -1, - -1, -1, 20, 21, 3, -1, 5, 6, 7, 8, - 9, 10, 11, -1, -1, -1, 34, -1, -1, -1, - -1, 20, 21, 41, -1, -1, -1, -1, -1, -1, - -1, 49, -1, -1, 52, 34, -1, -1, 56, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 66, 67, - 49, -1, -1, 52, -1, 3, 74, 56, 6, 7, - 8, 9, 10, 11, -1, -1, -1, 66, 67, -1, - -1, -1, 20, 21, 3, 74, 5, 6, 7, 8, - 9, 10, 11, -1, -1, -1, 34, -1, -1, -1, - -1, 20, 21, -1, -1, -1, -1, -1, -1, -1, - -1, 49, -1, -1, 52, 34, -1, -1, 56, 57, - -1, -1, -1, -1, -1, -1, -1, -1, 66, 67, - 49, -1, -1, 52, -1, 3, 74, 56, 6, 7, - 8, 9, 10, 11, -1, -1, -1, 66, 67, -1, - -1, -1, 20, 21, 3, 74, -1, 6, 7, 8, - 9, 10, 11, -1, -1, -1, 34, -1, -1, -1, - -1, 20, 21, -1, -1, -1, -1, -1, -1, -1, - -1, 49, -1, 4, 52, 34, -1, -1, 56, 10, - -1, -1, -1, -1, -1, -1, -1, -1, 66, 67, - 49, -1, -1, 52, -1, -1, 74, 56, -1, -1, - 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, - -1, -1, -1, 44, 45, 74, 47, -1, -1, -1, - 51, -1, -1, -1, 55 + 109, 37, 6, 42, 11, 42, 116, 114, 12, 311, + 63, 112, 113, 114, 63, 3, 10, 122, 10, 112, + 113, 37, 10, 11, 37, 130, 57, 136, 137, 33, + 37, 4, 0, 142, 40, 2, 56, 10, 45, 6, + 149, 150, 63, 63, 57, 12, 4, 47, 15, 8, + 63, 3, 10, 57, 70, 10, 62, 61, 10, 10, + 33, 34, 35, 70, 56, 65, 33, 66, 67, 63, + 37, 63, 31, 65, 47, 42, 34, 35, 66, 67, + 56, 86, 87, 385, 386, 116, 59, 63, 10, 65, + 57, 50, 10, 52, 61, 4, 63, 12, 207, 104, + 105, 10, 211, 116, 20, 21, 59, 216, 217, 62, + 219, 57, 116, 222, 60, 224, 66, 67, 57, 228, + 229, 60, 58, 90, 91, 34, 35, 14, 15, 16, + 17, 62, 63, 242, 239, 188, 13, 246, 57, 188, + 44, 60, 247, 248, 254, 112, 113, 114, 20, 116, + 57, 23, 60, 60, 62, 56, 195, 196, 195, 260, + 261, 14, 15, 16, 17, 204, 202, 268, 275, 278, + 271, 280, 10, 282, 275, 188, 58, 184, 271, 66, + 67, 56, 69, 70, 62, 71, 72, 73, 71, 72, + 73, 56, 63, 63, 65, 4, 25, 26, 202, 90, + 91, 10, 311, 58, 64, 3, 65, 5, 6, 7, + 8, 9, 10, 11, 56, 324, 69, 70, 327, 56, + 329, 188, 20, 21, 33, 34, 35, 10, 195, 196, + 209, 210, 337, 56, 56, 202, 34, 204, 347, 56, + 349, 56, 62, 41, 4, 350, 62, 40, 43, 56, + 10, 49, 56, 58, 52, 364, 366, 60, 56, 298, + 299, 298, 299, 62, 56, 18, 18, 58, 66, 67, + 306, 19, 19, 33, 34, 35, 74, 56, 60, 388, + 65, 390, 4, 287, 394, 45, 396, 47, 10, 63, + 57, 57, 60, 260, 261, 59, 405, 4, 407, 61, + 57, 268, 306, 10, 271, 410, 62, 23, 275, 31, + 32, 33, 34, 35, 60, 424, 60, 422, 423, 25, + 287, 426, 44, 45, 62, 47, 33, 34, 35, 51, + 62, 298, 299, 55, 60, 1, 63, 3, 4, 306, + 6, 7, 8, 9, 10, 11, 58, 62, 57, 62, + 64, 62, 57, 57, 20, 21, 22, 57, 24, 57, + 62, 27, 28, 29, 30, 60, 60, 57, 34, 35, + 36, 37, 38, 39, 27, 64, 42, 62, 57, 57, + 57, 57, 48, 49, 50, 51, 52, 53, 5, 59, + 56, 4, 58, 59, 68, 56, 62, 10, 57, 64, + 66, 67, 62, 57, 1, 68, 3, 4, 74, 6, + 7, 8, 9, 10, 11, 62, 15, 15, 31, 12, + 33, 34, 35, 20, 21, 22, 287, 24, 37, 188, + 27, 28, 29, 30, 47, 116, 197, 34, 35, 36, + 37, 38, 39, 193, 347, 42, 204, 339, 341, 260, + 324, 48, 49, 50, 51, 52, 53, 405, 268, 56, + 261, 58, 106, -1, -1, 62, 1, -1, 3, 66, + 67, 6, 7, 8, 9, 10, 11, 74, -1, -1, + -1, -1, -1, -1, -1, 20, 21, 22, -1, 24, + -1, -1, 27, 28, 29, 30, -1, -1, -1, 34, + -1, 36, 37, 38, 39, -1, -1, 42, -1, -1, + -1, -1, -1, 48, 49, 50, -1, 52, 53, -1, + -1, 56, -1, 58, -1, -1, -1, 62, -1, -1, + 3, 66, 67, 6, 7, 8, 9, 10, 11, 74, + -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, + -1, 24, -1, -1, 27, 28, 29, 30, -1, -1, + -1, 34, -1, 36, 37, 38, 39, -1, -1, 42, + -1, -1, -1, -1, -1, 48, 49, 50, -1, 52, + 53, -1, -1, 56, -1, 58, 59, -1, -1, 62, + -1, -1, 3, 66, 67, 6, 7, 8, 9, 10, + 11, 74, -1, -1, -1, -1, -1, -1, -1, 20, + 21, 22, -1, 24, -1, -1, 27, 28, 29, 30, + -1, -1, -1, 34, -1, 36, 37, 38, 39, -1, + -1, 42, -1, -1, -1, -1, -1, 48, 49, 50, + -1, 52, 53, -1, -1, 56, -1, 58, 59, -1, + -1, 62, -1, -1, 3, 66, 67, 6, 7, 8, + 9, 10, 11, 74, -1, -1, -1, -1, -1, -1, + -1, 20, 21, 22, -1, 24, -1, -1, 27, 28, + 29, 30, -1, -1, -1, 34, -1, 36, 37, 38, + 39, -1, -1, 42, -1, -1, -1, -1, -1, 48, + 49, 50, -1, 52, 53, -1, -1, 56, -1, 58, + 59, -1, -1, 62, -1, -1, 3, 66, 67, 6, + 7, 8, 9, 10, 11, 74, -1, -1, -1, -1, + -1, -1, -1, 20, 21, 22, -1, 24, -1, -1, + 27, 28, 29, 30, -1, -1, -1, 34, -1, 36, + 37, 38, 39, -1, -1, 42, -1, -1, -1, -1, + -1, 48, 49, 50, -1, 52, 53, -1, -1, 56, + -1, 58, 59, -1, -1, 62, -1, -1, 3, 66, + 67, 6, 7, 8, 9, 10, 11, 74, -1, -1, + -1, -1, -1, -1, -1, 20, 21, 22, -1, 24, + -1, -1, 27, 28, 29, 30, -1, -1, -1, 34, + -1, 36, 37, 38, 39, -1, 4, 42, -1, -1, + -1, -1, 10, 48, 49, 50, -1, 52, 53, -1, + -1, 56, -1, 58, -1, -1, -1, 62, -1, -1, + -1, 66, 67, 31, -1, 33, 34, 35, 3, 74, + 5, 6, 7, 8, 9, 10, 11, 4, 46, 47, + -1, -1, -1, 10, -1, 20, 21, 3, -1, 5, + 6, 7, 8, 9, 10, 11, -1, -1, -1, 34, + -1, -1, -1, -1, 20, 21, 33, 34, 35, -1, + -1, -1, -1, -1, 49, -1, -1, 52, 34, -1, + 47, 56, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 66, 67, 49, -1, -1, 52, -1, 3, 74, + 56, 6, 7, 8, 9, 10, 11, -1, -1, -1, + 66, 67, -1, -1, -1, 20, 21, 3, 74, -1, + 6, 7, 8, 9, 10, 11, -1, -1, -1, 34, + -1, -1, -1, -1, 20, 21, -1, -1, -1, -1, + -1, -1, -1, -1, 49, -1, -1, 52, 34, -1, + -1, 56, 57, -1, -1, -1, -1, -1, -1, -1, + -1, 66, 67, 49, -1, -1, 52, -1, 3, 74, + 56, 6, 7, 8, 9, 10, 11, -1, -1, -1, + 66, 67, -1, -1, -1, 20, 21, -1, 74, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 49, -1, -1, 52, -1, -1, + -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 74 }; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/bison/bison.simple" - -/* Skeleton output parser for bison, - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software - Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* This is the parser code that is written into each bison parser when - the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# else -# ifndef YYSTACK_USE_ALLOCA -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# endif -# endif -# endif -# endif -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -# define YYSTACK_ALLOC malloc -# define YYSTACK_FREE free -# endif -#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ - - -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - short yyss; - YYSTYPE yyvs; -# if YYLSP_NEEDED - YYLTYPE yyls; -# endif +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 76, 77, 0, 4, 10, 31, 32, 33, 34, + 35, 45, 47, 51, 55, 78, 79, 80, 81, 82, + 83, 84, 86, 87, 88, 89, 90, 91, 97, 98, + 108, 109, 115, 116, 117, 121, 122, 123, 124, 125, + 126, 217, 63, 10, 34, 109, 10, 91, 10, 218, + 33, 88, 109, 12, 79, 82, 13, 58, 85, 44, + 85, 56, 92, 58, 10, 91, 110, 111, 112, 218, + 109, 10, 87, 98, 104, 108, 112, 218, 3, 119, + 120, 217, 218, 92, 1, 6, 7, 8, 9, 11, + 20, 21, 22, 24, 27, 28, 29, 30, 34, 36, + 37, 38, 39, 42, 48, 49, 50, 52, 53, 56, + 59, 62, 66, 67, 74, 85, 106, 107, 108, 109, + 120, 121, 127, 130, 131, 132, 134, 135, 136, 138, + 139, 142, 151, 152, 153, 155, 159, 160, 164, 165, + 166, 167, 168, 169, 172, 173, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 187, 188, 190, + 191, 193, 194, 195, 196, 197, 201, 202, 205, 206, + 207, 209, 210, 212, 213, 214, 216, 217, 56, 4, + 33, 93, 94, 95, 96, 109, 86, 99, 100, 101, + 108, 117, 92, 60, 62, 63, 65, 113, 114, 112, + 218, 62, 58, 64, 65, 59, 62, 56, 133, 133, + 133, 56, 208, 195, 217, 195, 56, 56, 56, 56, + 62, 62, 40, 170, 43, 133, 133, 208, 56, 56, + 34, 176, 217, 190, 213, 217, 190, 193, 107, 127, + 59, 130, 60, 130, 140, 58, 56, 154, 156, 161, + 176, 128, 129, 176, 58, 174, 176, 62, 176, 176, + 18, 19, 14, 15, 16, 17, 69, 70, 186, 66, + 67, 189, 71, 72, 73, 192, 20, 21, 56, 198, + 60, 65, 63, 215, 65, 57, 57, 60, 218, 61, + 59, 46, 101, 102, 103, 111, 119, 11, 66, 67, + 118, 119, 114, 62, 62, 87, 105, 118, 5, 176, + 204, 60, 203, 203, 203, 5, 176, 176, 176, 176, + 5, 41, 171, 176, 40, 62, 176, 60, 57, 60, + 176, 176, 57, 59, 137, 176, 23, 141, 25, 143, + 144, 145, 146, 176, 130, 130, 62, 162, 62, 60, + 127, 62, 182, 184, 187, 190, 193, 57, 176, 199, + 200, 176, 211, 176, 63, 95, 58, 64, 119, 119, + 62, 59, 87, 62, 176, 204, 57, 57, 57, 57, + 57, 171, 62, 176, 176, 60, 60, 57, 60, 130, + 147, 26, 144, 149, 150, 146, 148, 57, 27, 157, + 129, 163, 176, 59, 57, 60, 57, 60, 64, 176, + 127, 62, 57, 57, 57, 57, 204, 204, 176, 176, + 68, 59, 127, 127, 56, 158, 57, 200, 176, 64, + 59, 62, 68, 176, 62, 130, 57 }; -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# if YYLSP_NEEDED -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ - + 2 * YYSTACK_GAP_MAX) -# else -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAX) -# endif - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - register YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (0) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - - #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ #endif @@ -1129,29 +1296,34 @@ #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 +#define YYEMPTY (-2) #define YYEOF 0 + #define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab +#define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 + /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ + #define YYFAIL goto yyerrlab + #define YYRECOVERING() (!!yyerrstatus) + #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ - yychar1 = YYTRANSLATE (yychar); \ + yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ - yyerror ("syntax error: cannot back up"); \ + yyerror ("syntax error: cannot back up");\ YYERROR; \ } \ while (0) @@ -1159,41 +1331,24 @@ #define YYTERROR 1 #define YYERRCODE 256 - /* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). - - When YYLLOC_DEFAULT is run, CURRENT is set the location of the - first token. By default, to implement support for ranges, extend - its range to the last symbol. */ + are run). */ #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - Current.last_line = Rhs[N].last_line; \ - Current.last_column = Rhs[N].last_column; +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + Current.first_line = Rhs[1].first_line; \ + Current.first_column = Rhs[1].first_column; \ + Current.last_line = Rhs[N].last_line; \ + Current.last_column = Rhs[N].last_column; #endif - /* YYLEX -- calling `yylex' with the right arguments. */ -#if YYPURE -# if YYLSP_NEEDED -# ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) -# else -# define YYLEX yylex (&yylval, &yylloc) -# endif -# else /* !YYLSP_NEEDED */ -# ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -# else -# define YYLEX yylex (&yylval) -# endif -# endif /* !YYLSP_NEEDED */ -#else /* !YYPURE */ -# define YYLEX yylex () -#endif /* !YYPURE */ - +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -1208,13 +1363,93 @@ if (yydebug) \ YYFPRINTF Args; \ } while (0) + +# define YYDSYMPRINT(Args) \ +do { \ + if (yydebug) \ + yysymprint Args; \ +} while (0) + +# define YYDSYMPRINTF(Title, Token, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Token, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (cinluded). | +`------------------------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_stack_print (short *bottom, short *top) +#else +static void +yy_stack_print (bottom, top) + short *bottom; + short *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; +#endif +{ + int yyi; + unsigned int yylineno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + yyrule - 1, yylineno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ +} while (0) + /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) +# define YYDSYMPRINT(Args) +# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ + /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 @@ -1234,8 +1469,10 @@ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif + -#ifdef YYERROR_VERBOSE + +#if YYERROR_VERBOSE # ifndef yystrlen # if defined (__GLIBC__) && defined (_STRING_H) @@ -1285,86 +1522,134 @@ } # endif # endif -#endif + +#endif /* !YYERROR_VERBOSE */ + -#line 315 "/usr/share/bison/bison.simple" +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) +#else +static void +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ + if (yytype < YYNTOKENS) + { + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); +# ifdef YYPRINT + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + } + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); +} + +#endif /* ! YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yydestruct (int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yytype, yyvaluep) + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM # if defined (__STDC__) || defined (__cplusplus) -# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -# define YYPARSE_PARAM_DECL +int yyparse (void *YYPARSE_PARAM); # else -# define YYPARSE_PARAM_ARG YYPARSE_PARAM -# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -# endif -#else /* !YYPARSE_PARAM */ -# define YYPARSE_PARAM_ARG -# define YYPARSE_PARAM_DECL -#endif /* !YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -# ifdef YYPARSE_PARAM -int yyparse (void *); -# else -int yyparse (void); +int yyparse (); # endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int yyparse (void); +#else +int yyparse (); #endif +#endif /* ! YYPARSE_PARAM */ -/* YY_DECL_VARIABLES -- depending whether we use a pure parser, - variables are global, or local to YYPARSE. */ -#define YY_DECL_NON_LSP_VARIABLES \ -/* The lookahead symbol. */ \ -int yychar; \ - \ -/* The semantic value of the lookahead symbol. */ \ -YYSTYPE yylval; \ - \ -/* Number of parse errors so far. */ \ -int yynerrs; -#if YYLSP_NEEDED -# define YY_DECL_VARIABLES \ -YY_DECL_NON_LSP_VARIABLES \ - \ -/* Location data for the lookahead symbol. */ \ -YYLTYPE yylloc; -#else -# define YY_DECL_VARIABLES \ -YY_DECL_NON_LSP_VARIABLES -#endif +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; -/* If nonreentrant, generate the variables here. */ -#if !YYPURE -YY_DECL_VARIABLES -#endif /* !YYPURE */ +/*----------. +| yyparse. | +`----------*/ +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) int -yyparse (YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL -{ - /* If reentrant, generate the variables here. */ -#if YYPURE - YY_DECL_VARIABLES -#endif /* !YYPURE */ +yyparse (void) +#else +int +yyparse () +#endif +#endif +{ + register int yystate; register int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Lookahead token as an internal (translated) token number. */ - int yychar1 = 0; + int yytoken = 0; /* Three stacks and their tools: `yyss': related to states, @@ -1374,7 +1659,7 @@ Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ - /* The state stack. */ + /* The state stack. */ short yyssa[YYINITDEPTH]; short *yyss = yyssa; register short *yyssp; @@ -1384,31 +1669,19 @@ YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; -#if YYLSP_NEEDED - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; -#endif -#if YYLSP_NEEDED -# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else -# define YYPOPSTACK (yyvsp--, yyssp--) -#endif - YYSIZE_T yystacksize = YYINITDEPTH; +#define YYPOPSTACK (yyvsp--, yyssp--) + YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; -#if YYLSP_NEEDED - YYLTYPE yyloc; -#endif + /* When reducing, the number of symbols on the RHS of the reduced - rule. */ + rule. */ int yylen; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1425,9 +1698,7 @@ yyssp = yyss; yyvsp = yyvs; -#if YYLSP_NEEDED - yylsp = yyls; -#endif + goto yysetstate; /*------------------------------------------------------------. @@ -1442,7 +1713,7 @@ yysetstate: *yyssp = yystate; - if (yyssp >= yyss + yystacksize - 1) + if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; @@ -1455,24 +1726,17 @@ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; + /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. */ -# if YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yyls1, yysize * sizeof (*yylsp), - &yystacksize); - yyls = yyls1; -# else + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); -# endif + yyss = yyss1; yyvs = yyvs1; } @@ -1481,10 +1745,10 @@ goto yyoverflowlab; # else /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) + if (YYMAXDEPTH <= yystacksize) goto yyoverflowlab; yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) + if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { @@ -1495,10 +1759,8 @@ goto yyoverflowlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); -# if YYLSP_NEEDED - YYSTACK_RELOCATE (yyls); -# endif -# undef YYSTACK_RELOCATE + +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } @@ -1507,14 +1769,12 @@ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; -#if YYLSP_NEEDED - yylsp = yyls + yysize - 1; -#endif + YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); - if (yyssp >= yyss + yystacksize - 1) + if (yyss + yystacksize - 1 <= yyssp) YYABORT; } @@ -1522,7 +1782,6 @@ goto yybackup; - /*-----------. | yybackup. | `-----------*/ @@ -1535,88 +1794,55 @@ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYFLAG) + if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ + if (yychar <= YYEOF) { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - + yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - yychar1 = YYTRANSLATE (yychar); - -#if YYDEBUG - /* We have to keep this `#if YYDEBUG', since we use variables - which are defined only if `YYDEBUG' is set. */ - if (yydebug) - { - YYFPRINTF (stderr, "Next token is %d (%s", - yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise - meaning of a token, for further debugging info. */ -# ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -# endif - YYFPRINTF (stderr, ")\n"); - } -#endif + yytoken = YYTRANSLATE (yychar); + YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); } - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) + if (yyn <= 0) { - if (yyn == YYFLAG) + if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } - else if (yyn == 0) - goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %d (%s), ", - yychar, yytname[yychar1])); + YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; -#if YYLSP_NEEDED - *++yylsp = yylloc; -#endif + /* Count tokens shifted since error; after three, turn off error status. */ @@ -1647,60 +1873,40 @@ /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. - Otherwise, the following line sets YYVAL to the semantic value of - the lookahead token. This behavior is undocumented and Bison + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; -#if YYLSP_NEEDED - /* Similarly for the default location. Let the user run additional - commands if for instance locations are ranges. */ - yyloc = yylsp[1-yylen]; - YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); -#endif - -#if YYDEBUG - /* We have to keep this `#if YYDEBUG', since we use variables which - are defined only if `YYDEBUG' is set. */ - if (yydebug) - { - int yyi; - - YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) - YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); - YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif - - switch (yyn) { -case 1: + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: #line 261 "bac.y" -{ + { if (!making_objfile&&!main_declared) yyerror("No 'main' function declared"); if (main_declared) emit(SHORTRET); } break; -case 2: + + case 3: #line 268 "bac.y" -{ + { if (!making_objfile&&!main_declared) yyerror("No 'main' function declared"); if (main_declared) emit(SHORTRET); } break; -case 3: + + case 4: #line 277 "bac.y" -{ + { level = 0; extern_decl = 0; enter(outerblock_name,outerblock,level,level); @@ -1714,9 +1920,10 @@ display[last_btab] = level; } break; -case 13: + + case 14: #line 306 "bac.y" -{ + { if (strcmp(laststring,infile[curr_infile].fname) == 0) yyerror("Recursive file inclusion"); else { @@ -1725,13 +1932,15 @@ in_include = 0; } break; -case 14: + + case 15: #line 317 "bac.y" -{ in_include = 1; } + { in_include = 1; } break; -case 15: + + case 16: #line 321 "bac.y" -{ int i; + { int i; tab[ob_tix].adr = lc; /* outerblock entry pt */ for (i = 0; i <= mon; i++){ /* don't emit CALL_MONINIT for ext_monitor objects */ @@ -1744,9 +1953,10 @@ process_var_inits(level); } break; -case 16: + + case 17: #line 334 "bac.y" -{ + { int i; emit(HALT); btab[tab[yyvsp[-1]].ref].last = last_tab; /* set last var ref in main */ @@ -1766,14 +1976,16 @@ process_var_inits(level-1); /* outer block variables, too */ } break; -case 17: + + case 18: #line 357 "bac.y" -{ + { extern_decl = 0; enter("main",mainproc,level,level); prt = last_tab; enter_block(&last_btab,&level,last_tab); btab[last_btab].lastpar = last_tab; /* no parms */ + if (maxlevel < level) maxlevel = level; main_declared = 1; yyval = prt; btab[0].lastpar = prt; /* save main's tabix for the interp */ @@ -1782,16 +1994,19 @@ emit(SHORTCALL); /* will have to backpatch addr later */ } break; -case 19: -#line 374 "bac.y" -{ yyval = int_loc; } + + case 20: +#line 375 "bac.y" + { yyval = int_loc; } break; -case 24: -#line 384 "bac.y" -{ + + case 25: +#line 385 "bac.y" + { if (main_declared) yyerror("main() proc must be last"); if (void_function) { + if (curr_ret >= 0) process_returns(); if (tab[yyvsp[-1]].mon) emit(EXITMON); emit(EXIT_PROC); } @@ -1808,51 +2023,58 @@ curr_ret = -1; } break; -case 25: -#line 406 "bac.y" -{ tab[yyvsp[0]].atomic = 0; } - break; -case 26: + + case 26: #line 408 "bac.y" -{ tab[yyvsp[0]].atomic = 1; yyval = yyvsp[0]; } + { tab[yyvsp[0]].atomic = 0; } break; -case 27: -#line 412 "bac.y" -{ + + case 27: +#line 410 "bac.y" + { tab[yyvsp[0]].atomic = 1; yyval = yyvsp[0]; } + break; + + case 28: +#line 414 "bac.y" + { btab[display[level]].psize = curr_parm_offset; btab[display[level]].vsize = curr_parm_offset + delta_vsize; in_func_decl = 1; } break; -case 28: -#line 418 "bac.y" -{ + + case 29: +#line 420 "bac.y" + { btab[display[level]].psize = curr_parm_offset; btab[display[level]].vsize = curr_parm_offset + delta_vsize; in_func_decl = 1; } break; -case 29: -#line 426 "bac.y" -{ + + case 30: +#line 428 "bac.y" + { tab[yyvsp[-1]].typ = ints; cnonfatal("Type of function %s defaults to int",tab[yyvsp[-1]].name); tab[yyvsp[0]].obj = (extern_decl ? ext_function : function ); void_function = 0; } break; -case 30: -#line 435 "bac.y" -{ + + case 31: +#line 437 "bac.y" + { tab[yyvsp[-1]].typ = notyp; tab[yyvsp[-1]].obj = (extern_decl ? ext_procedure : procedure); yyval = yyvsp[-1]; void_function = 1; } break; -case 31: -#line 442 "bac.y" -{ + + case 32: +#line 444 "bac.y" + { if ((tab[yyvsp[-2]].typ != ints)&&(tab[yyvsp[-2]].typ != chars)){ sprintf(pbuf,"'%s' is not a valid function return type", tab[yyvsp[-2]].name); @@ -1866,9 +2088,10 @@ void_function = 0; } break; -case 32: -#line 458 "bac.y" -{ int vis_level,real_level; + + case 33: +#line 460 "bac.y" + { int vis_level,real_level; if (in_mon_decl) { real_level = level; vis_level = ((level > 0) ? level -1 : 0); @@ -1877,22 +2100,24 @@ vis_level = real_level = level; } yyval = prt = enter(lastident(),function,real_level,vis_level); - func_tab = prt; if (in_mon_decl) tab[prt].mon = mtab[mon] - last_predeclared; enter_block(&last_btab,&level,prt); + if (maxlevel < level) maxlevel = level; curr_parm_offset = btab[display[level]].vsize; delta_vsize = curr_parm_offset - btab[display[level]].psize; tab[yyval].adr = (extern_decl ? -1 : lc); if (in_mon_decl&&!extern_decl) emit1(ENTERMON,tab[prt].mon); } break; -case 33: -#line 478 "bac.y" -{ btab[display[level]].lastpar = last_tab;} + + case 34: +#line 480 "bac.y" + { btab[display[level]].lastpar = last_tab;} break; -case 39: -#line 491 "bac.y" -{ + + case 40: +#line 493 "bac.y" + { tab[yyvsp[0]].typ = elem_typ; tab[yyvsp[0]].ref = elem_ref; tab[yyvsp[0]].obj = variable; @@ -1905,34 +2130,40 @@ curr_parm_offset++; /* pointers occupy 1 stack word */ } break; -case 40: -#line 506 "bac.y" -{ by_value = 1; } - break; -case 41: + + case 41: #line 508 "bac.y" -{ by_value = 0; } + { by_value = 1; } break; -case 42: + + case 42: #line 510 "bac.y" -{ /* allow strings of indefinite length */ + { by_value = 0; } + break; + + case 43: +#line 512 "bac.y" + { /* allow strings of indefinite length */ elem_ref = 0; elem_size = 1; /* a pointer */ elem_typ = strings; - elem_tix = -1; + elem_tix = -1; /* not in symbol table */ by_value = 0; /* pass-by-reference */ + yyval = -1; /* not in symbol table */ } break; -case 43: -#line 521 "bac.y" -{ + + case 44: +#line 524 "bac.y" + { leave_block(&level); in_mon_decl = 0; } break; -case 44: -#line 528 "bac.y" -{ + + case 45: +#line 531 "bac.y" + { if (mon == MAXMON) cfatal("No more than %d monitors can be declared",MAXMON); tab[yyvsp[0]].obj = (extern_decl ? ext_monitor : monitor); @@ -1943,11 +2174,13 @@ yyerror("Monitors can only be declared at the global level"); enter_block(&last_btab,&level,last_tab); btab[last_btab].lastpar = last_tab; /* no parms */ + if (maxlevel < level) maxlevel = level; } break; -case 51: -#line 556 "bac.y" -{ + + case 52: +#line 560 "bac.y" + { if (tab[mtab[mon]].obj == monitor) { /* don't do the following for ext_monitor objects */ tab[mtab[mon]].adr = lc; /* addr of monitor init code */ @@ -1957,9 +2190,10 @@ } } break; -case 52: -#line 566 "bac.y" -{ + + case 53: +#line 570 "bac.y" + { if (tab[mtab[mon]].obj == monitor) { /* don't do the following for ext_monitor objects */ /* main pgm will CALL_MONINIT, even if no init code */ @@ -1967,58 +2201,66 @@ } } break; -case 53: -#line 576 "bac.y" -{ + + case 54: +#line 580 "bac.y" + { tab[mtab[mon]].adr = lc; /* addr of monitor init code */ process_var_inits(level); } break; -case 54: -#line 583 "bac.y" -{ + + case 55: +#line 587 "bac.y" + { leave_block(&level); tab[yyvsp[-3]].adr = -1; extern_decl = 0; in_mon_decl = 0; } break; -case 55: -#line 592 "bac.y" -{ leave_block(&level); } - break; -case 56: -#line 594 "bac.y" -{ leave_block(&level); } + + case 56: +#line 596 "bac.y" + { leave_block(&level); } break; -case 60: -#line 603 "bac.y" -{ + + case 57: +#line 598 "bac.y" + { leave_block(&level); } + break; + + case 61: +#line 607 "bac.y" + { if (level > 0) yyerror("Externals must be declared at the outer (global) level"); } break; -case 62: -#line 613 "bac.y" -{ + + case 63: +#line 617 "bac.y" + { yyval = elem_tix = int_loc; elem_size = stacksize(tab[int_loc].adr); /* tab has byte size */ elem_typ = tab[int_loc].typ; elem_ref = tab[int_loc].ref; } break; -case 63: -#line 620 "bac.y" -{ + + case 64: +#line 624 "bac.y" + { yyval = elem_tix = char_loc; elem_size = stacksize(tab[char_loc].adr); elem_typ = tab[char_loc].typ; elem_ref = tab[char_loc].ref; } break; -case 64: -#line 627 "bac.y" -{ + + case 65: +#line 631 "bac.y" + { if (yyvsp[-1] <= 0) yyerror("A string of non-positive length is not valid"); else { @@ -2028,9 +2270,10 @@ } } break; -case 65: -#line 637 "bac.y" -{ + + case 66: +#line 641 "bac.y" + { if (tab[yyvsp[0]].obj != type){ sprintf(pbuf,"'%s' is not a valid type",tab[yyvsp[0]].name); yyerror(pbuf); @@ -2041,9 +2284,10 @@ elem_tix = yyvsp[0]; } break; -case 68: -#line 654 "bac.y" -{ + + case 69: +#line 658 "bac.y" + { tab[yyvsp[0]].typ = elem_typ; tab[yyvsp[0]].obj = (extern_decl ? ext_variable : variable); tab[yyvsp[0]].ref = elem_ref; @@ -2051,9 +2295,10 @@ btab[display[level]].vsize += elem_size; } break; -case 69: -#line 662 "bac.y" -{ + + case 70: +#line 666 "bac.y" + { if (extern_decl) yyerror("External variables cannot be initialized"); else { @@ -2089,13 +2334,15 @@ } /* else not extern */ } break; -case 70: -#line 698 "bac.y" -{ in_typedef = 0; } - break; -case 71: + + case 71: #line 702 "bac.y" -{ + { in_typedef = 0; } + break; + + case 72: +#line 706 "bac.y" + { int i; TYPES eltyp; int elsize,elref; @@ -2126,13 +2373,15 @@ array_defined = yyvsp[-1]; } break; -case 72: -#line 735 "bac.y" -{ yyval = yyvsp[0]; /* only want to pass on atab index for first dim */} + + case 73: +#line 739 "bac.y" + { yyval = yyvsp[0]; /* only want to pass on atab index for first dim */} break; -case 74: -#line 740 "bac.y" -{ + + case 75: +#line 744 "bac.y" + { if (last_atab == AMAX) cfatal("Array table full with %d entries",AMAX); atab[++last_atab].inxtyp = consttype; @@ -2147,9 +2396,10 @@ yyval = last_atab; /* pass array tab index up the parse tree */ } break; -case 75: -#line 757 "bac.y" -{ + + case 76: +#line 761 "bac.y" + { yyval = yyvsp[-1]; if (yyvsp[-1] > 0) { tab[yyvsp[-1]].obj = type; @@ -2160,9 +2410,10 @@ in_typedef = 0; } break; -case 76: -#line 768 "bac.y" -{ + + case 77: +#line 772 "bac.y" + { yyval = array_defined; if (array_defined > 0) { tab[array_defined].obj = type; @@ -2175,13 +2426,15 @@ in_typedef = 0; } break; -case 77: -#line 783 "bac.y" -{ in_typedef = 1; } - break; -case 78: + + case 78: #line 787 "bac.y" -{ + { in_typedef = 1; } + break; + + case 79: +#line 791 "bac.y" + { if ((tab[yyvsp[-4]].typ != ints)&&(tab[yyvsp[-4]].typ != chars)) yyerror("Constants must be of type 'int' or 'char'"); else { @@ -2191,90 +2444,117 @@ } } break; -case 79: -#line 799 "bac.y" -{ yyval = yyvsp[0]; } - break; -case 80: -#line 801 "bac.y" -{ yyval = - yyvsp[0]; } - break; -case 81: + + case 80: #line 803 "bac.y" -{ yyval = yyvsp[0]; } + { yyval = yyvsp[0]; } break; -case 82: + + case 81: #line 805 "bac.y" -{ consttype = chars; yyval = laststring[0]; } + { yyval = - yyvsp[0]; } + break; + + case 82: +#line 807 "bac.y" + { yyval = yyvsp[0]; } break; -case 83: + + case 83: #line 809 "bac.y" -{ consttype = ints; } + { consttype = chars; yyval = laststring[0]; } break; -case 84: -#line 811 "bac.y" -{ yyval = get_constant(tab[yyvsp[0]].name,level,&consttype); + + case 84: +#line 813 "bac.y" + { consttype = ints; } + break; + + case 85: +#line 815 "bac.y" + { yyval = get_constant(tab[yyvsp[0]].name,level,&consttype); if ((consttype != ints)&&(consttype != chars)) { yyerror("'int' or 'char' type expected"); consttype = notyp; } } break; -case 85: -#line 820 "bac.y" -{ yyval = strtoi(numbertext,numberbase); } + + case 86: +#line 824 "bac.y" + { yyval = strtoi(numbertext,numberbase); } break; -case 90: -#line 830 "bac.y" -{ + + case 91: +#line 834 "bac.y" + { leave_block(&level); in_func_decl = 0; extern_decl = 0; } break; -case 91: -#line 838 "bac.y" -{ extern_decl = 1; } - break; -case 92: + + case 92: #line 842 "bac.y" -{ extern_decl = 0; } + { extern_decl = 1; } break; -case 93: + + case 93: #line 846 "bac.y" -{ + { extern_decl = 0; } + break; + + case 94: +#line 850 "bac.y" + { extern_decl = 0; in_typedef = 0; } break; -case 94: -#line 853 "bac.y" -{ extern_decl = 0; } - break; -case 97: -#line 859 "bac.y" -{ yyerrok; } - break; -case 98: -#line 861 "bac.y" -{ yyerrok; } - break; -case 99: -#line 866 "bac.y" -{ yyval = -1; /* send back news that expr_list was empty */ } + + case 95: +#line 857 "bac.y" + { extern_decl = 0; } break; -case 106: -#line 878 "bac.y" -{ + + case 98: +#line 863 "bac.y" + { yyerrok; } + break; + + case 99: +#line 865 "bac.y" + { yyerrok; } + break; + + case 100: +#line 870 "bac.y" + { yyval = -1; /* send back news that expr_list was empty */ } + break; + + case 102: +#line 875 "bac.y" + { free_expr(yyvsp[0]); } + break; + + case 103: +#line 877 "bac.y" + { free_expr(yyvsp[0]); } + break; + + case 107: +#line 884 "bac.y" + { process_breaks(); /* continue loc is passed back on the value stack */ process_continues(yyvsp[0]); leave_break_block(&break_level,&curr_break,&curr_cont); } break; -case 118: -#line 900 "bac.y" -{ + + case 119: +#line 906 "bac.y" + { yyval = new_expr(); expr[yyval].obj = function; expr[yyval].typ = ints; @@ -2299,13 +2579,15 @@ free_expr(yyvsp[-4]); free_expr(yyvsp[-2]); } break; -case 119: -#line 927 "bac.y" -{ yyval = yyvsp[0]; } + + case 120: +#line 933 "bac.y" + { yyval = yyvsp[0]; } break; -case 120: -#line 929 "bac.y" -{ + + case 121: +#line 935 "bac.y" + { if (expr[yyvsp[0]].typ == strings) { /* left parm is a string. If it's not an array elt, */ /* put the address of the string n the stack */ @@ -2317,9 +2599,10 @@ yyval = yyvsp[0]; } break; -case 121: -#line 944 "bac.y" -{ + + case 122: +#line 950 "bac.y" + { if (expr[yyvsp[0]].typ == rawstrings) /* raw str message */ emit1(BROADCAST_RAWSTRING,expr[yyvsp[0]].adr); else if (expr[yyvsp[0]].typ == strings) /* msg is a string var */ @@ -2331,17 +2614,19 @@ free_expr(yyvsp[0]); } break; -case 122: -#line 958 "bac.y" -{ + + case 123: +#line 964 "bac.y" + { /* push the parm count for interp's SPRINTF_OP to use */ emit1(PUSH_LIT,varargs_cnt); emit1(SPRINTF_OP,yyvsp[-3]); } break; -case 123: -#line 966 "bac.y" -{ + + case 124: +#line 972 "bac.y" + { if (expr[yyvsp[-2]].typ != strings) yyerror("Leftmost sprintf parameter must be of type 'string'"); yyval = expr[yyvsp[0]].adr; /* pass raw string index up the tree */ @@ -2350,9 +2635,10 @@ varargs_cnt = 0; } break; -case 124: -#line 977 "bac.y" -{ + + case 125: +#line 983 "bac.y" + { if ((expr[yyvsp[0]].typ != ints)&&(expr[yyvsp[0]].typ != strings)) yyerror( "sprintf parameter must be either of type 'int' or type 'string'"); @@ -2364,9 +2650,10 @@ free_expr(yyvsp[0]); } break; -case 125: -#line 989 "bac.y" -{ + + case 126: +#line 995 "bac.y" + { if ((expr[yyvsp[0]].typ != ints)&&(expr[yyvsp[0]].typ != strings)) yyerror( "sprintf parameter must be either of type 'int' or type 'string'"); @@ -2378,17 +2665,20 @@ free_expr(yyvsp[0]); } break; -case 126: -#line 1003 "bac.y" -{ code[yyvsp[-1]].y = yyvsp[0]; } - break; -case 127: -#line 1005 "bac.y" -{ code[yyvsp[-3]].y = yyvsp[-1]; code[yyvsp[-2]].y = lc; } - break; -case 128: -#line 1007 "bac.y" -{ int i; + + case 127: +#line 1009 "bac.y" + { code[yyvsp[-1]].y = yyvsp[0]; } + break; + + case 128: +#line 1011 "bac.y" + { code[yyvsp[-3]].y = yyvsp[-1]; code[yyvsp[-2]].y = lc; } + break; + + case 129: +#line 1013 "bac.y" + { int i; /* switch_level is incremented in switch_hdr rule */ /* grammar also forces at least one case in every switch */ i = case_loc[curr_case]; @@ -2398,27 +2688,31 @@ /* the current case of the enclosing switch block is one */ /* less than the first case of this block */ curr_case = switch_block[switch_level].first_case - 1; + free_expr(switch_block[switch_level].expr_index); switch_level--; process_breaks(); leave_break_block(&break_level,&curr_break,&curr_cont); - free_expr(yyvsp[-4]); } break; -case 129: -#line 1025 "bac.y" -{ gen_exprval(yyvsp[-1]); yyval = lc; emit(JZER); free_expr(yyvsp[-1]); } + + case 130: +#line 1031 "bac.y" + { gen_exprval(yyvsp[-1]); yyval = lc; emit(JZER); free_expr(yyvsp[-1]); } break; -case 130: -#line 1029 "bac.y" -{ yyval = lc; } + + case 131: +#line 1035 "bac.y" + { yyval = lc; } break; -case 131: -#line 1033 "bac.y" -{ emit(JUMP); yyval = lc; } + + case 132: +#line 1039 "bac.y" + { emit(JUMP); yyval = lc; } break; -case 132: -#line 1037 "bac.y" -{ + + case 133: +#line 1043 "bac.y" + { enter_break_block(&break_level,switch_blk); if (++curr_case == MAXCASELOC) cfatal( @@ -2430,17 +2724,20 @@ switch_block[switch_level].expr_index = yyvsp[-1]; } break; -case 136: -#line 1058 "bac.y" -{ first_case_hdr = curr_case; case_hdr_cnt = 1; } - break; -case 137: -#line 1060 "bac.y" -{ case_hdr_cnt++; } - break; -case 138: + + case 137: #line 1064 "bac.y" -{ int i; + { first_case_hdr = curr_case; case_hdr_cnt = 1; } + break; + + case 138: +#line 1066 "bac.y" + { case_hdr_cnt++; } + break; + + case 139: +#line 1070 "bac.y" + { int i; i = switch_block[switch_level].expr_index; if ((expr[i].typ != expr[yyvsp[-1]].typ)&&(expr[yyvsp[-1]].typ != notyp)) yyerror @@ -2458,18 +2755,20 @@ } } break; -case 139: -#line 1084 "bac.y" -{ int j; + + case 140: +#line 1090 "bac.y" + { int j; j = switch_block[switch_level].first_case; if (case_hdr_cnt > 0) emit(JUMP); /* for multiple case labels */ if (curr_case > j) code[case_loc[curr_case]].y = lc; /* prev JZER target */ } break; -case 140: -#line 1093 "bac.y" -{ int i, j, k; + + case 141: +#line 1099 "bac.y" + { int i, j, k; for (i = 1, j = first_case_hdr; i < case_hdr_cnt; i++, j++ ) { k = case_loc[j]; code[k+1].y = lc; /* k+1 == address of JMP to stmt_list */ @@ -2478,36 +2777,42 @@ first_case_hdr = -1; } break; -case 141: -#line 1104 "bac.y" -{ yyval = lc; } - break; -case 143: -#line 1109 "bac.y" -{ yyval = lc; } - break; -case 144: -#line 1113 "bac.y" -{ if (level == 1) emit(COEND); in_cobegin = 0; } + + case 142: +#line 1110 "bac.y" + { yyval = lc; } break; -case 145: -#line 1117 "bac.y" -{ + + case 144: +#line 1115 "bac.y" + { yyval = lc; } + break; + + case 145: +#line 1119 "bac.y" + { if (level == 1) emit(COEND); in_cobegin = 0; } + break; + + case 146: +#line 1123 "bac.y" + { yyval = yyvsp[-2]; /* continue target */ emit1(JUMP,yyvsp[-2]); code[yyvsp[-1]].y = lc; } break; -case 146: -#line 1123 "bac.y" -{ + + case 147: +#line 1129 "bac.y" + { yyval = yyvsp[-2]; /* continue target */ code[yyvsp[-1]].y = yyvsp[-4]; /* point JUMP to top of DO */ } break; -case 147: -#line 1128 "bac.y" -{ int i; + + case 148: +#line 1134 "bac.y" + { int i; if (yyvsp[-2]) { /* iteration code was generated */ yyval = for_info[curr_for].iter_loc; /* continue target */ /* jump back to iteration code after stmt */ @@ -2532,39 +2837,45 @@ curr_for--; } break; -case 148: -#line 1155 "bac.y" -{ + + case 149: +#line 1161 "bac.y" + { yyval = lc; /* continue target */ enter_break_block(&break_level,loop_blk); } break; -case 149: -#line 1162 "bac.y" -{ + + case 150: +#line 1168 "bac.y" + { gen_exprval(yyvsp[-1]); free_expr(yyvsp[-1]); yyval = lc; emit(JZER); } break; -case 150: -#line 1171 "bac.y" -{ + + case 151: +#line 1177 "bac.y" + { enter_break_block(&break_level,loop_blk); } break; -case 151: -#line 1177 "bac.y" -{ yyval = lc; /* location of stmt code */ } + + case 152: +#line 1183 "bac.y" + { yyval = lc; /* location of stmt code */ } break; -case 152: -#line 1181 "bac.y" -{ yyval = lc; /* continue target */ } + + case 153: +#line 1187 "bac.y" + { yyval = lc; /* continue target */ } break; -case 153: -#line 1185 "bac.y" -{ + + case 154: +#line 1191 "bac.y" + { gen_exprval(yyvsp[-1]); free_expr(yyvsp[-1]); emit1(JZER,lc+2); @@ -2572,15 +2883,17 @@ emit(JUMP); } break; -case 154: -#line 1195 "bac.y" -{ /* init stuff done, continuation testing code is next */ + + case 155: +#line 1201 "bac.y" + { /* init stuff done, continuation testing code is next */ for_info[curr_for].cont_loc = lc; /* continuation test code */ } break; -case 155: -#line 1201 "bac.y" -{ + + case 156: +#line 1207 "bac.y" + { enter_break_block(&break_level,loop_blk); if (++curr_for == MAXFORNEST) cfatal("No more than %d 'for' statements can be nested", @@ -2591,13 +2904,15 @@ } } break; -case 156: -#line 1214 "bac.y" -{ yyval = 0; /* no continuation code */ } + + case 157: +#line 1220 "bac.y" + { yyval = 0; /* no continuation code */ } break; -case 157: -#line 1216 "bac.y" -{ + + case 158: +#line 1222 "bac.y" + { yyval = 1; /* continuation code */ gen_exprval(yyvsp[0]); /* expr might not have been generated yet */ free_expr(yyvsp[0]); @@ -2605,32 +2920,36 @@ emit(JZER); } break; -case 158: -#line 1226 "bac.y" -{ + + case 159: +#line 1232 "bac.y" + { emit(JUMP); /* to stmt code, backpatched later */ for_info[curr_for].iter_loc = lc; /* loc of iteration code */ } break; -case 159: -#line 1233 "bac.y" -{ + + case 160: +#line 1239 "bac.y" + { yyval = 0; /* no iteration code */ for_info[curr_for].stmt_loc = lc; /* loc of stmt code */ } break; -case 160: -#line 1238 "bac.y" -{ + + case 161: +#line 1244 "bac.y" + { yyval = 1; /* iteration code */ if (for_info[curr_for].cont_jzer >= 0) /* there was cont code */ emit(JUMP); /* to continuation code, backpatched */ for_info[curr_for].stmt_loc = lc; /* loc of stmt code */ } break; -case 161: -#line 1247 "bac.y" -{ + + case 162: +#line 1253 "bac.y" + { if (level != 1) yyerror("'cobegin' block allowed only in 'main'"); else if (in_cobegin) @@ -2640,9 +2959,10 @@ in_cobegin = 1; } break; -case 162: -#line 1259 "bac.y" -{ + + case 163: +#line 1265 "bac.y" + { if ((break_level < 0)|| (break_block[break_level].bb_type != loop_blk)) yyerror("'continue' is inappropriate outside a loop"); @@ -2660,9 +2980,10 @@ } } break; -case 163: -#line 1279 "bac.y" -{ + + case 164: +#line 1285 "bac.y" + { if (break_level < 0) yyerror("'break' is inappropriate outside a 'loop' or 'switch' statement"); else { @@ -2679,40 +3000,51 @@ } } break; -case 164: -#line 1298 "bac.y" -{ + + case 165: +#line 1304 "bac.y" + { if (void_function) { - if (yyvsp[-1] < 0) - emit(EXIT_PROC); + if (yyvsp[-1] < 0) { + if (++curr_ret == MAXRETURN) + cfatal( + "No more thn %d 'return' statements can appear in a function",MAXRETURN); + else + return_loc[curr_ret] = lc; /* mark the JUMP loc */ + emit(JUMP); + } else yyerror("Cannot return a value from a 'void' function"); } - if (yyvsp[-1] >= 0) - gen_exprval(yyvsp[-1]); - else /* no expression to push */ - emit1(PUSH_LIT,0); - emit(STORE); - if (++curr_ret == MAXRETURN) - cfatal( + else { // non void function + if (yyvsp[-1] >= 0) + gen_exprval(yyvsp[-1]); + else /* no expression to push */ + emit1(PUSH_LIT,0); + emit(STORE); + if (++curr_ret == MAXRETURN) + cfatal( "No more thn %d 'return' statements can appear in a function",MAXRETURN); - else - return_loc[curr_ret] = lc; /* mark the JUMP loc */ - emit(JUMP); /* jump to fcn exit*/ + else + return_loc[curr_ret] = lc; /* mark the JUMP loc */ + emit(JUMP); /* jump to fcn exit*/ + } } break; -case 165: -#line 1320 "bac.y" -{ + + case 166: +#line 1334 "bac.y" + { if (!in_func_decl) yyerror("'return' is inappropriate outside a function"); else if (!void_function) - emit2(LOAD_ADDR,tab[func_tab].lev+1,0); + emit2(LOAD_ADDR,tab[prt].lev+1,0); } break; -case 169: -#line 1336 "bac.y" -{ + + case 170: +#line 1350 "bac.y" + { if (expr[yyvsp[0]].typ == arrays) /* presently our only struct type */ yyerror("Cannot output an array"); else if(expr[yyvsp[0]].typ == strings) { @@ -2728,20 +3060,23 @@ free_expr(yyvsp[0]); } break; -case 170: -#line 1352 "bac.y" -{ emit(WRITELN); } - break; -case 171: -#line 1354 "bac.y" -{ + + case 171: +#line 1366 "bac.y" + { emit(WRITELN); } + break; + + case 172: +#line 1368 "bac.y" + { int tmp = store_string(laststring,&stab_size); emit1(WRITE_RAWSTRING,tmp); } break; -case 172: -#line 1361 "bac.y" -{ + + case 173: +#line 1375 "bac.y" + { if ((expr[yyvsp[-1]].obj != variable)&& (expr[yyvsp[-1]].obj != ext_variable)) yyerror("input item must be a 'variable'"); else if ((expr[yyvsp[-1]].typ != ints)&&(expr[yyvsp[-1]].typ != chars)&& @@ -2752,23 +3087,32 @@ emit1(READ,expr[yyvsp[-1]].typ); } else /* array element */ emit1(READ,expr[yyvsp[-1]].typ); + free_expr(yyvsp[-1]); } break; -case 174: -#line 1378 "bac.y" -{ yyval = -1; } - break; -case 176: -#line 1383 "bac.y" -{ int i = expr[yyvsp[-1]].tix; + + case 175: +#line 1393 "bac.y" + { yyval = -1; } + break; + + case 176: +#line 1395 "bac.y" + { free_expr(yyvsp[0]); } + break; + + case 177: +#line 1399 "bac.y" + { int i = expr[yyvsp[-1]].tix; if ((tab[i].obj == function) && (!expr[yyvsp[-1]].result_used)) yyerror("A non-void function cannot be called as a void function"); free_expr(yyvsp[-1]); } break; -case 179: -#line 1395 "bac.y" -{ + + case 180: +#line 1411 "bac.y" + { expr[yyvsp[0]].result_used = 1; gen_exprval(yyvsp[0]); if (tab[yyvsp[-1]].typ == expr[yyvsp[0]].typ) { @@ -2786,19 +3130,21 @@ else yyerror("Type mismatch in assignment"); yyval = yyvsp[0]; + expr[yyval].tix = yyvsp[-1]; assign_cnt--; } break; -case 180: -#line 1416 "bac.y" -{ + + case 181: +#line 1433 "bac.y" + { gen_exprval(yyvsp[0]); if (expr[yyvsp[-1]].typ == expr[yyvsp[0]].typ) { if ((expr[yyvsp[-1]].typ == sems)||(expr[yyvsp[-1]].typ == bsems)|| (expr[yyvsp[-1]].typ == conds)) yyerror("Cannot assign to 'semaphore' or 'condition'"); else if (expr[yyvsp[-1]].typ == arrays) - emit1(COPY_BLOCK,atab[tab[yyvsp[-1]].ref].size); + emit1(COPY_BLOCK,atab[expr[yyvsp[-1]].ref].size); else /* standard types */ if (assign_cnt > 1) /* multiple assignments */ emit(STORE_KEEP); @@ -2807,32 +3153,33 @@ } else yyerror("Type mismatch in assignment"); + free_expr(yyvsp[0]); expr[yyvsp[-1]].isval = 1; yyval = yyvsp[-1]; assign_cnt--; } break; -case 181: -#line 1439 "bac.y" -{ + + case 182: +#line 1457 "bac.y" + { assign_cnt++; if ((tab[yyvsp[-1]].obj == variable)||(tab[yyvsp[-1]].obj == ext_variable)) { - if ((tab[yyvsp[-1]].typ == sems)||(tab[yyvsp[-1]].typ == bsems)) - yyerror("Must use `initialsem' to initialize a 'semaphore'"); - else emit_push_addr(tab[yyvsp[-1]]); } else yyerror("'variable' identifier expected"); } break; -case 182: -#line 1453 "bac.y" -{ assign_cnt++; } + + case 183: +#line 1468 "bac.y" + { assign_cnt++; } break; -case 184: -#line 1458 "bac.y" -{ + + case 185: +#line 1473 "bac.y" + { if ((expr[yyvsp[-2]].typ == ints)&&(expr[yyvsp[0]].typ == ints)) { gen_exprval(yyvsp[0]); emit(DO_OR); @@ -2844,13 +3191,15 @@ free_expr(yyvsp[0]); } break; -case 185: -#line 1472 "bac.y" -{ gen_exprval(yyvsp[0]); } + + case 186: +#line 1487 "bac.y" + { gen_exprval(yyvsp[0]); } break; -case 187: -#line 1477 "bac.y" -{ + + case 188: +#line 1492 "bac.y" + { if ((expr[yyvsp[-2]].typ == ints)&&(expr[yyvsp[0]].typ == ints)) { gen_exprval(yyvsp[0]); emit(DO_AND); @@ -2862,13 +3211,15 @@ free_expr(yyvsp[0]); } break; -case 188: -#line 1491 "bac.y" -{ gen_exprval(yyvsp[0]); } + + case 189: +#line 1506 "bac.y" + { gen_exprval(yyvsp[0]); } break; -case 190: -#line 1496 "bac.y" -{ + + case 191: +#line 1511 "bac.y" + { gen_exprval(yyvsp[0]); if (expr[yyvsp[-2]].typ == expr[yyvsp[0]].typ){ if ((expr[yyvsp[-2]].typ == ints)||(expr[yyvsp[-2]].typ == chars)) @@ -2883,37 +3234,45 @@ free_expr(yyvsp[0]); } break; -case 191: -#line 1513 "bac.y" -{ gen_exprval(yyvsp[0]); } - break; -case 192: -#line 1516 "bac.y" -{ yyval = TEST_EQ; } - break; -case 193: -#line 1517 "bac.y" -{ yyval = TEST_LT; } - break; -case 194: -#line 1518 "bac.y" -{ yyval = TEST_GT; } - break; -case 195: -#line 1519 "bac.y" -{ yyval = TEST_LE; } - break; -case 196: -#line 1520 "bac.y" -{ yyval = TEST_GE; } - break; -case 197: -#line 1521 "bac.y" -{ yyval = TEST_NE; } + + case 192: +#line 1528 "bac.y" + { gen_exprval(yyvsp[0]); } break; -case 199: -#line 1526 "bac.y" -{ + + case 193: +#line 1531 "bac.y" + { yyval = TEST_EQ; } + break; + + case 194: +#line 1532 "bac.y" + { yyval = TEST_LT; } + break; + + case 195: +#line 1533 "bac.y" + { yyval = TEST_GT; } + break; + + case 196: +#line 1534 "bac.y" + { yyval = TEST_LE; } + break; + + case 197: +#line 1535 "bac.y" + { yyval = TEST_GE; } + break; + + case 198: +#line 1536 "bac.y" + { yyval = TEST_NE; } + break; + + case 200: +#line 1541 "bac.y" + { yyval = yyvsp[0]; gen_exprval(yyval); if ((expr[yyval].typ != ints)&&(expr[yyval].typ != notyp)){ @@ -2922,9 +3281,10 @@ } } break; -case 200: -#line 1535 "bac.y" -{ + + case 201: +#line 1550 "bac.y" + { yyval = yyvsp[0]; gen_exprval(yyval); if ((expr[yyval].typ != ints)&&(expr[yyval].typ != notyp)){ @@ -2935,9 +3295,10 @@ emit(NEGATE); } break; -case 201: -#line 1546 "bac.y" -{ + + case 202: +#line 1561 "bac.y" + { gen_exprval(yyvsp[0]); switch (yyvsp[-1]) { case DO_ADD: @@ -2952,21 +3313,25 @@ free_expr(yyvsp[0]); } break; -case 202: -#line 1563 "bac.y" -{ gen_exprval(yyvsp[0]); } - break; -case 203: -#line 1566 "bac.y" -{ yyval = DO_ADD; } - break; -case 204: -#line 1567 "bac.y" -{ yyval = DO_SUB; } + + case 203: +#line 1578 "bac.y" + { gen_exprval(yyvsp[0]); } break; -case 206: -#line 1572 "bac.y" -{ + + case 204: +#line 1581 "bac.y" + { yyval = DO_ADD; } + break; + + case 205: +#line 1582 "bac.y" + { yyval = DO_SUB; } + break; + + case 207: +#line 1587 "bac.y" + { gen_exprval(yyvsp[0]); switch(yyvsp[-1]) { case DO_MUL: @@ -2985,25 +3350,30 @@ free_expr(yyvsp[0]); } break; -case 207: -#line 1593 "bac.y" -{ gen_exprval(yyvsp[0]); } - break; -case 208: -#line 1596 "bac.y" -{ yyval = DO_MUL; } - break; -case 209: -#line 1597 "bac.y" -{ yyval = DO_DIV; } - break; -case 210: -#line 1598 "bac.y" -{ yyval = DO_MOD; } + + case 208: +#line 1608 "bac.y" + { gen_exprval(yyvsp[0]); } break; -case 212: -#line 1603 "bac.y" -{ + + case 209: +#line 1611 "bac.y" + { yyval = DO_MUL; } + break; + + case 210: +#line 1612 "bac.y" + { yyval = DO_DIV; } + break; + + case 211: +#line 1613 "bac.y" + { yyval = DO_MOD; } + break; + + case 213: +#line 1618 "bac.y" + { yyval = new_expr(); expr[yyval].obj = constant; expr[yyval].adr = yyvsp[0]; @@ -3011,9 +3381,10 @@ expr[yyval].lev = level; } break; -case 213: -#line 1611 "bac.y" -{ + + case 214: +#line 1626 "bac.y" + { yyval = new_expr(); expr[yyval].obj = constant; expr[yyval].adr = laststring[0]; @@ -3021,13 +3392,15 @@ expr[yyval].lev = level; } break; -case 214: -#line 1619 "bac.y" -{ yyval = yyvsp[-1];} + + case 215: +#line 1634 "bac.y" + { yyval = yyvsp[-1];} break; -case 215: -#line 1621 "bac.y" -{ + + case 216: +#line 1636 "bac.y" + { yyval = yyvsp[0]; gen_exprval(yyval); if (expr[yyval].typ == ints) @@ -3038,9 +3411,10 @@ } } break; -case 217: -#line 1635 "bac.y" -{ + + case 218: +#line 1650 "bac.y" + { if ((expr[yyvsp[-1]].typ != ints)&&(expr[yyvsp[-1]].typ != chars)) yyerror("'int' or 'char' expected"); else { @@ -3052,9 +3426,10 @@ } } break; -case 218: -#line 1647 "bac.y" -{ + + case 219: +#line 1662 "bac.y" + { if ((expr[yyvsp[0]].typ != ints)&&(expr[yyvsp[0]].typ != chars)) yyerror("'int' or 'char' expected"); else { @@ -3066,9 +3441,10 @@ } } break; -case 219: -#line 1659 "bac.y" -{ + + case 220: +#line 1674 "bac.y" + { if ((expr[yyvsp[-1]].typ != ints)&&(expr[yyvsp[-1]].typ != chars)) yyerror("'int' or 'char' expected"); else { @@ -3080,9 +3456,10 @@ } } break; -case 220: -#line 1671 "bac.y" -{ + + case 221: +#line 1686 "bac.y" + { if ((expr[yyvsp[0]].typ != ints)&&(expr[yyvsp[0]].typ != chars)) yyerror("'int' or 'char' expected"); else { @@ -3094,9 +3471,10 @@ } } break; -case 224: -#line 1688 "bac.y" -{ + + case 225: +#line 1703 "bac.y" + { yyval = new_expr(); expr[yyval].obj = tab[yyvsp[0]].obj; expr[yyval].typ = tab[yyvsp[0]].typ; @@ -3107,9 +3485,10 @@ expr[yyval].tix = yyvsp[0]; } break; -case 225: -#line 1701 "bac.y" -{ int k; + + case 226: +#line 1716 "bac.y" + { int k; yyval = new_expr(); expr[yyval].obj = tab[yyvsp[-1]].obj; expr[yyval].typ = tab[yyvsp[-1]].typ; @@ -3154,9 +3533,10 @@ } } break; -case 228: -#line 1750 "bac.y" -{ + + case 229: +#line 1765 "bac.y" + { last_pf = yyvsp[0]; if ((tab[yyvsp[0]].obj != function)&&(tab[yyvsp[0]].obj != procedure)&& (tab[yyvsp[0]].obj != ext_function)&&(tab[yyvsp[0]].obj != ext_procedure)) @@ -3167,7 +3547,7 @@ else{ /* legal func call */ pfstack[toppfs].tix = last_pf; pfstack[toppfs].pct = parmct = 0; - first_stringerr = first_parmcterr = 1; + first_parmcterr = 1; if (tab[yyvsp[0]].lev != -1){ /* regular proc call */ if ((tab[yyvsp[0]].mon)&&(tab[prt].mon)&& (tab[yyvsp[0]].mon != tab[prt].mon)) @@ -3178,9 +3558,10 @@ } /* if func */ } break; -case 233: -#line 1782 "bac.y" -{ + + case 234: +#line 1797 "bac.y" + { parmct = ++pfstack[toppfs].pct; if (tab[last_pf].lev == -1) stdproc_parm(last_pf,yyvsp[0],parmct); @@ -3189,9 +3570,10 @@ free_expr(yyvsp[0]); } break; -case 239: -#line 1800 "bac.y" -{ + + case 240: +#line 1815 "bac.y" + { if (expr[yyvsp[-1]].typ != strings) yyerror("left parameter is not of type 'string'"); yyval = NO_EXPR; /* for free_expr() call up the parse tree */ @@ -3202,9 +3584,11 @@ free_expr(yyvsp[-1]); free_expr(yyvsp[0]); } break; -case 240: -#line 1813 "bac.y" -{ + + case 241: +#line 1828 "bac.y" + { + yyval = yyvsp[-1]; if (expr[yyvsp[-1]].typ != strings) { yyerror("right parameter is not of type 'string'"); last_eltyp = notyp; @@ -3217,13 +3601,15 @@ } } break; -case 241: -#line 1826 "bac.y" -{ yyval = yyvsp[-1]; } + + case 242: +#line 1842 "bac.y" + { yyval = yyvsp[-1]; } break; -case 242: -#line 1830 "bac.y" -{ + + case 243: +#line 1846 "bac.y" + { yyval = new_expr(); expr[yyval].obj = variable; expr[yyval].typ = rawstrings; @@ -3233,9 +3619,10 @@ expr[yyval].tix = -1; } break; -case 243: -#line 1842 "bac.y" -{ + + case 244: +#line 1858 "bac.y" + { if (expr[yyvsp[-1]].typ != strings) yyerror("left parameter is not of type 'string'"); yyval = NO_EXPR; /* for free_expr() call up the parse tree */ @@ -3246,9 +3633,10 @@ free_expr(yyvsp[-1]); free_expr(yyvsp[0]); } break; -case 244: -#line 1855 "bac.y" -{ + + case 245: +#line 1871 "bac.y" + { if (expr[yyvsp[-1]].typ != strings) yyerror("left parameter is not of type 'string'"); yyval = new_expr(); @@ -3265,9 +3653,10 @@ free_expr(yyvsp[0]); } break; -case 245: -#line 1874 "bac.y" -{ + + case 246: +#line 1890 "bac.y" + { yyval = new_expr(); expr[yyval].obj = function; expr[yyval].typ = ints; @@ -3284,9 +3673,10 @@ free_expr(yyvsp[0]); } break; -case 246: -#line 1893 "bac.y" -{ + + case 247: +#line 1909 "bac.y" + { if (expr[yyvsp[-1]].typ == strings) { if (!expr[yyvsp[-1]].arelt) /* addr of array ref is already on the stack */ @@ -3297,9 +3687,10 @@ /* parent rule will free_expr($2) */ } break; -case 247: -#line 1904 "bac.y" -{ + + case 248: +#line 1920 "bac.y" + { yyval = new_expr(); expr[yyval].obj = variable; expr[yyval].typ = rawstrings; @@ -3309,9 +3700,10 @@ expr[yyval].tix = -1; } break; -case 248: -#line 1916 "bac.y" -{ + + case 249: +#line 1932 "bac.y" + { yyval = new_expr(); expr[yyval].obj = function; expr[yyval].typ = ints; @@ -3324,9 +3716,10 @@ emit1(SSCANF_OP,yyvsp[-3]); } break; -case 249: -#line 1931 "bac.y" -{ + + case 250: +#line 1947 "bac.y" + { if (expr[yyvsp[-2]].typ != strings) yyerror("Leftmost sscanf parameter must be of type 'string'"); yyval = expr[yyvsp[0]].adr; /* pass rawstring index up the tree */ @@ -3335,9 +3728,10 @@ varargs_cnt = 0; } break; -case 250: -#line 1942 "bac.y" -{ + + case 251: +#line 1958 "bac.y" + { if ((expr[yyvsp[0]].typ != ints)&&(expr[yyvsp[0]].typ != strings)) yyerror( "sscanf parameter must be either of type 'int' or type 'string'"); @@ -3346,9 +3740,10 @@ free_expr(yyvsp[0]); } break; -case 251: -#line 1951 "bac.y" -{ + + case 252: +#line 1967 "bac.y" + { if ((expr[yyvsp[0]].typ != ints)&&(expr[yyvsp[0]].typ != strings)) yyerror( "sscanf parameter must be either of type 'int' or type 'string'"); @@ -3357,9 +3752,10 @@ free_expr(yyvsp[0]); } break; -case 252: -#line 1962 "bac.y" -{ + + case 253: +#line 1978 "bac.y" + { if (expr[yyvsp[-1]].typ != strings) yyerror("Left parameter must be of type 'string'"); emit(RECEIVE_OP); @@ -3373,9 +3769,10 @@ expr[yyval].adr = expr[yyval].lev = -1; } break; -case 253: -#line 1976 "bac.y" -{ + + case 254: +#line 1992 "bac.y" + { if (expr[yyvsp[-3]].typ != strings) yyerror("Left parameter must be of type 'string'"); /* implements receive(string,int&) call */ @@ -3398,9 +3795,10 @@ expr[yyval].adr = expr[yyval].lev = -1; } break; -case 254: -#line 2001 "bac.y" -{ + + case 255: +#line 2017 "bac.y" + { expr[yyvsp[-1]].ref = sizeof(int)*atab[last_aref].elsize; expr[yyvsp[-1]].arelt = 1; expr[yyvsp[-1]].typ = last_eltyp; @@ -3411,9 +3809,10 @@ } } break; -case 255: -#line 2014 "bac.y" -{ + + case 256: +#line 2030 "bac.y" + { if (tab[yyvsp[0]].typ != arrays) { sprintf(pbuf,"'%s' is not of type 'array'",tab[yyvsp[0]].name); yyerror(pbuf); @@ -3441,9 +3840,10 @@ expr[yyval].normal = tab[yyvsp[0]].normal; } break; -case 256: -#line 2044 "bac.y" -{ + + case 257: +#line 2060 "bac.y" + { gen_exprval(yyvsp[-1]); last_aref = arstack[topars].aref; last_eltyp = arstack[topars].eltyp; @@ -3453,9 +3853,10 @@ free_expr(yyvsp[-1]); } break; -case 257: -#line 2054 "bac.y" -{ + + case 258: +#line 2070 "bac.y" + { gen_exprval(yyvsp[-1]); last_aref = arstack[topars].aref; last_eltyp = arstack[topars].eltyp; @@ -3465,47 +3866,39 @@ free_expr(yyvsp[-1]); } break; -case 258: -#line 2066 "bac.y" -{ + + case 259: +#line 2082 "bac.y" + { expr[yyvsp[-1]].typ = ints; yyval = yyvsp[-1]; } break; -case 259: -#line 2073 "bac.y" -{ yyval = loc(lastident(),level); } - break; -case 260: -#line 2077 "bac.y" -{ yyval = enter(lastident(),constant,level,level); } + + case 260: +#line 2089 "bac.y" + { yyval = loc(lastident(),level); } break; -} -#line 705 "/usr/share/bison/bison.simple" + case 261: +#line 2093 "bac.y" + { yyval = enter(lastident(),constant,level,level); } + break; + + + } +/* Line 991 of yacc.c. */ +#line 3892 "y.tab.c" yyvsp -= yylen; yyssp -= yylen; -#if YYLSP_NEEDED - yylsp -= yylen; -#endif -#if YYDEBUG - if (yydebug) - { - short *yyssp1 = yyss - 1; - YYFPRINTF (stderr, "state stack now"); - while (yyssp1 != yyssp) - YYFPRINTF (stderr, " %d", *++yyssp1); - YYFPRINTF (stderr, "\n"); - } -#endif + + YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; -#if YYLSP_NEEDED - *++yylsp = yyloc; -#endif + /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule @@ -3513,11 +3906,11 @@ yyn = yyr1[yyn]; - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTBASE]; + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; @@ -3530,13 +3923,13 @@ if (!yyerrstatus) { ++yynerrs; - -#ifdef YYERROR_VERBOSE +#if YYERROR_VERBOSE yyn = yypact[yystate]; - if (yyn > YYFLAG && yyn < YYLAST) + if (YYPACT_NINF < yyn && yyn < YYLAST) { YYSIZE_T yysize = 0; + int yytype = YYTRANSLATE (yychar); char *yymsg; int yyx, yycount; @@ -3545,15 +3938,15 @@ YYCHECK. */ for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) - if (yycheck[yyx + yyn] == yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) yysize += yystrlen (yytname[yyx]) + 15, yycount++; - yysize += yystrlen ("parse error, unexpected ") + 1; - yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); + yysize += yystrlen ("syntax error, unexpected ") + 1; + yysize += yystrlen (yytname[yytype]); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { - char *yyp = yystpcpy (yymsg, "parse error, unexpected "); - yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); + char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + yyp = yystpcpy (yyp, yytname[yytype]); if (yycount < 5) { @@ -3561,7 +3954,7 @@ for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) - if (yycheck[yyx + yyn] == yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { const char *yyq = ! yycount ? ", expecting " : " or "; yyp = yystpcpy (yyp, yyq); @@ -3573,102 +3966,93 @@ YYSTACK_FREE (yymsg); } else - yyerror ("parse error; also virtual memory exhausted"); + yyerror ("syntax error; also virtual memory exhausted"); } else -#endif /* defined (YYERROR_VERBOSE) */ - yyerror ("parse error"); +#endif /* YYERROR_VERBOSE */ + yyerror ("syntax error"); } - goto yyerrlab1; -/*--------------------------------------------------. -| yyerrlab1 -- error raised explicitly by an action | -`--------------------------------------------------*/ -yyerrlab1: + if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ - /* return failure if at end of input */ + /* Return failure if at end of input. */ if (yychar == YYEOF) - YYABORT; - YYDPRINTF ((stderr, "Discarding token %d (%s).\n", - yychar, yytname[yychar1])); + { + /* Pop the error token. */ + YYPOPSTACK; + /* Pop the rest of the stack. */ + while (yyss < yyssp) + { + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[*yyssp], yyvsp); + YYPOPSTACK; + } + YYABORT; + } + + YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); + yydestruct (yytoken, &yylval); yychar = YYEMPTY; + } /* Else will try to reuse lookahead token after shifting the error token. */ + goto yyerrlab2; - yyerrstatus = 3; /* Each real token shifted decrements this */ - goto yyerrhandle; +/*----------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action. | +`----------------------------------------------------*/ +yyerrlab1: + /* Suppress GCC warning that yyerrlab1 is unused when no action + invokes YYERROR. */ +#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__) \ + && !defined __cplusplus + __attribute__ ((__unused__)) +#endif -/*-------------------------------------------------------------------. -| yyerrdefault -- current state does not do anything special for the | -| error token. | -`-------------------------------------------------------------------*/ -yyerrdefault: -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - /* If its default is to accept any token, ok. Otherwise pop it. */ - yyn = yydefact[yystate]; - if (yyn) - goto yydefault; -#endif + goto yyerrlab2; /*---------------------------------------------------------------. -| yyerrpop -- pop the current state because it cannot handle the | -| error token | +| yyerrlab2 -- pop states until the error token can be shifted. | `---------------------------------------------------------------*/ -yyerrpop: - if (yyssp == yyss) - YYABORT; - yyvsp--; - yystate = *--yyssp; -#if YYLSP_NEEDED - yylsp--; -#endif +yyerrlab2: + yyerrstatus = 3; /* Each real token shifted decrements this. */ -#if YYDEBUG - if (yydebug) + for (;;) { - short *yyssp1 = yyss - 1; - YYFPRINTF (stderr, "Error: state stack now"); - while (yyssp1 != yyssp) - YYFPRINTF (stderr, " %d", *++yyssp1); - YYFPRINTF (stderr, "\n"); - } -#endif + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } -/*--------------. -| yyerrhandle. | -`--------------*/ -yyerrhandle: - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[yystate], yyvsp); + yyvsp--; + yystate = *--yyssp; - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; + YY_STACK_PRINT (yyss, yyssp); } - else if (yyn == 0) - goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; @@ -3676,9 +4060,7 @@ YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; -#if YYLSP_NEEDED - *++yylsp = yylloc; -#endif + yystate = yyn; goto yynewstate; @@ -3698,13 +4080,15 @@ yyresult = 1; goto yyreturn; -/*---------------------------------------------. -| yyoverflowab -- parser overflow comes here. | -`---------------------------------------------*/ +#ifndef yyoverflow +/*----------------------------------------------. +| yyoverflowlab -- parser overflow comes here. | +`----------------------------------------------*/ yyoverflowlab: yyerror ("parser stack overflow"); yyresult = 2; /* Fall through. */ +#endif yyreturn: #ifndef yyoverflow @@ -3713,7 +4097,9 @@ #endif return yyresult; } -#line 2081 "bac.y" + + +#line 2097 "bac.y" /*start of routines*/ void enter_break_block(int* break_level, break_block_type bbt) @@ -3810,6 +4196,9 @@ /* * * $Log$ + * Revision 2.26 2004/07/21 19:17:28 bynum + * correct minor errors discovered in writing the Java version of bacc + * * Revision 2.25 2004/04/13 18:18:40 bynum * revise grammar to handle C-style expressions * @@ -3963,3 +4352,4 @@ * * */ + diff -ur bacisrc/ccomp/lex.c bacisrc.ok/ccomp/lex.c --- bacisrc/ccomp/lex.c 2004-04-15 13:31:23.000000000 +0200 +++ bacisrc.ok/ccomp/lex.c 2005-10-26 22:11:03.000000000 +0200 @@ -9,9 +9,6 @@ #define YY_FLEX_MINOR_VERSION 5 #include -#if !defined(DOS) -#include -#endif /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ @@ -25,6 +22,9 @@ #ifdef __cplusplus #include +#if !defined(DOS) +#include +#endif /* Use prototypes in function declarations. */ #define YY_USE_PROTOS @@ -696,7 +696,7 @@ YY_DECL { register yy_state_type yy_current_state; - register char *yy_cp = NULL, *yy_bp = NULL; + register char *yy_cp, *yy_bp; register int yy_act; #line 50 "bac.l" @@ -1567,7 +1567,6 @@ #endif /* ifndef YY_NO_UNPUT */ -#ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput() #else @@ -1639,7 +1638,7 @@ return c; } -#endif /* YY_NO_INPUT */ + #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) @@ -1750,6 +1749,11 @@ } +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) @@ -2216,7 +2220,7 @@ } } while (reading); } - return ((esc < 256) ? esc : 0x20); + return esc; } diff -ur bacisrc/ccomp/Makefile bacisrc.ok/ccomp/Makefile --- bacisrc/ccomp/Makefile 2004-04-15 13:31:24.000000000 +0200 +++ bacisrc.ok/ccomp/Makefile 2005-10-26 22:11:03.000000000 +0200 @@ -1,8 +1,8 @@ # Makefile for BenAri Concurrent C Compiler in C # adapted from the makefile for the BenAri Concurrent Pascal compiler in C -OBJS = baccutil.o date.o lex.o gram.o ../lib/readtab.o ../lib/globtabs.o -CFLAGS = -g -Wall +OBJS = baccutil.o date.o lex.o gram.o +CFLAGS = -g -Wall #CFLAGS = -g # pick which one of the following two lines you need #YACC=yacc diff -ur bacisrc/ccomp/ytab.h bacisrc.ok/ccomp/ytab.h --- bacisrc/ccomp/ytab.h 2004-04-15 13:31:23.000000000 +0200 +++ bacisrc.ok/ccomp/ytab.h 2005-10-26 22:11:03.000000000 +0200 @@ -1,64 +1,152 @@ -#ifndef BISON_Y_TAB_H -# define BISON_Y_TAB_H +/* A Bison parser, made by GNU Bison 1.875. */ -# ifndef YYSTYPE -# define YYSTYPE int -# define YYSTYPE_IS_TRIVIAL 1 -# endif -# define UNSIGNED_INT 257 -# define STRING 258 -# define RAWSTRING 259 -# define STRINGCONCAT 260 -# define STRINGCOMPARE 261 -# define STRINGCOPY 262 -# define STRINGLENGTH 263 -# define IDENTIFIER 264 -# define CHARCON 265 -# define INCLUDE 266 -# define FNSTRING 267 -# define NE 268 -# define LE 269 -# define GE 270 -# define EQ 271 -# define OR 272 -# define AND 273 -# define PLPL 274 -# define MIMI 275 -# define IF 276 -# define ELSE 277 -# define SWITCH 278 -# define CASE 279 -# define DEFAULT 280 -# define WHILE 281 -# define DO 282 -# define FOR 283 -# define CBEGIN 284 -# define CONST 285 -# define TYPEDEF 286 -# define VOID 287 -# define INT 288 -# define CHAR 289 -# define CONTINUE 290 -# define BREAK 291 -# define RETURN 292 -# define COUT 293 -# define LTLT 294 -# define ENDL 295 -# define CIN 296 -# define GTGT 297 -# define MAIN 298 -# define MONITOR 299 -# define INIT 300 -# define ATOMIC 301 -# define SEND 302 -# define RECEIVE 303 -# define BROADCAST 304 -# define EXTERN 305 -# define SSCANF 306 -# define SPRINTF 307 -# define LOWER_THAN_ELSE 308 +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + UNSIGNED_INT = 258, + STRING = 259, + RAWSTRING = 260, + STRINGCONCAT = 261, + STRINGCOMPARE = 262, + STRINGCOPY = 263, + STRINGLENGTH = 264, + IDENTIFIER = 265, + CHARCON = 266, + INCLUDE = 267, + FNSTRING = 268, + NE = 269, + LE = 270, + GE = 271, + EQ = 272, + OR = 273, + AND = 274, + PLPL = 275, + MIMI = 276, + IF = 277, + ELSE = 278, + SWITCH = 279, + CASE = 280, + DEFAULT = 281, + WHILE = 282, + DO = 283, + FOR = 284, + CBEGIN = 285, + CONST = 286, + TYPEDEF = 287, + VOID = 288, + INT = 289, + CHAR = 290, + CONTINUE = 291, + BREAK = 292, + RETURN = 293, + COUT = 294, + LTLT = 295, + ENDL = 296, + CIN = 297, + GTGT = 298, + MAIN = 299, + MONITOR = 300, + INIT = 301, + ATOMIC = 302, + SEND = 303, + RECEIVE = 304, + BROADCAST = 305, + EXTERN = 306, + SSCANF = 307, + SPRINTF = 308, + LOWER_THAN_ELSE = 309 + }; +#endif +#define UNSIGNED_INT 258 +#define STRING 259 +#define RAWSTRING 260 +#define STRINGCONCAT 261 +#define STRINGCOMPARE 262 +#define STRINGCOPY 263 +#define STRINGLENGTH 264 +#define IDENTIFIER 265 +#define CHARCON 266 +#define INCLUDE 267 +#define FNSTRING 268 +#define NE 269 +#define LE 270 +#define GE 271 +#define EQ 272 +#define OR 273 +#define AND 274 +#define PLPL 275 +#define MIMI 276 +#define IF 277 +#define ELSE 278 +#define SWITCH 279 +#define CASE 280 +#define DEFAULT 281 +#define WHILE 282 +#define DO 283 +#define FOR 284 +#define CBEGIN 285 +#define CONST 286 +#define TYPEDEF 287 +#define VOID 288 +#define INT 289 +#define CHAR 290 +#define CONTINUE 291 +#define BREAK 292 +#define RETURN 293 +#define COUT 294 +#define LTLT 295 +#define ENDL 296 +#define CIN 297 +#define GTGT 298 +#define MAIN 299 +#define MONITOR 300 +#define INIT 301 +#define ATOMIC 302 +#define SEND 303 +#define RECEIVE 304 +#define BROADCAST 305 +#define EXTERN 306 +#define SSCANF 307 +#define SPRINTF 308 +#define LOWER_THAN_ELSE 309 + + + + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif extern YYSTYPE yylval; -#endif /* not BISON_Y_TAB_H */ + + diff -ur bacisrc/disasm/main.c bacisrc.ok/disasm/main.c --- bacisrc/disasm/main.c 2004-04-15 13:31:24.000000000 +0200 +++ bacisrc.ok/disasm/main.c 2005-10-26 22:11:03.000000000 +0200 @@ -42,7 +42,7 @@ global_init(argc,argv); showing_source = source_wanted; while (lc <= last_code) { - if (showing_source &&(dbg[dbix].lc <= lc)) + if (dbg[dbix].lc <= lc) show_source(disasm,lc,&cur_ifile,&showing_source,&dbix); if (lc >= nextblock_lc) { cur_block++; @@ -65,6 +65,9 @@ /* * $Log$ + * Revision 1.8 2004/06/10 22:05:18 bynum + * remove showing_source bug at top of main + * * Revision 1.7 2001/07/13 19:34:36 bynum * add globtabs.h include * diff -ur bacisrc/interp/bainterp.c bacisrc.ok/interp/bainterp.c --- bacisrc/interp/bainterp.c 2004-04-15 13:31:24.000000000 +0200 +++ bacisrc.ok/interp/bainterp.c 2005-10-26 22:11:03.000000000 +0200 @@ -777,7 +777,7 @@ /* ANY proc can have a return address of 0, since it would */ /* have to be called by a MARKSTACK/CALL pair. */ if (ptab[curpr].pc != 0){ - /* retrieve static link from AR[3] */ + /* retrieve dynamic link from AR[3] */ h2 = s[ saddr_check(curpr,ptab[curpr].b + 3)]; /* h2 now points to AR[caller] */ assert(s[h2+1] != -1); /* does this ever happen?? */ @@ -1123,6 +1123,9 @@ /* * * $Log$ + * Revision 2.17 2005/06/19 21:31:38 bynum + * fix comment in CALL instruction + * * Revision 2.16 2004/04/13 18:21:38 bynum * fix cross monitor calls * diff -ur bacisrc/interp/baiutils.c bacisrc.ok/interp/baiutils.c --- bacisrc/interp/baiutils.c 2004-04-15 13:31:24.000000000 +0200 +++ bacisrc.ok/interp/baiutils.c 2005-10-26 22:11:03.000000000 +0200 @@ -86,7 +86,6 @@ extern proctab ptab[]; /* the process table */ extern CODEBLOCK cbtab[]; /* code block table */ extern int last_cbtab; /* index of last element cbtab */ -extern int main_cbix; /* cbtab index of main proc */ int main_dbix; /* dbg index of the first byte of the main proc */ int main_b; /* bottom of stackframe of main proc */ @@ -386,9 +385,19 @@ int active, suspended, look, add, d; if (ptab[0].active) /* proc0 becomes inactive after CODEND stmt */ cpr = 0; /* until that happens, proc0 is king */ + else if (ptab[cpr].atomic) { + if (ptab[cpr].suspend >= 0) { // suspended + atomic ==> deadlock + *pst = deadlock; +#if defined(TCL) + colorwindows(cpr); +#endif + } /* if cpr is atomic and suspended */ + // if cpr is atomic and not suspended, then let it run + // cpr will be returned below + } else if (*stepcnt == 0){ /* time quantum expired */ d = PMAXP1; /* must switch contexts */ - suspended = (active = 0); + suspended = -1; look = __random(PMAXP1); add = 1 + __random(PMAXM1); /* 1 <= add < PMAXP1 */ while ( ((!ptab[look].active) || (ptab[look].suspend>=0) || @@ -403,7 +412,7 @@ } /* while */ if (d < 0) { /* no runnable process was found */ /* choose most recently seen suspended proc, else m.r.seen active */ - cpr = (suspended ? suspended : active ); + cpr = ((suspended >= 0) ? suspended : active ); *pst = deadlock; #if defined(TCL) colorwindows(cpr); @@ -411,22 +420,10 @@ } else { /* we found someone to run */ *stepcnt = __random(STEPMAXP1); - /* if the thread we picked is atomic and suspended, the */ - /* we have deadlock */ - if (ptab[cpr].atomic){ - if (ptab[cpr].suspend >= 0) { - *pst = deadlock; -#if defined(TCL) - colorwindows(cpr); -#endif - } /* if cpr is suspended */ - } - else { /* cpr is not atomic, let it run */ - cpr = look; + cpr = look; #if defined(TCL) - colorwindows(cpr); + colorwindows(cpr); #endif - } /* else cpr is not atomic */ } /* else a runnable proc was found */ } /* *stepcnt was 0, time for a context switch */ else /* no context switch -- count down current proc's quantum */ @@ -516,7 +513,7 @@ sprintf(buf," %c",tmp); break; case strings: - sprintf(buf," %s",(char *) s[tmp]); + sprintf(buf," %s",(char *) &s[sta]); default: ; } /* switch */ while (*p) p++; /* find the end */ @@ -765,6 +762,7 @@ { int pc, dbgix; time_t x; + int lno; int pc_to_dbgix(int); #if defined(SunOS) extern time_t time(time_t*); @@ -773,8 +771,10 @@ pc = ptab[curpr].pc; dbgix = pc_to_dbgix(pc); time(&x); + lno = dbg[dbgix].flno; + if (lno < 0) lno = -lno; sprintf(out_buf,"\n%s\n Process %d, loc %d, line %d of %s\n %s",hdr,curpr, - pc,dbg[dbgix].flno,inputfile[dbg[dbgix].fix].fname,ctime(&x)); + pc,lno,inputfile[dbg[dbgix].fix].fname,ctime(&x)); /* ctime inserts a newline '\n' */ #if defined(TCL) tcl_1printf(out_buf,DATAWIN); @@ -823,7 +823,8 @@ #else fputs(out_buf,stdout); #endif - show_vars(0,0); + /*show_vars(0,0);*/ + show_vars(0,1); sprintf(out_buf, "\nMainproc Variables \ntype name stack loc value\n"); #if defined(TCL) @@ -1123,12 +1124,6 @@ int ix; /* loop counter */ int block0_vsize; /* size of outer block */ - - if (btab[1].vsize > STMAX - STKINCR * PMAX) { - fprintf(stderr,"Stack required is too great to run. Abort!\n"); - exit(1); - } - charl = ' '; /* lowest char ord */ charh = '~'; /* highest character ordinal */ @@ -1144,14 +1139,12 @@ exit(1); } /* establish stack frame for main pgm */ - block0_vsize = btab[0].vsize; ptab[0].b = main_b = block0_vsize; s[main_b] = 0; /* main proc result */ s[main_b+1] = 0; /* main proc return address */ s[main_b+2] = 0; /* main proc static link */ s[main_b+3] = -1; /* main proc dynamic link */ s[main_b+4] = btab[0].lastpar; /* tab index of main proc temp stored here */ - ptab[0].tabix = s[main_b+4]; /* need to store in ptab, too */ /* set tab index of main proc */ main_tix = ptab[0].tabix = s[main_b+4]; /* initialize display of main proc */ @@ -1167,8 +1160,6 @@ ptab[0].t,STMAX); exit(1); } - /* zero out the local variable storage of the main proc */ - for (ix = main_b+5; ix <= ptab[0].t; ix++) s[ix] = 0; ptab[0].pc = tab[main_tix].adr; /* set entry point */ ptab[0].active = 1; /* main proc is active */ ptab[0].suspend = NOT_SUSPENDED; /* main proc is not suspended */ @@ -1178,7 +1169,7 @@ ptab[0].first_spc = ptab[0].last_spc = -1; /* main proc gets what's left over after allocating the stack to */ /* the other procs */ - ptab[0].stacksize = STMAX - PMAX * STKINCR; + ptab[0].stacksize = STMAX - block0_vsize - PMAX * STKINCR; /* show main proc startup information, if necessary */ if (initAR_db) { @@ -1191,8 +1182,8 @@ show_AR(ptab[0].b,ptab[0].t); } - for (ix = 0; ix < last_dbg; ix++) - if (dbg[ix].lc == cbtab[main_cbix].adr) { + for (ix = 0; ix <= last_dbg; ix++) + if (dbg[ix].lc == tab[main_tix].adr) { main_dbix = ix; break; } @@ -1421,7 +1412,6 @@ inputfile[dbg[jx].fix].fname); strcpy(buf,tmp_buf); } - strcat(buf,"\n"); } /* list_breakpoint */ int get_breakindex(int ix) @@ -1552,10 +1542,11 @@ char* prompt = "(h = help)>"; int i, dbgix, b, t, pc, pc2, oldpc; int cbix; + int tlno; int count; int dummy; char prev_cmd, cmd; - static int lno = -1; + static int lno = 1; prev_cmd = 's'; while (reading_cmds && *singlestep) { @@ -1711,13 +1702,16 @@ break; case 'w': switch (word[0][1]) { + case '\0': case '\n': pc = ptab[curpr].pc; printf("Current process # %d: %s pc = %d b = %d t = %d\n", curpr,tab[ptab[curpr].tabix].name, pc, ptab[curpr].b, ptab[curpr].t); dbgix = pc_to_dbgix(pc); - printf(" line %d of %s\n",dbg[dbgix].flno, + tlno = dbg[dbgix].flno; + if (tlno < 0) tlno = - tlno; + printf(" line %d of %s\n",tlno, inputfile[dbg[dbgix].fix].fname); break; case 'c': @@ -1868,6 +1862,7 @@ if (i == parm_cnt) return i; op_addr = saddr_check(curpr,s[parm_offset]); parm_offset++; + tempbuf[0] = '\0'; switch (*fp) { case 'd': if (next_word(tempbuf,&sp)< 0) return i; @@ -1937,14 +1932,16 @@ i = 0; parm_offset = scan_strix + 1; while(*fp) { - while((*fp)&&(*fp != '%')) { + while(*fp) { /* copy non-format stuff directly into output buffer */ + if (*fp == '\\') fp++; // copy escaped char directly + else if (*fp == '%') break; *bp = *fp; fp++; bp++; } /* if there's format left, use it */ if (*fp == '%') { - if (i == parm_cnt) return; + if (i > parm_cnt) break; /* must check for %q -- it's a BACI special */ if (*(fp+1) == 'q') { if (i <= parm_cnt) { @@ -2435,145 +2432,5 @@ /* - * - * $Log$ - * Revision 2.18 2001/07/21 19:28:59 bynum - * remove atoi from SunOS extern declarations - * - * Revision 2.17 2001/07/20 13:17:40 bynum - * surround atoi declaration with if !defined(DOS) - * - * Revision 2.16 2001/07/20 13:12:33 bynum - * change to __randomize() - * - * Revision 2.15 2001/07/13 19:35:43 bynum - * add stdlib.h include for exit, add globtabs.h include - * - * Revision 2.14 2001/03/15 17:53:36 bynum - * in chooseproc, change add = 1 + __random(PMAXM1) - * - * Revision 2.13 2000/08/04 17:35:41 bynum - * replace last_dbg_ix with last_dbg - * - * Revision 2.12 2000/08/03 21:11:10 bynum - * change all random and urandom calls to __random and __urandom - * - * Revision 2.11 2000/06/14 20:40:26 bynum - * To debugger, add 'r' cmd to reload pcode file and 'o' cmd to load a - * new pcode file - * - * Revision 2.10 2000/06/07 17:48:39 bynum - * incorporate the code from the BACI GUI directory - * - * Revision 1.21 1999/09/07 16:30:59 bynum - * add case for global vbls in get_stack_addr - * - * Revision 1.20 1999/08/12 15:33:23 bynum - * add declaration of extern time() in a #if defined(SunOS) bracket - * - * Revision 1.19 1999/08/12 14:45:33 bynum - * In TCL verrsion, change to statically allocated infile array, add - * TCLread_file_info proc to read the file info into the static array - * (replacing the library read_file_info proc), fix errors in get_stac_addr - * proc (thanks to Brad Taylor), add write_header timestamp proc, delete - * stopcmd proc, in runinit add while (Tk_DoOneEvent(TK_NO_WAIT)); loops - * to ensure that X events are taken care of (avoids SEGVs) - * - * Revision 1.18 1999/07/29 16:14:25 bynum - * change runinit, init_interperet, global_init, global_tcl_init so that - * a gui user can rerun a pcode file, add checks of calculated ptab data - * in init_interpreter, allow inclusion of .pco in filename - * - * Revision 1.17 1999/07/28 19:19:39 bynum - * add commenting, add breakpoint handling procs, fix errors in user - * interface - * - * Revision 1.16 1998/08/18 14:08:43 bynum - * remove curpr global, move into parmlist of many functions, add - * functions to display arrays, add init_process_displays to fix - * global scope bug - * - * Revision 1.15 1998/07/16 18:24:27 bynum - * add code to support handling of breakpoints in the gui version - * - * Revision 1.14 1998/06/26 15:46:05 bynum - * switch from insertFile call in runinit to loadAllFiles to implement loading - * multiple files - * - * Revision 1.13 1998/06/26 13:15:49 bynum - * add parms to chooseproc, switch from tcl_printf(*,0) to tcl_1printf(*,0) - * - * Revision 1.12 1998/06/05 12:25:54 bynum - * get rid of tcl_writeln proc, switch from tcl_printf to tcl_1printf - * for output to proc0 window, use automatically allocated buffers - * in the tcl_printf, tcl_1printf, tcl_putnum, tcl_putchar procs - * (too many people using tcl_buffer!!) - * - * Revision 1.11 1998/05/29 19:35:11 bynum - * change to pc_to_dbix() call from current_dbix(), implement setting - * breakpoints by source lines in debugger, implement listing source file - * in debugger - * - * Revision 1.10 1998/05/28 16:23:01 bynum - * move tcl_ procs from main.c, add if defined(TCL) code, change - * debugging output to include pnn proc no, add getInfile proc - * - * Revision 1.9 1998/05/26 13:36:33 bynum - * incorporate tcl_printf() and other tcl functions from main.c - * bring Vince's code into agreement with the 5/98 BACI code so that - * both gui and std interpreter can be built from the same source files - * - * Revision 2.7 1997/10/24 09:34:35 bynum - * add semicolon to empty default case, fix off-by-one in clock_tick(xpc) - * - * Revision 2.6 1997/10/23 13:26:47 bynum - * change breakpoint machinery to display a "logical" breakpoint index - * - * Revision 2.5 1997/10/19 07:06:06 bynum - * make sscanf declaration acceptable to LINUX - * - * Revision 2.4 1997/09/05 16:39:02 bynum - * fix cpfmt() proc - * - * Revision 2.3 1997/09/04 10:57:43 bynum - * add sprintf, sscanf - * - * Revision 2.2 1997/07/10 17:20:14 bynum - * improve write_process_table output - * - * Revision 2.1 1997/07/02 13:41:15 bynum - * move interpreter utils from bainterp.c here, add debugger utils - * - * Revision 2.0 1997/06/30 06:59:21 bynum - * first version with level 0 globals - * - * Revision 1.8 1997/03/25 14:55:59 bynum - * ncorporate name changes from the include directory, add fprintf prototype - * - * Revision 1.7 1996/03/07 09:32:41 bynum - * remove 'filename_line' declaration - * - * Revision 1.6 1995/11/20 16:07:26 bynum - * change "magic phrase" that intepreter looks for, change interpreter - * flag - * - * Revision 1.5 1995/09/07 14:53:40 bynum - * remove baiglobs.h include, tweak pgm name flag slightly - * - * Revision 1.4 1995/09/07 14:42:00 bynum - * move code to read the global tables to the ../lib/read_tables.c file, - * change includes to conform to new structure of ../include directory - * change from K&R proc headers to ANSI C headers - * - * Revision 1.3 1995/08/29 15:57:20 bynum - * add -p option message in 'show_help', add code to create the interp - * program name string automatically from the date string - * - * Revision 1.2 1995/07/06 14:33:15 bynum - * add 'atomic' field - * - * Revision 1.1 1995/06/22 06:51:31 bynum - * Initial revision - * - * + * $Id$ */ diff -ur bacisrc/interp/main.c bacisrc.ok/interp/main.c --- bacisrc/interp/main.c 2004-04-15 13:31:24.000000000 +0200 +++ bacisrc.ok/interp/main.c 2005-10-26 22:11:03.000000000 +0200 @@ -19,7 +19,7 @@ #if defined(TCL) /* GUI interpreter */ #include "tcl.h" -#include +#include "tk.h" #include #include #include "../include/bacicnty.h" @@ -107,21 +107,21 @@ exit(1); } /* Create commands and common variables */ - Tcl_CreateCommand(interp, "run", runinit, (ClientData) NULL, + Tcl_CreateCommand(interp, "run", (Tcl_CmdProc *) runinit, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); - Tcl_CreateCommand(interp, "getInfile", getInfile, (ClientData) NULL, - (Tcl_CmdDeleteProc *) NULL); - Tcl_CreateCommand(interp, "getBreakpoint", getBreakpoint, (ClientData) NULL, - (Tcl_CmdDeleteProc *) NULL); - Tcl_CreateCommand(interp, "setBreakpoint", setBreakpoint, (ClientData) NULL, - (Tcl_CmdDeleteProc *) NULL); - Tcl_CreateCommand(interp, "unsetBreakpoint", unsetBreakpoint, + Tcl_CreateCommand(interp, "getInfile", (Tcl_CmdProc*) getInfile, + (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); + Tcl_CreateCommand(interp, "getBreakpoint", (Tcl_CmdProc *) getBreakpoint, + (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); + Tcl_CreateCommand(interp, "setBreakpoint", (Tcl_CmdProc *) setBreakpoint, + (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); + Tcl_CreateCommand(interp, "unsetBreakpoint", (Tcl_CmdProc *) unsetBreakpoint, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); - Tcl_CreateCommand(interp, "LinenoToPC", LinenoToPC, + Tcl_CreateCommand(interp, "LinenoToPC", (Tcl_CmdProc *) LinenoToPC, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); - Tcl_CreateCommand(interp, "LineHasBreak", LineHasBreak, + Tcl_CreateCommand(interp, "LineHasBreak", (Tcl_CmdProc *) LineHasBreak, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); - Tcl_CreateCommand(interp, "WriteData", WriteData, + Tcl_CreateCommand(interp, "WriteData", (Tcl_CmdProc *) WriteData, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); Tcl_LinkVar(interp, "tinitAR_db", (char *) &initAR_db, TCL_LINK_INT); diff -ur bacisrc/interp/Makefile bacisrc.ok/interp/Makefile --- bacisrc/interp/Makefile 2004-04-15 13:31:24.000000000 +0200 +++ bacisrc.ok/interp/Makefile 2005-10-26 22:11:03.000000000 +0200 @@ -1,15 +1,34 @@ # makefile for BenAri Concurrent Pascal PCODE Interpreter in C # +## Particularize to your Tcl, Tk installation +## For Suse +LTCL = -ltcl8.4 +LTK = -ltk8.4 +TCLINCDIR = $(HOME)/tcl8.4.10/generic +TKINCDIR = $(HOME)/tk8.4.10/generic +## For RedHat workstation 3 +#LTCL = -ltcl8.3 +#LTK = -ltk8.3 +#TCLINCDIR = /usr/local/tcl/generic +#TKINCDIR = /usr/local/tk/generic +## For Cygwin +#LTCL = -ltcl8.4 +#LTK = -ltk8.4 +#TCLINCDIR = /usr/include/ +#TKINCDIR = /usr/include +# +# OBJS=main.o bainterp.o baiutils.o random.o date.o ../lib/globtabs.o INCDIR = ../include INCLS=$(INCDIR)/globdata.h $(INCDIR)/bacicnty.h \ - $(INCDIR)/disutils.h $(INCDIR)/genutil.h $(INCDIR)/readtab.h random.h + $(INCDIR)/disutils.h $(INCDIR)/genutil.h $(INCDIR)/readtab.h random.h CC=gcc +CFLAGS=-Wall -g $(DEFINES) -I$(INCDIR) #CC=cc -CFLAGS= -Wall -g -#CFLAGS=-Wall -g $(DEFINES) -I$(INCDIR) +#CFLAGS= -Wall -g #CFLAGS=-g $(DEFINES) -I$(INCDIR) LIBDIR= ../lib +UNAMECMD=`uname -s | sed -e 's/CYGWIN_.*/CYGWIN/'` which: @echo "What do you want to make for `uname -s`?" @@ -19,32 +38,38 @@ gui: make clean - make "OS=`uname -s`" whichgui + make "OS=$(UNAMECMD)" whichgui whichgui: $(LIBDIR)/checkLastOS '*.o' make $(OS)gui -Darwingui: - make "DEFINES=-DMACOSX -DTCL" "LLIBS=-ltk -ltcl -lX11 -ldl -lm" \ - "INCDIRS=-I$(INCDIR)" \ +CYGWINgui: + make "DEFINES=-DLinux -DTCL" "LLIBS=$(LTCL) $(LTK) -lX11 -lm" \ + "INCDIRS= -I$(INCDIR) -I$(TCLINCDIR) -I$(TKINCDIR)" \ "LDFLAGS= -L/usr/lib -L/usr/local/lib -L/usr/X11R6/lib" \ guibainterp -Linuxgui: - make "DEFINES=-DLinux -DTCL" "LLIBS=-ltk -ltcl -lX11 -ldl -lm" \ - "INCDIRS=-I$(INCDIR)" \ +Darwingui: + make "DEFINES=-DMACOSX -DTCL" "LLIBS=$(LTCL) $(LTK) -lX11 -ldl -lm" \ + "INCDIRS= -I$(INCDIR) -I$(TCLINCDIR) -I$(TKINCDIR)" \ "LDFLAGS= -L/usr/lib -L/usr/local/lib -L/usr/X11R6/lib" \ guibainterp -SunOSgui: - make "DEFINES=-DSunOS -DTCL -DTcl7_5" "LLIBS=-ltk8.0 -ltcl8.0 -lX11 -lm" \ +IRIXgui: + make "DEFINES=-DIRIX -DTCL" "LLIBS=-ltkx -ltclx -lX11 -lm" \ "INCDIRS=-I$(INCDIR) -I/usr/local/include" \ "LDFLAGS= -L/usr/lib -L/usr/local/lib -L/usr/X11R6/lib" \ guibainterp -IRIXgui: - make "DEFINES=-DIRIX -DTCL" "LLIBS=-ltkx -ltclx -lX11 -lm" \ +Linuxgui: + make "DEFINES=-DLinux -DTCL" "LLIBS=$(LTCL) $(LTK) -lX11 -lm" \ + "INCDIRS= -I$(INCDIR) -I$(TCLINCDIR) -I$(TKINCDIR)" \ + "LDFLAGS= -L/usr/lib -L/usr/local/lib -L/usr/X11R6/lib" \ + guibainterp + +SunOSgui: + make "DEFINES=-DSunOS -DTCL -DTcl7_5" "LLIBS=-ltk8.0 -ltcl8.0 -lX11 -lm" \ "INCDIRS=-I$(INCDIR) -I/usr/local/include" \ "LDFLAGS= -L/usr/lib -L/usr/local/lib -L/usr/X11R6/lib" \ guibainterp @@ -102,29 +127,7 @@ rm -f main.o bainterp.o baiutils.o random.o ../lib/makedate # -# -# $Log$ -# Revision 2.0 2000/06/07 17:54:14 bynum -# switch to Makefile from the BACI GUI directory -# -# Revision 1.1 1999/08/12 15:57:22 bynum -# Initial revision -# -# Revision 1.5 1996/03/07 09:38:07 bynum -# correct 'makedate' call -# -# Revision 1.4 1996/03/07 09:33:36 bynum -# change file name to 'Makefile', add 'date.o' target -# -# Revision 1.3 1995/09/14 13:36:42 bynum -# add cd to lib directory in bainterp target -# -# Revision 1.2 1995/09/07 14:45:03 bynum -# add references to ../lib directory and add library reference in -# the final compilation step, change bpcinter.c to main.c -# -# Revision 1.1 1995/06/22 06:49:19 bynum -# Initial revision -# -# +# $Id$ # + + diff -ur bacisrc/lib/compdata.c bacisrc.ok/lib/compdata.c --- bacisrc/lib/compdata.c 2004-04-15 13:31:23.000000000 +0200 +++ bacisrc.ok/lib/compdata.c 2005-10-26 22:11:03.000000000 +0200 @@ -18,7 +18,6 @@ int errcount; /* count of parsing errors */ -int first_stringerr; int first_parmcterr; /* for the expression subtrees of the parsetree */ @@ -28,6 +27,9 @@ /* * * $Log$ + * Revision 1.9 2004/07/21 19:13:03 bynum + * get rid of first_stringerr var + * * Revision 1.8 2001/07/21 17:26:12 bynum * replace ../include in bacicnty.h include * diff -ur bacisrc/lib/computil.c bacisrc.ok/lib/computil.c --- bacisrc/lib/computil.c 2004-04-15 13:31:23.000000000 +0200 +++ bacisrc.ok/lib/computil.c 2005-10-26 22:11:03.000000000 +0200 @@ -103,7 +103,7 @@ j = btab[display[vislevel]].last; /* name is at "vislevel" static level */ l = j; while (strcmp(tab[j].name,tmpid)) j = tab[j].link; - if ((j != 0)&&(tab[j].lev == vislevel)) { + if (j != 0) { sprintf(ubuf,"Duplicate identifier '%s' at level %d",tmpid,vislevel); yyerror(ubuf); return(0); @@ -257,6 +257,7 @@ if (expr[i].free){ expr[i].obj = constant; expr[i].typ = notyp; + expr[i].tix = -1; expr[i].adr = expr[i].ref = 0; expr[i].lev = expr[i].normal = expr[i].result_used = 0; expr[i].arelt = expr[i].isval = expr[i].free = 0; @@ -713,9 +714,15 @@ /* was stored */ { + char buf[512]; extern char laststring[]; int t; int slen, oldsx, newsx; + int i; + int len = strlen(str); + /* first ASCII-ize the string */ + for (i = 0; i< len; i++) + if (!isascii(str[i])) str[i] = '?'; if (*sx > 0) { t = 0; while (t < *sx) { @@ -775,7 +782,7 @@ char name[30]; char what[30]; name[0] = '\0'; - for(ix = 0; ix < last_tab; ix++) { + for(ix = 0; ix <= last_tab; ix++) { switch (tab[ix].obj) { case ext_procedure: strcpy(name,tab[ix].name); @@ -892,6 +899,23 @@ fclose(pcode); } /* of write_pcode */ +void check_expr_list() +{ + extern int last_predeclared; + int i; + printf("List of in-use exprs\n"); + for (i = 0; i < EXPRSIZE; i++) + if (!expr[i].free) { + printf("Expression %d in use: obj %s type %s tix %d name %s\n", + i,objnames[expr[i].obj],typenames[expr[i].typ], + expr[i].tix-last_predeclared, + tab[expr[i].tix].name); + printf(" adr %x ref %d lev %d arelt %d isval %d result_used %d\n", + expr[i].adr,expr[i].ref,expr[i].lev,expr[i].arelt,expr[i].isval, + expr[i].result_used); + } +} + /* main pgm for the BenAri Compilers */ int main(int argc,char **argv) @@ -920,12 +944,16 @@ } write_pcode(pcode_fname,comp_pname,filename_line); fprintf(stderr,"Compilation listing is stored in %s\n",list_fname); + /*check_expr_list(); uncomment to check for non-free expr's */ return(retval); } /* * * $Log$ + * Revision 1.22 2004/07/21 19:10:18 bynum + * correct minor errors, add check_expr_list(), ascii-ize input strings + * * Revision 1.21 2003/11/01 13:48:08 bynum * Moti's bug fix for read(a[i]) * diff -ur bacisrc/lib/disutils.c bacisrc.ok/lib/disutils.c --- bacisrc/lib/disutils.c 2004-04-15 13:31:23.000000000 +0200 +++ bacisrc.ok/lib/disutils.c 2005-10-26 22:11:03.000000000 +0200 @@ -14,7 +14,6 @@ int last_cbtab; extern int last_tab; -int main_cbix; /* index of the cbtab[] entry for main proc */ int build_cbtab() /* @@ -50,11 +49,6 @@ } } } - for (ix = 0; ix < cbix; ix++) - if (tab[cbtab[ix].tix].obj == mainproc) { - main_cbix = ix; - break; - } return cbix; } /* build_cbtab */ @@ -85,10 +79,16 @@ { int jx; int ix; + int mon; if ((offset == 0)&&(level > 0)) return tabix; /* function return value */ ix = find_var(tabix,level,offset); if (ix > 0) return ix; + mon = tab[tabix].mon; + if (mon > 0) { // if a mon proc, then look in the monitor next + ix = find_var(mon,level,offset); + if (ix > 0) return ix; + } for (jx = 0; jx <= last_cbtab; jx++) { if ((tab[cbtab[jx].tix].lev < tab[tabix].lev) || (tab[cbtab[jx].tix].obj == outerblock)) { @@ -328,7 +328,7 @@ strcat(dl,"WRITELN\n"); break; /* 63 */ case WHICH_PROC: /* 71, which_proc */ - strcat(dl,"WHICHPROC, push # current process\n"); + strcat(dl,"WHICH_PROC, push # current process\n"); break; case SUSPEND: /* 72, suspend */ strcat(dl,"SUSPEND current process\n"); @@ -435,6 +435,15 @@ /* * $Log$ + * Revision 1.15 2005/06/19 21:24:01 bynum + * get rid of main_cbix variable + * + * Revision 1.14 2005/06/19 20:59:08 bynum + * correct WHICH_PROC output + * + * Revision 1.13 2004/07/21 19:12:10 bynum + * add check of enclosing monitor when required in search_var() + * * Revision 1.12 2003/05/07 21:54:47 bynum * change disassembler output slightly * diff -ur bacisrc/lib/globdata.c bacisrc.ok/lib/globdata.c --- bacisrc/lib/globdata.c 2004-04-15 13:31:23.000000000 +0200 +++ bacisrc.ok/lib/globdata.c 2005-10-26 22:11:03.000000000 +0200 @@ -15,7 +15,7 @@ /* used with -c option when there is no main() proc */ TYPENAME typenames[] = {"notyp","int","bool","char","bsem", - "sem","cond","array"}; + "sem","cond","array","","","rawstr","string"}; OBJNAME objnames[] = {"constant","variable","type","procedure", "function","monitor"}; @@ -26,6 +26,12 @@ /* * * $Log$ + * Revision 1.11 2005/10/26 20:04:48 bynum + * change typenames entries + * + * Revision 1.10 2005/06/19 21:01:37 bynum + * add rawstring and string to typenames array + * * Revision 1.9 2001/07/21 17:28:52 bynum * add ../include to bacicnty.h include *