EasyLocal++ Documentation |
|
ExpSpec.tab.cpp00001 00002 /* A Bison parser, made from ExpSpec.y 00003 by GNU Bison version 1.28 */ 00004 00005 #define YYBISON 1 /* Identify Bison output. */ 00006 00007 #define INSTANCE 257 00008 #define OUTPUT_PREFIX 258 00009 #define LOG_FILE 259 00010 #define PLOT_PREFIX 260 00011 #define TRIALS 261 00012 #define RUNNER 262 00013 #define TABU_SEARCH 263 00014 #define HILL_CLIMBING 264 00015 #define SIMULATED_ANNEALING 265 00016 #define MAX_ITERATION 266 00017 #define MAX_IDLE_ITERATION 267 00018 #define MIN_TABU_TENURE 268 00019 #define MAX_TABU_TENURE 269 00020 #define START_TEMPERATURE 270 00021 #define COOLING_RATE 271 00022 #define NEIGHBORS_SAMPLED 272 00023 #define BBLOCK 273 00024 #define EBLOCK 274 00025 #define ESTMT 275 00026 #define IDENTIFIER 276 00027 #define STRING 277 00028 #define NATURAL 278 00029 #define REAL 279 00030 00031 #line 18 "ExpSpec.y" 00032 00033 #include <iostream> 00034 #include <cstdlib> // for free(void*) 00035 #include <cstdio> 00036 #include <string> 00037 #include <list> 00038 00039 #include <FlexLexer.h> 00040 #include "EasyLocal.h" 00041 00042 using namespace easylocal; 00043 00044 #define YYERROR_VERBOSE 00045 00046 extern "C++" int yylex(); 00047 extern unsigned int yycolno; 00048 extern int yylineno; 00049 AbstractTester* main_tester; 00050 00051 /* this is the function for error handling/notify/recovery, for our purposes 00052 it simply writes an error info */ 00053 int yyerror(const char* s) { 00054 printf("At line %d column %d %s\n", yylineno, yycolno, s); 00055 return -1; 00056 } 00057 00058 struct ix_parbox { 00059 unsigned int i; 00060 ParameterBox* pb; 00061 }; 00062 00063 00064 #line 53 "ExpSpec.y" 00065 typedef union { 00066 std::string* char_string; 00067 unsigned long natural; 00068 double real; 00069 ParameterBox* par_box; 00070 } YYSTYPE; 00071 #include <stdio.h> 00072 00073 #ifndef __cplusplus 00074 #ifndef __STDC__ 00075 #define const 00076 #endif 00077 #endif 00078 00079 00080 00081 #define YYFINAL 91 00082 #define YYFLAG -32768 00083 #define YYNTBASE 26 00084 00085 #define YYTRANSLATE(x) ((unsigned)(x) <= 279 ? yytranslate[x] : 48) 00086 00087 static const char yytranslate[] = { 0, 00088 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00089 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00090 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00091 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00092 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00093 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00094 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00095 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00096 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00097 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00098 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00099 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00100 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00101 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00102 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00103 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00104 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00105 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00106 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00107 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00108 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00109 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00110 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00111 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00112 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00113 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 00114 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 00115 17, 18, 19, 20, 21, 22, 23, 24, 25 00116 }; 00117 00118 #if YYDEBUG != 0 00119 static const short yyprhs[] = { 0, 00120 0, 1, 4, 5, 10, 15, 18, 21, 24, 27, 00121 30, 33, 34, 38, 39, 43, 44, 48, 49, 53, 00122 55, 58, 59, 60, 69, 70, 71, 80, 81, 82, 00123 91, 95, 102, 112, 125, 135 00124 }; 00125 00126 static const short yyrhs[] = { -1, 00127 27, 26, 0, 0, 3, 23, 28, 29, 0, 19, 00128 30, 37, 20, 0, 33, 31, 0, 31, 33, 0, 00129 34, 32, 0, 32, 34, 0, 35, 36, 0, 36, 00130 35, 0, 0, 7, 24, 21, 0, 0, 5, 23, 00131 21, 0, 0, 4, 23, 21, 0, 0, 6, 23, 00132 21, 0, 38, 0, 38, 37, 0, 0, 0, 8, 00133 10, 23, 39, 19, 45, 40, 20, 0, 0, 0, 00134 8, 9, 23, 41, 19, 46, 42, 20, 0, 0, 00135 0, 8, 11, 23, 43, 19, 47, 44, 20, 0, 00136 13, 24, 21, 0, 13, 24, 21, 12, 24, 21, 00137 0, 14, 24, 21, 15, 24, 21, 13, 24, 21, 00138 0, 14, 24, 21, 15, 24, 21, 13, 24, 21, 00139 12, 24, 21, 0, 16, 25, 21, 17, 25, 21, 00140 18, 24, 21, 0, 16, 25, 21, 17, 25, 21, 00141 18, 24, 21, 12, 24, 21, 0 00142 }; 00143 00144 #endif 00145 00146 #if YYDEBUG != 0 00147 static const short yyrline[] = { 0, 00148 94, 95, 101, 109, 111, 120, 120, 122, 122, 124, 00149 125, 127, 131, 137, 139, 145, 147, 154, 156, 164, 00150 165, 168, 188, 193, 193, 213, 218, 218, 238, 243, 00151 245, 251, 260, 270, 283, 293 00152 }; 00153 #endif 00154 00155 00156 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) 00157 00158 static const char * const yytname[] = { "$","error","$undefined.","\"Instance\"", 00159 "\"Output prefix\"","\"Log file\"","\"Plot prefix\"","\"Trials\"","\"Runner\"", 00160 "\"tabu search\"","\"hill climbing\"","\"simulated annealing\"","\"max iteration\"", 00161 "\"max idle iteration\"","\"min tabu tenure\"","\"max tabu tenure\"","\"start temperature\"", 00162 "\"cooling rate\"","\"neighbors sampled\"","\"{\"","\"}\"","\";\"","\"identifier\"", 00163 "\"string\"","\"natural\"","\"real\"","instances","instance","@1","solver","other_parameters", 00164 "file_parameters","output_and_plot","solver_trials","log_file","output_file_prefix", 00165 "plot_file_prefix","runners","runner","@2","@3","@4","@5","@6","@7","hc_parameters", 00166 "ts_parameters","sa_parameters", NULL 00167 }; 00168 #endif 00169 00170 static const short yyr1[] = { 0, 00171 26, 26, 28, 27, 29, 30, 30, 31, 31, 32, 00172 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 00173 37, 39, 40, 38, 41, 42, 38, 43, 44, 38, 00174 45, 45, 46, 46, 47, 47 00175 }; 00176 00177 static const short yyr2[] = { 0, 00178 0, 2, 0, 4, 4, 2, 2, 2, 2, 2, 00179 2, 0, 3, 0, 3, 0, 3, 0, 3, 1, 00180 2, 0, 0, 8, 0, 0, 8, 0, 0, 8, 00181 3, 6, 9, 12, 9, 12 00182 }; 00183 00184 static const short yydefact[] = { 1, 00185 0, 1, 3, 2, 0, 12, 4, 0, 0, 0, 00186 0, 0, 12, 14, 14, 16, 18, 16, 0, 0, 00187 0, 0, 0, 0, 20, 7, 9, 6, 8, 10, 00188 11, 17, 15, 19, 13, 0, 0, 0, 5, 21, 00189 25, 22, 28, 0, 0, 0, 0, 0, 0, 0, 00190 26, 0, 23, 0, 29, 0, 0, 0, 0, 0, 00191 0, 0, 27, 31, 24, 0, 30, 0, 0, 0, 00192 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 00193 33, 35, 0, 0, 0, 0, 34, 36, 0, 0, 00194 0 00195 }; 00196 00197 static const short yydefgoto[] = { 4, 00198 2, 5, 7, 12, 13, 14, 15, 16, 17, 18, 00199 24, 25, 45, 59, 44, 57, 46, 61, 53, 51, 00200 55 00201 }; 00202 00203 static const short yypact[] = { 8, 00204 -10, 8,-32768,-32768, -5, -4,-32768, -8, -7, -6, 00205 -3, 10, 12, 15, 0, 6, 16, 19, 3, 4, 00206 5, 7, -2, 9, 10,-32768,-32768,-32768,-32768,-32768, 00207 -32768,-32768,-32768,-32768,-32768, 11, 13, 14,-32768,-32768, 00208 -32768,-32768,-32768, 20, 21, 22, 17, 25, 26, 23, 00209 -32768, 24,-32768, 2,-32768, 28, 30, 31, 33, 34, 00210 36, 18,-32768, 32,-32768, 29,-32768, 27, 35, 37, 00211 39, 40, 42, 41,-32768, 46, 43, 44, 45, 48, 00212 53, 58, 47, 49, 51, 54,-32768,-32768, 57, 74, 00213 -32768 00214 }; 00215 00216 static const short yypgoto[] = { 76, 00217 -32768,-32768,-32768,-32768, 62, 63, 65, 66, 64, 67, 00218 56,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 00219 -32768 00220 }; 00221 00222 00223 #define YYLAST 84 00224 00225 00226 static const short yytable[] = { 8, 00227 9, 10, 11, 8, 9, 10, 36, 37, 38, 8, 00228 1, 10, 3, 6, 19, 20, 21, 23, 11, 9, 00229 22, 10, 8, 32, 33, 34, 60, 35, 39, 0, 00230 50, 0, 68, 41, 0, 42, 43, 52, 47, 48, 00231 49, 54, 0, 69, 0, 70, 56, 58, 62, 63, 00232 71, 64, 65, 77, 66, 67, 90, 0, 72, 74, 00233 75, 73, 76, 78, 83, 81, 79, 80, 82, 84, 00234 85, 87, 86, 91, 88, 89, 28, 26, 29, 27, 00235 40, 31, 0, 30 00236 }; 00237 00238 static const short yycheck[] = { 4, 00239 5, 6, 7, 4, 5, 6, 9, 10, 11, 4, 00240 3, 6, 23, 19, 23, 23, 23, 8, 7, 5, 00241 24, 6, 4, 21, 21, 21, 25, 21, 20, -1, 00242 14, -1, 15, 23, -1, 23, 23, 13, 19, 19, 00243 19, 16, -1, 12, -1, 17, 24, 24, 21, 20, 00244 24, 21, 20, 13, 21, 20, 0, -1, 24, 21, 00245 21, 25, 21, 18, 12, 21, 24, 24, 21, 12, 00246 24, 21, 24, 0, 21, 0, 15, 13, 16, 14, 00247 25, 18, -1, 17 00248 }; 00249 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ 00250 #line 3 "/usr/share/bison.simple" 00251 /* This file comes from bison-1.28. */ 00252 00253 /* Skeleton output parser for bison, 00254 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. 00255 00256 This program is free software; you can redistribute it and/or modify 00257 it under the terms of the GNU General Public License as published by 00258 the Free Software Foundation; either version 2, or (at your option) 00259 any later version. 00260 00261 This program is distributed in the hope that it will be useful, 00262 but WITHOUT ANY WARRANTY; without even the implied warranty of 00263 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00264 GNU General Public License for more details. 00265 00266 You should have received a copy of the GNU General Public License 00267 along with this program; if not, write to the Free Software 00268 Foundation, Inc., 59 Temple Place - Suite 330, 00269 Boston, MA 02111-1307, USA. */ 00270 00271 /* As a special exception, when this file is copied by Bison into a 00272 Bison output file, you may use that output file without restriction. 00273 This special exception was added by the Free Software Foundation 00274 in version 1.24 of Bison. */ 00275 00276 /* This is the parser code that is written into each bison parser 00277 when the %semantic_parser declaration is not specified in the grammar. 00278 It was written by Richard Stallman by simplifying the hairy parser 00279 used when %semantic_parser is specified. */ 00280 00281 #ifndef YYSTACK_USE_ALLOCA 00282 #ifdef alloca 00283 #define YYSTACK_USE_ALLOCA 00284 #else /* alloca not defined */ 00285 #ifdef __GNUC__ 00286 #define YYSTACK_USE_ALLOCA 00287 #define alloca __builtin_alloca 00288 #else /* not GNU C. */ 00289 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) 00290 #define YYSTACK_USE_ALLOCA 00291 #include <alloca.h> 00292 #else /* not sparc */ 00293 /* We think this test detects Watcom and Microsoft C. */ 00294 /* This used to test MSDOS, but that is a bad idea 00295 since that symbol is in the user namespace. */ 00296 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) 00297 #if 0 /* No need for malloc.h, which pollutes the namespace; 00298 instead, just don't use alloca. */ 00299 #include <malloc.h> 00300 #endif 00301 #else /* not MSDOS, or __TURBOC__ */ 00302 #if defined(_AIX) 00303 /* I don't know what this was needed for, but it pollutes the namespace. 00304 So I turned it off. rms, 2 May 1997. */ 00305 /* #include <malloc.h> */ 00306 #pragma alloca 00307 #define YYSTACK_USE_ALLOCA 00308 #else /* not MSDOS, or __TURBOC__, or _AIX */ 00309 #if 0 00310 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, 00311 and on HPUX 10. Eventually we can turn this on. */ 00312 #define YYSTACK_USE_ALLOCA 00313 #define alloca __builtin_alloca 00314 #endif /* __hpux */ 00315 #endif 00316 #endif /* not _AIX */ 00317 #endif /* not MSDOS, or __TURBOC__ */ 00318 #endif /* not sparc */ 00319 #endif /* not GNU C */ 00320 #endif /* alloca not defined */ 00321 #endif /* YYSTACK_USE_ALLOCA not defined */ 00322 00323 #ifdef YYSTACK_USE_ALLOCA 00324 #define YYSTACK_ALLOC alloca 00325 #else 00326 #define YYSTACK_ALLOC malloc 00327 #endif 00328 00329 /* Note: there must be only one dollar sign in this file. 00330 It is replaced by the list of actions, each action 00331 as one case of the switch. */ 00332 00333 #define yyerrok (yyerrstatus = 0) 00334 #define yyclearin (yychar = YYEMPTY) 00335 #define YYEMPTY -2 00336 #define YYEOF 0 00337 #define YYACCEPT goto yyacceptlab 00338 #define YYABORT goto yyabortlab 00339 #define YYERROR goto yyerrlab1 00340 /* Like YYERROR except do call yyerror. 00341 This remains here temporarily to ease the 00342 transition to the new meaning of YYERROR, for GCC. 00343 Once GCC version 2 has supplanted version 1, this can go. */ 00344 #define YYFAIL goto yyerrlab 00345 #define YYRECOVERING() (!!yyerrstatus) 00346 #define YYBACKUP(token, value) \ 00347 do \ 00348 if (yychar == YYEMPTY && yylen == 1) \ 00349 { yychar = (token), yylval = (value); \ 00350 yychar1 = YYTRANSLATE (yychar); \ 00351 YYPOPSTACK; \ 00352 goto yybackup; \ 00353 } \ 00354 else \ 00355 { yyerror ("syntax error: cannot back up"); YYERROR; } \ 00356 while (0) 00357 00358 #define YYTERROR 1 00359 #define YYERRCODE 256 00360 00361 #ifndef YYPURE 00362 #define YYLEX yylex() 00363 #endif 00364 00365 #ifdef YYPURE 00366 #ifdef YYLSP_NEEDED 00367 #ifdef YYLEX_PARAM 00368 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) 00369 #else 00370 #define YYLEX yylex(&yylval, &yylloc) 00371 #endif 00372 #else /* not YYLSP_NEEDED */ 00373 #ifdef YYLEX_PARAM 00374 #define YYLEX yylex(&yylval, YYLEX_PARAM) 00375 #else 00376 #define YYLEX yylex(&yylval) 00377 #endif 00378 #endif /* not YYLSP_NEEDED */ 00379 #endif 00380 00381 /* If nonreentrant, generate the variables here */ 00382 00383 #ifndef YYPURE 00384 00385 int yychar; /* the lookahead symbol */ 00386 YYSTYPE yylval; /* the semantic value of the */ 00387 /* lookahead symbol */ 00388 00389 #ifdef YYLSP_NEEDED 00390 YYLTYPE yylloc; /* location data for the lookahead */ 00391 /* symbol */ 00392 #endif 00393 00394 int yynerrs; /* number of parse errors so far */ 00395 #endif /* not YYPURE */ 00396 00397 #if YYDEBUG != 0 00398 int yydebug; /* nonzero means print parse trace */ 00399 /* Since this is uninitialized, it does not stop multiple parsers 00400 from coexisting. */ 00401 #endif 00402 00403 /* YYINITDEPTH indicates the initial size of the parser's stacks */ 00404 00405 #ifndef YYINITDEPTH 00406 #define YYINITDEPTH 200 00407 #endif 00408 00409 /* YYMAXDEPTH is the maximum size the stacks can grow to 00410 (effective only if the built-in stack extension method is used). */ 00411 00412 #if YYMAXDEPTH == 0 00413 #undef YYMAXDEPTH 00414 #endif 00415 00416 #ifndef YYMAXDEPTH 00417 #define YYMAXDEPTH 10000 00418 #endif 00419 00420 /* Define __yy_memcpy. Note that the size argument 00421 should be passed with type unsigned int, because that is what the non-GCC 00422 definitions require. With GCC, __builtin_memcpy takes an arg 00423 of type size_t, but it can handle unsigned int. */ 00424 00425 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ 00426 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) 00427 #else /* not GNU C or C++ */ 00428 #ifndef __cplusplus 00429 00430 /* This is the most reliable way to avoid incompatibilities 00431 in available built-in functions on various systems. */ 00432 static void 00433 __yy_memcpy (to, from, count) 00434 char *to; 00435 char *from; 00436 unsigned int count; 00437 { 00438 register char *f = from; 00439 register char *t = to; 00440 register int i = count; 00441 00442 while (i-- > 0) 00443 *t++ = *f++; 00444 } 00445 00446 #else /* __cplusplus */ 00447 00448 /* This is the most reliable way to avoid incompatibilities 00449 in available built-in functions on various systems. */ 00450 static void 00451 __yy_memcpy (char *to, char *from, unsigned int count) 00452 { 00453 register char *t = to; 00454 register char *f = from; 00455 register int i = count; 00456 00457 while (i-- > 0) 00458 *t++ = *f++; 00459 } 00460 00461 #endif 00462 #endif 00463 00464 #line 217 "/usr/share/bison.simple" 00465 00466 /* The user can define YYPARSE_PARAM as the name of an argument to be passed 00467 into yyparse. The argument should have type void *. 00468 It should actually point to an object. 00469 Grammar actions can access the variable by casting it 00470 to the proper pointer type. */ 00471 00472 #ifdef YYPARSE_PARAM 00473 #ifdef __cplusplus 00474 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM 00475 #define YYPARSE_PARAM_DECL 00476 #else /* not __cplusplus */ 00477 #define YYPARSE_PARAM_ARG YYPARSE_PARAM 00478 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; 00479 #endif /* not __cplusplus */ 00480 #else /* not YYPARSE_PARAM */ 00481 #define YYPARSE_PARAM_ARG 00482 #define YYPARSE_PARAM_DECL 00483 #endif /* not YYPARSE_PARAM */ 00484 00485 /* Prevent warning if -Wstrict-prototypes. */ 00486 #ifdef __GNUC__ 00487 #ifdef YYPARSE_PARAM 00488 int yyparse (void *); 00489 #else 00490 int yyparse (void); 00491 #endif 00492 #endif 00493 00494 int 00495 yyparse(YYPARSE_PARAM_ARG) 00496 YYPARSE_PARAM_DECL 00497 { 00498 register int yystate; 00499 register int yyn; 00500 register short *yyssp; 00501 register YYSTYPE *yyvsp; 00502 int yyerrstatus; /* number of tokens to shift before error messages enabled */ 00503 int yychar1 = 0; /* lookahead token as an internal (translated) token number */ 00504 00505 short yyssa[YYINITDEPTH]; /* the state stack */ 00506 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ 00507 00508 short *yyss = yyssa; /* refer to the stacks thru separate pointers */ 00509 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ 00510 00511 #ifdef YYLSP_NEEDED 00512 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ 00513 YYLTYPE *yyls = yylsa; 00514 YYLTYPE *yylsp; 00515 00516 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) 00517 #else 00518 #define YYPOPSTACK (yyvsp--, yyssp--) 00519 #endif 00520 00521 int yystacksize = YYINITDEPTH; 00522 int yyfree_stacks = 0; 00523 00524 #ifdef YYPURE 00525 int yychar; 00526 YYSTYPE yylval; 00527 int yynerrs; 00528 #ifdef YYLSP_NEEDED 00529 YYLTYPE yylloc; 00530 #endif 00531 #endif 00532 00533 YYSTYPE yyval; /* the variable used to return */ 00534 /* semantic values from the action */ 00535 /* routines */ 00536 00537 int yylen; 00538 00539 #if YYDEBUG != 0 00540 if (yydebug) 00541 fprintf(stderr, "Starting parse\n"); 00542 #endif 00543 00544 yystate = 0; 00545 yyerrstatus = 0; 00546 yynerrs = 0; 00547 yychar = YYEMPTY; /* Cause a token to be read. */ 00548 00549 /* Initialize stack pointers. 00550 Waste one element of value and location stack 00551 so that they stay on the same level as the state stack. 00552 The wasted elements are never initialized. */ 00553 00554 yyssp = yyss - 1; 00555 yyvsp = yyvs; 00556 #ifdef YYLSP_NEEDED 00557 yylsp = yyls; 00558 #endif 00559 00560 /* Push a new state, which is found in yystate . */ 00561 /* In all cases, when you get here, the value and location stacks 00562 have just been pushed. so pushing a state here evens the stacks. */ 00563 yynewstate: 00564 00565 *++yyssp = yystate; 00566 00567 if (yyssp >= yyss + yystacksize - 1) 00568 { 00569 /* Give user a chance to reallocate the stack */ 00570 /* Use copies of these so that the &'s don't force the real ones into memory. */ 00571 YYSTYPE *yyvs1 = yyvs; 00572 short *yyss1 = yyss; 00573 #ifdef YYLSP_NEEDED 00574 YYLTYPE *yyls1 = yyls; 00575 #endif 00576 00577 /* Get the current used size of the three stacks, in elements. */ 00578 int size = yyssp - yyss + 1; 00579 00580 #ifdef yyoverflow 00581 /* Each stack pointer address is followed by the size of 00582 the data in use in that stack, in bytes. */ 00583 #ifdef YYLSP_NEEDED 00584 /* This used to be a conditional around just the two extra args, 00585 but that might be undefined if yyoverflow is a macro. */ 00586 yyoverflow("parser stack overflow", 00587 &yyss1, size * sizeof (*yyssp), 00588 &yyvs1, size * sizeof (*yyvsp), 00589 &yyls1, size * sizeof (*yylsp), 00590 &yystacksize); 00591 #else 00592 yyoverflow("parser stack overflow", 00593 &yyss1, size * sizeof (*yyssp), 00594 &yyvs1, size * sizeof (*yyvsp), 00595 &yystacksize); 00596 #endif 00597 00598 yyss = yyss1; yyvs = yyvs1; 00599 #ifdef YYLSP_NEEDED 00600 yyls = yyls1; 00601 #endif 00602 #else /* no yyoverflow */ 00603 /* Extend the stack our own way. */ 00604 if (yystacksize >= YYMAXDEPTH) 00605 { 00606 yyerror("parser stack overflow"); 00607 if (yyfree_stacks) 00608 { 00609 free (yyss); 00610 free (yyvs); 00611 #ifdef YYLSP_NEEDED 00612 free (yyls); 00613 #endif 00614 } 00615 return 2; 00616 } 00617 yystacksize *= 2; 00618 if (yystacksize > YYMAXDEPTH) 00619 yystacksize = YYMAXDEPTH; 00620 #ifndef YYSTACK_USE_ALLOCA 00621 yyfree_stacks = 1; 00622 #endif 00623 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); 00624 __yy_memcpy ((char *)yyss, (char *)yyss1, 00625 size * (unsigned int) sizeof (*yyssp)); 00626 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); 00627 __yy_memcpy ((char *)yyvs, (char *)yyvs1, 00628 size * (unsigned int) sizeof (*yyvsp)); 00629 #ifdef YYLSP_NEEDED 00630 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); 00631 __yy_memcpy ((char *)yyls, (char *)yyls1, 00632 size * (unsigned int) sizeof (*yylsp)); 00633 #endif 00634 #endif /* no yyoverflow */ 00635 00636 yyssp = yyss + size - 1; 00637 yyvsp = yyvs + size - 1; 00638 #ifdef YYLSP_NEEDED 00639 yylsp = yyls + size - 1; 00640 #endif 00641 00642 #if YYDEBUG != 0 00643 if (yydebug) 00644 fprintf(stderr, "Stack size increased to %d\n", yystacksize); 00645 #endif 00646 00647 if (yyssp >= yyss + yystacksize - 1) 00648 YYABORT; 00649 } 00650 00651 #if YYDEBUG != 0 00652 if (yydebug) 00653 fprintf(stderr, "Entering state %d\n", yystate); 00654 #endif 00655 00656 goto yybackup; 00657 yybackup: 00658 00659 /* Do appropriate processing given the current state. */ 00660 /* Read a lookahead token if we need one and don't already have one. */ 00661 /* yyresume: */ 00662 00663 /* First try to decide what to do without reference to lookahead token. */ 00664 00665 yyn = yypact[yystate]; 00666 if (yyn == YYFLAG) 00667 goto yydefault; 00668 00669 /* Not known => get a lookahead token if don't already have one. */ 00670 00671 /* yychar is either YYEMPTY or YYEOF 00672 or a valid token in external form. */ 00673 00674 if (yychar == YYEMPTY) 00675 { 00676 #if YYDEBUG != 0 00677 if (yydebug) 00678 fprintf(stderr, "Reading a token: "); 00679 #endif 00680 yychar = YYLEX; 00681 } 00682 00683 /* Convert token to internal form (in yychar1) for indexing tables with */ 00684 00685 if (yychar <= 0) /* This means end of input. */ 00686 { 00687 yychar1 = 0; 00688 yychar = YYEOF; /* Don't call YYLEX any more */ 00689 00690 #if YYDEBUG != 0 00691 if (yydebug) 00692 fprintf(stderr, "Now at end of input.\n"); 00693 #endif 00694 } 00695 else 00696 { 00697 yychar1 = YYTRANSLATE(yychar); 00698 00699 #if YYDEBUG != 0 00700 if (yydebug) 00701 { 00702 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); 00703 /* Give the individual parser a way to print the precise meaning 00704 of a token, for further debugging info. */ 00705 #ifdef YYPRINT 00706 YYPRINT (stderr, yychar, yylval); 00707 #endif 00708 fprintf (stderr, ")\n"); 00709 } 00710 #endif 00711 } 00712 00713 yyn += yychar1; 00714 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) 00715 goto yydefault; 00716 00717 yyn = yytable[yyn]; 00718 00719 /* yyn is what to do for this token type in this state. 00720 Negative => reduce, -yyn is rule number. 00721 Positive => shift, yyn is new state. 00722 New state is final state => don't bother to shift, 00723 just return success. 00724 0, or most negative number => error. */ 00725 00726 if (yyn < 0) 00727 { 00728 if (yyn == YYFLAG) 00729 goto yyerrlab; 00730 yyn = -yyn; 00731 goto yyreduce; 00732 } 00733 else if (yyn == 0) 00734 goto yyerrlab; 00735 00736 if (yyn == YYFINAL) 00737 YYACCEPT; 00738 00739 /* Shift the lookahead token. */ 00740 00741 #if YYDEBUG != 0 00742 if (yydebug) 00743 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); 00744 #endif 00745 00746 /* Discard the token being shifted unless it is eof. */ 00747 if (yychar != YYEOF) 00748 yychar = YYEMPTY; 00749 00750 *++yyvsp = yylval; 00751 #ifdef YYLSP_NEEDED 00752 *++yylsp = yylloc; 00753 #endif 00754 00755 /* count tokens shifted since error; after three, turn off error status. */ 00756 if (yyerrstatus) yyerrstatus--; 00757 00758 yystate = yyn; 00759 goto yynewstate; 00760 00761 /* Do the default action for the current state. */ 00762 yydefault: 00763 00764 yyn = yydefact[yystate]; 00765 if (yyn == 0) 00766 goto yyerrlab; 00767 00768 /* Do a reduction. yyn is the number of a rule to reduce with. */ 00769 yyreduce: 00770 yylen = yyr2[yyn]; 00771 if (yylen > 0) 00772 yyval = yyvsp[1-yylen]; /* implement default value of the action */ 00773 00774 #if YYDEBUG != 0 00775 if (yydebug) 00776 { 00777 int i; 00778 00779 fprintf (stderr, "Reducing via rule %d (line %d), ", 00780 yyn, yyrline[yyn]); 00781 00782 /* Print the symbols being reduced, and their result. */ 00783 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) 00784 fprintf (stderr, "%s ", yytname[yyrhs[i]]); 00785 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); 00786 } 00787 #endif 00788 00789 00790 switch (yyn) { 00791 00792 case 3: 00793 #line 102 "ExpSpec.y" 00794 { 00795 /* write on the output stream some header data */ 00796 // write_header($2); 00797 /* get the solver from the tester class */ 00798 main_tester->LoadInstance(*yyvsp[0].char_string); 00799 ; 00800 break;} 00801 case 5: 00802 #line 115 "ExpSpec.y" 00803 { 00804 main_tester->StartSolver(); 00805 ; 00806 break;} 00807 case 12: 00808 #line 128 "ExpSpec.y" 00809 { 00810 main_tester->SetSolverTrials(1); 00811 ; 00812 break;} 00813 case 13: 00814 #line 132 "ExpSpec.y" 00815 { 00816 main_tester->SetSolverTrials(yyvsp[-1].natural); 00817 ; 00818 break;} 00819 case 14: 00820 #line 138 "ExpSpec.y" 00821 {; 00822 break;} 00823 case 15: 00824 #line 140 "ExpSpec.y" 00825 { 00826 main_tester->SetLogFile(*yyvsp[-1].char_string); 00827 delete yyvsp[-1].char_string; 00828 ; 00829 break;} 00830 case 16: 00831 #line 146 "ExpSpec.y" 00832 {; 00833 break;} 00834 case 17: 00835 #line 148 "ExpSpec.y" 00836 { 00837 main_tester->SetOutputPrefix(*yyvsp[-1].char_string); 00838 delete yyvsp[-1].char_string; 00839 ; 00840 break;} 00841 case 18: 00842 #line 155 "ExpSpec.y" 00843 {; 00844 break;} 00845 case 19: 00846 #line 157 "ExpSpec.y" 00847 { 00848 main_tester->SetPlotPrefix(*yyvsp[-1].char_string); 00849 delete yyvsp[-1].char_string; 00850 ; 00851 break;} 00852 case 22: 00853 #line 169 "ExpSpec.y" 00854 { 00855 // add runner of type hill climbing to the solver 00856 int status_value = main_tester->AddRunnerToSolver(*yyvsp[0].char_string, "Hill Climbing"); 00857 if (status_value == RUNNER_NOT_FOUND) 00858 { 00859 std::string s(*yyvsp[0].char_string); 00860 s = "runner `" + s + "' not found error"; 00861 yyerror(s.c_str()); 00862 YYABORT; 00863 } 00864 else if (status_value == RUNNER_TYPE_MISMATCH) 00865 { 00866 std::string s(*yyvsp[0].char_string); 00867 s = "runner `" + s + "' type mismatch"; 00868 yyerror(s.c_str()); 00869 YYABORT; 00870 } 00871 ; 00872 break;} 00873 case 23: 00874 #line 189 "ExpSpec.y" 00875 { 00876 main_tester->SetRunningParameters(*yyvsp[-3].char_string, "Hill Climbing", *yyvsp[0].par_box); 00877 ; 00878 break;} 00879 case 25: 00880 #line 194 "ExpSpec.y" 00881 { 00882 // add runner of type tabu search to the solver 00883 int status_value = main_tester->AddRunnerToSolver(*yyvsp[0].char_string, "Tabu Search"); 00884 if (status_value == RUNNER_NOT_FOUND) 00885 { 00886 std::string s(*yyvsp[0].char_string); 00887 s = "runner `" + s + "' not found error"; 00888 yyerror(s.c_str()); 00889 YYABORT; 00890 } 00891 else if (status_value == RUNNER_TYPE_MISMATCH) 00892 { 00893 std::string s(*yyvsp[0].char_string); 00894 s = "runner `" + s + "' type mismatch"; 00895 yyerror(s.c_str()); 00896 YYABORT; 00897 } 00898 ; 00899 break;} 00900 case 26: 00901 #line 214 "ExpSpec.y" 00902 { 00903 main_tester->SetRunningParameters(*yyvsp[-3].char_string, "Tabu Search", *yyvsp[0].par_box); 00904 ; 00905 break;} 00906 case 28: 00907 #line 219 "ExpSpec.y" 00908 { 00909 // add runner of type simulated annealing to the solver 00910 int status_value = main_tester->AddRunnerToSolver(*yyvsp[0].char_string, "Simulated Annealing"); 00911 if (status_value == RUNNER_NOT_FOUND) 00912 { 00913 std::string s(*yyvsp[0].char_string); 00914 s = "runner `" + s + "' not found error"; 00915 yyerror(s.c_str()); 00916 YYABORT; 00917 } 00918 else if (status_value == RUNNER_TYPE_MISMATCH) 00919 { 00920 std::string s(*yyvsp[0].char_string); 00921 s = "runner `" + s + "' type mismatch"; 00922 yyerror(s.c_str()); 00923 YYABORT; 00924 } 00925 ; 00926 break;} 00927 case 29: 00928 #line 239 "ExpSpec.y" 00929 { 00930 main_tester->SetRunningParameters(*yyvsp[-3].char_string, "Simulated Annealing", *yyvsp[0].par_box); 00931 ; 00932 break;} 00933 case 31: 00934 #line 246 "ExpSpec.y" 00935 { 00936 yyval.par_box = new ParameterBox; 00937 yyval.par_box->Put("max idle iteration", yyvsp[-1].natural); 00938 yyval.par_box->Put("max iteration", ULONG_MAX); 00939 ; 00940 break;} 00941 case 32: 00942 #line 253 "ExpSpec.y" 00943 { 00944 yyval.par_box = new ParameterBox; 00945 yyval.par_box->Put("max idle iteration", yyvsp[-4].natural); 00946 yyval.par_box->Put("max iteration", yyvsp[-1].natural); 00947 ; 00948 break;} 00949 case 33: 00950 #line 263 "ExpSpec.y" 00951 { 00952 yyval.par_box = new ParameterBox; 00953 yyval.par_box->Put("min tenure", (unsigned int)yyvsp[-7].natural); 00954 yyval.par_box->Put("max tenure", (unsigned int)yyvsp[-4].natural); 00955 yyval.par_box->Put("max idle iteration", yyvsp[-1].natural); 00956 yyval.par_box->Put("max iteration", ULONG_MAX); 00957 ; 00958 break;} 00959 case 34: 00960 #line 274 "ExpSpec.y" 00961 { 00962 yyval.par_box = new ParameterBox; 00963 yyval.par_box->Put("min tenure", (unsigned int)yyvsp[-10].natural); 00964 yyval.par_box->Put("max tenure", (unsigned int)yyvsp[-7].natural); 00965 yyval.par_box->Put("max idle iteration", yyvsp[-4].natural); 00966 yyval.par_box->Put("max iteration", yyvsp[-1].natural); 00967 ; 00968 break;} 00969 case 35: 00970 #line 286 "ExpSpec.y" 00971 { 00972 yyval.par_box = new ParameterBox; 00973 yyval.par_box->Put("start temperature", yyvsp[-7].real); 00974 yyval.par_box->Put("cooling rate", yyvsp[-4].real); 00975 yyval.par_box->Put("neighbors sampled", (unsigned int)yyvsp[-1].natural); 00976 yyval.par_box->Put("max iteration", ULONG_MAX); 00977 ; 00978 break;} 00979 case 36: 00980 #line 297 "ExpSpec.y" 00981 { 00982 yyval.par_box = new ParameterBox; 00983 yyval.par_box->Put("start temperature", yyvsp[-10].real); 00984 yyval.par_box->Put("cooling rate", yyvsp[-7].real); 00985 yyval.par_box->Put("neighbors sampled", (unsigned int)yyvsp[-4].natural); 00986 yyval.par_box->Put("max iteration", yyvsp[-1].natural); 00987 ; 00988 break;} 00989 } 00990 /* the action file gets copied in in place of this dollarsign */ 00991 #line 543 "/usr/share/bison.simple" 00992 00993 yyvsp -= yylen; 00994 yyssp -= yylen; 00995 #ifdef YYLSP_NEEDED 00996 yylsp -= yylen; 00997 #endif 00998 00999 #if YYDEBUG != 0 01000 if (yydebug) 01001 { 01002 short *ssp1 = yyss - 1; 01003 fprintf (stderr, "state stack now"); 01004 while (ssp1 != yyssp) 01005 fprintf (stderr, " %d", *++ssp1); 01006 fprintf (stderr, "\n"); 01007 } 01008 #endif 01009 01010 *++yyvsp = yyval; 01011 01012 #ifdef YYLSP_NEEDED 01013 yylsp++; 01014 if (yylen == 0) 01015 { 01016 yylsp->first_line = yylloc.first_line; 01017 yylsp->first_column = yylloc.first_column; 01018 yylsp->last_line = (yylsp-1)->last_line; 01019 yylsp->last_column = (yylsp-1)->last_column; 01020 yylsp->text = 0; 01021 } 01022 else 01023 { 01024 yylsp->last_line = (yylsp+yylen-1)->last_line; 01025 yylsp->last_column = (yylsp+yylen-1)->last_column; 01026 } 01027 #endif 01028 01029 /* Now "shift" the result of the reduction. 01030 Determine what state that goes to, 01031 based on the state we popped back to 01032 and the rule number reduced by. */ 01033 01034 yyn = yyr1[yyn]; 01035 01036 yystate = yypgoto[yyn - YYNTBASE] + *yyssp; 01037 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) 01038 yystate = yytable[yystate]; 01039 else 01040 yystate = yydefgoto[yyn - YYNTBASE]; 01041 01042 goto yynewstate; 01043 01044 yyerrlab: /* here on detecting error */ 01045 01046 if (! yyerrstatus) 01047 /* If not already recovering from an error, report this error. */ 01048 { 01049 ++yynerrs; 01050 01051 #ifdef YYERROR_VERBOSE 01052 yyn = yypact[yystate]; 01053 01054 if (yyn > YYFLAG && yyn < YYLAST) 01055 { 01056 int size = 0; 01057 char *msg; 01058 int x, count; 01059 01060 count = 0; 01061 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ 01062 for (x = (yyn < 0 ? -yyn : 0); 01063 x < (sizeof(yytname) / sizeof(char *)); x++) 01064 if (yycheck[x + yyn] == x) 01065 size += strlen(yytname[x]) + 15, count++; 01066 msg = (char *) malloc(size + 15); 01067 if (msg != 0) 01068 { 01069 strcpy(msg, "parse error"); 01070 01071 if (count < 5) 01072 { 01073 count = 0; 01074 for (x = (yyn < 0 ? -yyn : 0); 01075 x < (sizeof(yytname) / sizeof(char *)); x++) 01076 if (yycheck[x + yyn] == x) 01077 { 01078 strcat(msg, count == 0 ? ", expecting `" : " or `"); 01079 strcat(msg, yytname[x]); 01080 strcat(msg, "'"); 01081 count++; 01082 } 01083 } 01084 yyerror(msg); 01085 free(msg); 01086 } 01087 else 01088 yyerror ("parse error; also virtual memory exceeded"); 01089 } 01090 else 01091 #endif /* YYERROR_VERBOSE */ 01092 yyerror("parse error"); 01093 } 01094 01095 goto yyerrlab1; 01096 yyerrlab1: /* here on error raised explicitly by an action */ 01097 01098 if (yyerrstatus == 3) 01099 { 01100 /* if just tried and failed to reuse lookahead token after an error, discard it. */ 01101 01102 /* return failure if at end of input */ 01103 if (yychar == YYEOF) 01104 YYABORT; 01105 01106 #if YYDEBUG != 0 01107 if (yydebug) 01108 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); 01109 #endif 01110 01111 yychar = YYEMPTY; 01112 } 01113 01114 /* Else will try to reuse lookahead token 01115 after shifting the error token. */ 01116 01117 yyerrstatus = 3; /* Each real token shifted decrements this */ 01118 01119 goto yyerrhandle; 01120 01121 yyerrdefault: /* current state does not do anything special for the error token. */ 01122 01123 #if 0 01124 /* This is wrong; only states that explicitly want error tokens 01125 should shift them. */ 01126 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ 01127 if (yyn) goto yydefault; 01128 #endif 01129 01130 yyerrpop: /* pop the current state because it cannot handle the error token */ 01131 01132 if (yyssp == yyss) YYABORT; 01133 yyvsp--; 01134 yystate = *--yyssp; 01135 #ifdef YYLSP_NEEDED 01136 yylsp--; 01137 #endif 01138 01139 #if YYDEBUG != 0 01140 if (yydebug) 01141 { 01142 short *ssp1 = yyss - 1; 01143 fprintf (stderr, "Error: state stack now"); 01144 while (ssp1 != yyssp) 01145 fprintf (stderr, " %d", *++ssp1); 01146 fprintf (stderr, "\n"); 01147 } 01148 #endif 01149 01150 yyerrhandle: 01151 01152 yyn = yypact[yystate]; 01153 if (yyn == YYFLAG) 01154 goto yyerrdefault; 01155 01156 yyn += YYTERROR; 01157 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) 01158 goto yyerrdefault; 01159 01160 yyn = yytable[yyn]; 01161 if (yyn < 0) 01162 { 01163 if (yyn == YYFLAG) 01164 goto yyerrpop; 01165 yyn = -yyn; 01166 goto yyreduce; 01167 } 01168 else if (yyn == 0) 01169 goto yyerrpop; 01170 01171 if (yyn == YYFINAL) 01172 YYACCEPT; 01173 01174 #if YYDEBUG != 0 01175 if (yydebug) 01176 fprintf(stderr, "Shifting error token, "); 01177 #endif 01178 01179 *++yyvsp = yylval; 01180 #ifdef YYLSP_NEEDED 01181 *++yylsp = yylloc; 01182 #endif 01183 01184 yystate = yyn; 01185 goto yynewstate; 01186 01187 yyacceptlab: 01188 /* YYACCEPT comes here. */ 01189 if (yyfree_stacks) 01190 { 01191 free (yyss); 01192 free (yyvs); 01193 #ifdef YYLSP_NEEDED 01194 free (yyls); 01195 #endif 01196 } 01197 return 0; 01198 01199 yyabortlab: 01200 /* YYABORT comes here. */ 01201 if (yyfree_stacks) 01202 { 01203 free (yyss); 01204 free (yyvs); 01205 #ifdef YYLSP_NEEDED 01206 free (yyls); 01207 #endif 01208 } 01209 return 1; 01210 } 01211 #line 306 "ExpSpec.y" 01212 |
|
Go to: the Main Page of the documentation. |