Clan
0.8.0
|
00001 /* A Bison parser, made by GNU Bison 2.5. */ 00002 00003 /* Bison implementation for Yacc-like parsers in C 00004 00005 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. 00006 00007 This program is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 /* As a special exception, you may create a larger work that contains 00021 part or all of the Bison parser skeleton and distribute that work 00022 under terms of your choice, so long as that work isn't itself a 00023 parser generator using the skeleton or a modified version thereof 00024 as a parser skeleton. Alternatively, if you modify or redistribute 00025 the parser skeleton itself, you may (at your option) remove this 00026 special exception, which will cause the skeleton and the resulting 00027 Bison output files to be licensed under the GNU General Public 00028 License without this special exception. 00029 00030 This special exception was added by the Free Software Foundation in 00031 version 2.2 of Bison. */ 00032 00033 /* C LALR(1) parser skeleton written by Richard Stallman, by 00034 simplifying the original so-called "semantic" parser. */ 00035 00036 /* All symbols defined below should begin with yy or YY, to avoid 00037 infringing on user name space. This should be done even for local 00038 variables, as they might otherwise be expanded by user macros. 00039 There are some unavoidable exceptions within include files to 00040 define necessary library symbols; they are noted "INFRINGES ON 00041 USER NAME SPACE" below. */ 00042 00043 /* Identify Bison output. */ 00044 #define YYBISON 1 00045 00046 /* Bison version. */ 00047 #define YYBISON_VERSION "2.5" 00048 00049 /* Skeleton name. */ 00050 #define YYSKELETON_NAME "yacc.c" 00051 00052 /* Pure parsers. */ 00053 #define YYPURE 0 00054 00055 /* Push parsers. */ 00056 #define YYPUSH 0 00057 00058 /* Pull parsers. */ 00059 #define YYPULL 1 00060 00061 /* Using locations. */ 00062 #define YYLSP_NEEDED 0 00063 00064 00065 00066 /* Copy the first part of user declarations. */ 00067 00068 /* Line 268 of yacc.c */ 00069 #line 46 "parser.y" 00070 00071 #include <stdio.h> 00072 #include <stdlib.h> 00073 #include <string.h> 00074 #include <assert.h> 00075 00076 #include <osl/macros.h> 00077 #include <osl/int.h> 00078 #include <osl/vector.h> 00079 #include <osl/relation.h> 00080 #include <osl/statement.h> 00081 #include <osl/strings.h> 00082 #include <osl/generic.h> 00083 #include <osl/body.h> 00084 #include <osl/extensions/arrays.h> 00085 #include <osl/extensions/extbody.h> 00086 #include <osl/scop.h> 00087 #include <clan/macros.h> 00088 #include <clan/vector.h> 00089 #include <clan/relation.h> 00090 #include <clan/relation_list.h> 00091 #include <clan/scop.h> 00092 #include <clan/symbol.h> 00093 #include <clan/statement.h> 00094 #include <clan/options.h> 00095 00096 int yylex(void); 00097 void yyerror(char*); 00098 void yyrestart(FILE*); 00099 void clan_scanner_initialize(); 00100 void clan_scanner_reinitialize(int, int, int); 00101 void clan_scanner_free(); 00102 00103 void clan_parser_add_ld(); 00104 int clan_parser_nb_ld(); 00105 void clan_parser_log(char*); 00106 void clan_parser_increment_loop_depth(); 00107 void clan_parser_state_initialize(clan_options_p); 00108 osl_scop_p clan_parse(FILE*, clan_options_p); 00109 00110 extern FILE* yyin; 00111 extern int scanner_parsing; 00112 extern char* scanner_latest_text; 00113 extern char* scanner_clay; 00114 extern int scanner_line; 00115 extern int scanner_column; 00116 extern int scanner_column_LALR; 00117 extern int scanner_scop_start; 00118 extern int scanner_scop_end; 00119 extern int scanner_pragma; 00121 // This is the "parser state", a collection of variables that vary 00122 // during the parsing and thanks to we can extract all SCoP informations. 00123 osl_scop_p parser_scop; 00124 clan_symbol_p parser_symbol; 00125 int parser_recording; 00126 char* parser_record; 00127 int parser_loop_depth; 00128 int parser_if_depth; 00129 int* parser_scattering; 00130 clan_symbol_p* parser_iterators; 00131 osl_relation_list_p parser_stack; 00132 int* parser_nb_local_dims; 00133 int parser_nb_parameters; 00134 int* parser_valid_else; 00135 int parser_indent; 00136 int parser_error; 00138 int parser_ceild; 00139 int parser_floord; 00140 int parser_min; 00141 int parser_max; 00143 // Autoscop-relative variables. 00144 int parser_autoscop; 00145 int parser_line_start; 00146 int parser_line_end; 00147 int parser_column_start; 00148 int parser_column_end; 00150 // Ugly global variable to keep/read Clan options during parsing. 00151 clan_options_p parser_options; 00152 00153 // Variables to generate the extbody 00154 osl_extbody_p parser_access_extbody; 00155 int parser_access_start; 00156 int parser_access_length; 00159 /* Line 268 of yacc.c */ 00160 #line 161 "source/parser.c" 00161 00162 /* Enabling traces. */ 00163 #ifndef YYDEBUG 00164 # define YYDEBUG 0 00165 #endif 00166 00167 /* Enabling verbose error messages. */ 00168 #ifdef YYERROR_VERBOSE 00169 # undef YYERROR_VERBOSE 00170 # define YYERROR_VERBOSE 1 00171 #else 00172 # define YYERROR_VERBOSE 0 00173 #endif 00174 00175 /* Enabling the token table. */ 00176 #ifndef YYTOKEN_TABLE 00177 # define YYTOKEN_TABLE 0 00178 #endif 00179 00180 00181 /* Tokens. */ 00182 #ifndef YYTOKENTYPE 00183 # define YYTOKENTYPE 00184 /* Put the tokens into the symbol table, so that GDB and other debuggers 00185 know about them. */ 00186 enum yytokentype { 00187 CONSTANT = 258, 00188 STRING_LITERAL = 259, 00189 SIZEOF = 260, 00190 PTR_OP = 261, 00191 INC_OP = 262, 00192 DEC_OP = 263, 00193 LEFT_OP = 264, 00194 RIGHT_OP = 265, 00195 LE_OP = 266, 00196 GE_OP = 267, 00197 EQ_OP = 268, 00198 NE_OP = 269, 00199 AND_OP = 270, 00200 OR_OP = 271, 00201 MUL_ASSIGN = 272, 00202 DIV_ASSIGN = 273, 00203 MOD_ASSIGN = 274, 00204 ADD_ASSIGN = 275, 00205 SUB_ASSIGN = 276, 00206 LEFT_ASSIGN = 277, 00207 RIGHT_ASSIGN = 278, 00208 AND_ASSIGN = 279, 00209 XOR_ASSIGN = 280, 00210 OR_ASSIGN = 281, 00211 TYPE_NAME = 282, 00212 TYPEDEF = 283, 00213 EXTERN = 284, 00214 STATIC = 285, 00215 AUTO = 286, 00216 REGISTER = 287, 00217 INLINE = 288, 00218 RESTRICT = 289, 00219 CHAR = 290, 00220 SHORT = 291, 00221 INT = 292, 00222 LONG = 293, 00223 SIGNED = 294, 00224 UNSIGNED = 295, 00225 FLOAT = 296, 00226 DOUBLE = 297, 00227 CONST = 298, 00228 VOLATILE = 299, 00229 VOID = 300, 00230 BOOL = 301, 00231 COMPLEX = 302, 00232 IMAGINARY = 303, 00233 STRUCT = 304, 00234 UNION = 305, 00235 ENUM = 306, 00236 ELLIPSIS = 307, 00237 CASE = 308, 00238 DEFAULT = 309, 00239 IF = 310, 00240 ELSE = 311, 00241 SWITCH = 312, 00242 WHILE = 313, 00243 DO = 314, 00244 FOR = 315, 00245 GOTO = 316, 00246 CONTINUE = 317, 00247 BREAK = 318, 00248 RETURN = 319, 00249 IGNORE = 320, 00250 PRAGMA = 321, 00251 MIN = 322, 00252 MAX = 323, 00253 CEILD = 324, 00254 FLOORD = 325, 00255 ID = 326, 00256 INTEGER = 327 00257 }; 00258 #endif 00259 /* Tokens. */ 00260 #define CONSTANT 258 00261 #define STRING_LITERAL 259 00262 #define SIZEOF 260 00263 #define PTR_OP 261 00264 #define INC_OP 262 00265 #define DEC_OP 263 00266 #define LEFT_OP 264 00267 #define RIGHT_OP 265 00268 #define LE_OP 266 00269 #define GE_OP 267 00270 #define EQ_OP 268 00271 #define NE_OP 269 00272 #define AND_OP 270 00273 #define OR_OP 271 00274 #define MUL_ASSIGN 272 00275 #define DIV_ASSIGN 273 00276 #define MOD_ASSIGN 274 00277 #define ADD_ASSIGN 275 00278 #define SUB_ASSIGN 276 00279 #define LEFT_ASSIGN 277 00280 #define RIGHT_ASSIGN 278 00281 #define AND_ASSIGN 279 00282 #define XOR_ASSIGN 280 00283 #define OR_ASSIGN 281 00284 #define TYPE_NAME 282 00285 #define TYPEDEF 283 00286 #define EXTERN 284 00287 #define STATIC 285 00288 #define AUTO 286 00289 #define REGISTER 287 00290 #define INLINE 288 00291 #define RESTRICT 289 00292 #define CHAR 290 00293 #define SHORT 291 00294 #define INT 292 00295 #define LONG 293 00296 #define SIGNED 294 00297 #define UNSIGNED 295 00298 #define FLOAT 296 00299 #define DOUBLE 297 00300 #define CONST 298 00301 #define VOLATILE 299 00302 #define VOID 300 00303 #define BOOL 301 00304 #define COMPLEX 302 00305 #define IMAGINARY 303 00306 #define STRUCT 304 00307 #define UNION 305 00308 #define ENUM 306 00309 #define ELLIPSIS 307 00310 #define CASE 308 00311 #define DEFAULT 309 00312 #define IF 310 00313 #define ELSE 311 00314 #define SWITCH 312 00315 #define WHILE 313 00316 #define DO 314 00317 #define FOR 315 00318 #define GOTO 316 00319 #define CONTINUE 317 00320 #define BREAK 318 00321 #define RETURN 319 00322 #define IGNORE 320 00323 #define PRAGMA 321 00324 #define MIN 322 00325 #define MAX 323 00326 #define CEILD 324 00327 #define FLOORD 325 00328 #define ID 326 00329 #define INTEGER 327 00330 00331 00332 00333 00334 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 00335 typedef union YYSTYPE 00336 { 00337 00338 /* Line 293 of yacc.c */ 00339 #line 138 "parser.y" 00340 int value; 00341 char* symbol; 00342 osl_vector_p affex; 00343 osl_relation_p setex; 00344 osl_relation_list_p list; 00345 osl_statement_p stmt; 00349 /* Line 293 of yacc.c */ 00350 #line 351 "source/parser.c" 00351 } YYSTYPE; 00352 # define YYSTYPE_IS_TRIVIAL 1 00353 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 00354 # define YYSTYPE_IS_DECLARED 1 00355 #endif 00356 00357 00358 /* Copy the second part of user declarations. */ 00359 00360 00361 /* Line 343 of yacc.c */ 00362 #line 363 "source/parser.c" 00363 00364 #ifdef short 00365 # undef short 00366 #endif 00367 00368 #ifdef YYTYPE_UINT8 00369 typedef YYTYPE_UINT8 yytype_uint8; 00370 #else 00371 typedef unsigned char yytype_uint8; 00372 #endif 00373 00374 #ifdef YYTYPE_INT8 00375 typedef YYTYPE_INT8 yytype_int8; 00376 #elif (defined __STDC__ || defined __C99__FUNC__ \ 00377 || defined __cplusplus || defined _MSC_VER) 00378 typedef signed char yytype_int8; 00379 #else 00380 typedef short int yytype_int8; 00381 #endif 00382 00383 #ifdef YYTYPE_UINT16 00384 typedef YYTYPE_UINT16 yytype_uint16; 00385 #else 00386 typedef unsigned short int yytype_uint16; 00387 #endif 00388 00389 #ifdef YYTYPE_INT16 00390 typedef YYTYPE_INT16 yytype_int16; 00391 #else 00392 typedef short int yytype_int16; 00393 #endif 00394 00395 #ifndef YYSIZE_T 00396 # ifdef __SIZE_TYPE__ 00397 # define YYSIZE_T __SIZE_TYPE__ 00398 # elif defined size_t 00399 # define YYSIZE_T size_t 00400 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 00401 || defined __cplusplus || defined _MSC_VER) 00402 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 00403 # define YYSIZE_T size_t 00404 # else 00405 # define YYSIZE_T unsigned int 00406 # endif 00407 #endif 00408 00409 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 00410 00411 #ifndef YY_ 00412 # if defined YYENABLE_NLS && YYENABLE_NLS 00413 # if ENABLE_NLS 00414 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 00415 # define YY_(msgid) dgettext ("bison-runtime", msgid) 00416 # endif 00417 # endif 00418 # ifndef YY_ 00419 # define YY_(msgid) msgid 00420 # endif 00421 #endif 00422 00423 /* Suppress unused-variable warnings by "using" E. */ 00424 #if ! defined lint || defined __GNUC__ 00425 # define YYUSE(e) ((void) (e)) 00426 #else 00427 # define YYUSE(e) /* empty */ 00428 #endif 00429 00430 /* Identity function, used to suppress warnings about constant conditions. */ 00431 #ifndef lint 00432 # define YYID(n) (n) 00433 #else 00434 #if (defined __STDC__ || defined __C99__FUNC__ \ 00435 || defined __cplusplus || defined _MSC_VER) 00436 static int 00437 YYID (int yyi) 00438 #else 00439 static int 00440 YYID (yyi) 00441 int yyi; 00442 #endif 00443 { 00444 return yyi; 00445 } 00446 #endif 00447 00448 #if ! defined yyoverflow || YYERROR_VERBOSE 00449 00450 /* The parser invokes alloca or malloc; define the necessary symbols. */ 00451 00452 # ifdef YYSTACK_USE_ALLOCA 00453 # if YYSTACK_USE_ALLOCA 00454 # ifdef __GNUC__ 00455 # define YYSTACK_ALLOC __builtin_alloca 00456 # elif defined __BUILTIN_VA_ARG_INCR 00457 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 00458 # elif defined _AIX 00459 # define YYSTACK_ALLOC __alloca 00460 # elif defined _MSC_VER 00461 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 00462 # define alloca _alloca 00463 # else 00464 # define YYSTACK_ALLOC alloca 00465 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00466 || defined __cplusplus || defined _MSC_VER) 00467 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00468 # ifndef EXIT_SUCCESS 00469 # define EXIT_SUCCESS 0 00470 # endif 00471 # endif 00472 # endif 00473 # endif 00474 # endif 00475 00476 # ifdef YYSTACK_ALLOC 00477 /* Pacify GCC's `empty if-body' warning. */ 00478 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 00479 # ifndef YYSTACK_ALLOC_MAXIMUM 00480 /* The OS might guarantee only one guard page at the bottom of the stack, 00481 and a page size can be as small as 4096 bytes. So we cannot safely 00482 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 00483 to allow for a few compiler-allocated temporary stack slots. */ 00484 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 00485 # endif 00486 # else 00487 # define YYSTACK_ALLOC YYMALLOC 00488 # define YYSTACK_FREE YYFREE 00489 # ifndef YYSTACK_ALLOC_MAXIMUM 00490 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 00491 # endif 00492 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 00493 && ! ((defined YYMALLOC || defined malloc) \ 00494 && (defined YYFREE || defined free))) 00495 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00496 # ifndef EXIT_SUCCESS 00497 # define EXIT_SUCCESS 0 00498 # endif 00499 # endif 00500 # ifndef YYMALLOC 00501 # define YYMALLOC malloc 00502 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00503 || defined __cplusplus || defined _MSC_VER) 00504 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 00505 # endif 00506 # endif 00507 # ifndef YYFREE 00508 # define YYFREE free 00509 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00510 || defined __cplusplus || defined _MSC_VER) 00511 void free (void *); /* INFRINGES ON USER NAME SPACE */ 00512 # endif 00513 # endif 00514 # endif 00515 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 00516 00517 00518 #if (! defined yyoverflow \ 00519 && (! defined __cplusplus \ 00520 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 00521 00522 /* A type that is properly aligned for any stack member. */ 00523 union yyalloc 00524 { 00525 yytype_int16 yyss_alloc; 00526 YYSTYPE yyvs_alloc; 00527 }; 00528 00529 /* The size of the maximum gap between one aligned stack and the next. */ 00530 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 00531 00532 /* The size of an array large to enough to hold all stacks, each with 00533 N elements. */ 00534 # define YYSTACK_BYTES(N) \ 00535 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 00536 + YYSTACK_GAP_MAXIMUM) 00537 00538 # define YYCOPY_NEEDED 1 00539 00540 /* Relocate STACK from its old location to the new one. The 00541 local variables YYSIZE and YYSTACKSIZE give the old and new number of 00542 elements in the stack, and YYPTR gives the new location of the 00543 stack. Advance YYPTR to a properly aligned location for the next 00544 stack. */ 00545 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 00546 do \ 00547 { \ 00548 YYSIZE_T yynewbytes; \ 00549 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 00550 Stack = &yyptr->Stack_alloc; \ 00551 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 00552 yyptr += yynewbytes / sizeof (*yyptr); \ 00553 } \ 00554 while (YYID (0)) 00555 00556 #endif 00557 00558 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 00559 /* Copy COUNT objects from FROM to TO. The source and destination do 00560 not overlap. */ 00561 # ifndef YYCOPY 00562 # if defined __GNUC__ && 1 < __GNUC__ 00563 # define YYCOPY(To, From, Count) \ 00564 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 00565 # else 00566 # define YYCOPY(To, From, Count) \ 00567 do \ 00568 { \ 00569 YYSIZE_T yyi; \ 00570 for (yyi = 0; yyi < (Count); yyi++) \ 00571 (To)[yyi] = (From)[yyi]; \ 00572 } \ 00573 while (YYID (0)) 00574 # endif 00575 # endif 00576 #endif /* !YYCOPY_NEEDED */ 00577 00578 /* YYFINAL -- State number of the termination state. */ 00579 #define YYFINAL 7 00580 /* YYLAST -- Last index in YYTABLE. */ 00581 #define YYLAST 740 00582 00583 /* YYNTOKENS -- Number of terminals. */ 00584 #define YYNTOKENS 97 00585 /* YYNNTS -- Number of nonterminals. */ 00586 #define YYNNTS 91 00587 /* YYNRULES -- Number of rules. */ 00588 #define YYNRULES 252 00589 /* YYNRULES -- Number of states. */ 00590 #define YYNSTATES 426 00591 00592 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 00593 #define YYUNDEFTOK 2 00594 #define YYMAXUTOK 327 00595 00596 #define YYTRANSLATE(YYX) \ 00597 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 00598 00599 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 00600 static const yytype_uint8 yytranslate[] = 00601 { 00602 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00603 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00604 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00605 2, 2, 2, 84, 2, 2, 2, 85, 91, 2, 00606 75, 76, 86, 79, 81, 80, 90, 87, 2, 2, 00607 2, 2, 2, 2, 2, 2, 2, 2, 96, 78, 00608 82, 77, 83, 95, 2, 2, 2, 2, 2, 2, 00609 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00610 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00611 2, 88, 2, 89, 93, 2, 2, 2, 2, 2, 00612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00613 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00614 2, 2, 2, 73, 94, 74, 92, 2, 2, 2, 00615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00616 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00621 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00627 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 00628 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 00629 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 00630 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 00631 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 00632 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 00633 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 00634 65, 66, 67, 68, 69, 70, 71, 72 00635 }; 00636 00637 #if YYDEBUG 00638 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 00639 YYRHS. */ 00640 static const yytype_uint16 yyprhs[] = 00641 { 00642 0, 0, 3, 5, 8, 11, 13, 16, 18, 21, 00643 22, 25, 27, 29, 31, 32, 35, 38, 42, 43, 00644 47, 48, 49, 50, 59, 60, 69, 70, 74, 75, 00645 82, 84, 85, 88, 91, 94, 97, 100, 106, 112, 00646 116, 120, 122, 126, 131, 137, 139, 141, 148, 150, 00647 152, 154, 161, 163, 170, 174, 178, 182, 186, 190, 00648 194, 199, 205, 207, 211, 213, 217, 219, 221, 225, 00649 227, 230, 233, 235, 239, 243, 245, 249, 253, 255, 00650 262, 264, 266, 268, 275, 277, 284, 286, 288, 290, 00651 292, 296, 298, 303, 307, 308, 314, 318, 322, 325, 00652 327, 331, 333, 336, 339, 342, 347, 349, 351, 353, 00653 355, 357, 359, 361, 363, 365, 370, 372, 376, 380, 00654 384, 386, 390, 394, 396, 400, 404, 406, 410, 414, 00655 418, 422, 424, 428, 432, 434, 438, 440, 444, 446, 00656 450, 452, 456, 458, 462, 464, 470, 472, 476, 478, 00657 480, 482, 484, 486, 488, 490, 492, 494, 496, 498, 00658 500, 502, 506, 508, 509, 513, 515, 517, 520, 522, 00659 525, 527, 530, 532, 534, 536, 538, 540, 542, 544, 00660 546, 548, 550, 552, 554, 556, 558, 560, 562, 564, 00661 570, 575, 578, 580, 582, 584, 587, 591, 594, 596, 00662 599, 601, 603, 607, 609, 612, 616, 621, 627, 630, 00663 632, 636, 638, 642, 644, 646, 649, 651, 653, 657, 00664 662, 666, 671, 676, 680, 682, 685, 688, 692, 694, 00665 697, 699, 703, 705, 709, 712, 715, 717, 719, 723, 00666 725, 728, 730, 732, 735, 739, 742, 746, 750, 755, 00667 758, 762, 766 00668 }; 00669 00670 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 00671 static const yytype_int16 yyrhs[] = 00672 { 00673 98, 0, -1, 99, -1, 98, 99, -1, 98, 65, 00674 -1, 65, -1, 100, 65, -1, 101, -1, 100, 101, 00675 -1, -1, 102, 103, -1, 105, -1, 160, -1, 108, 00676 -1, -1, 104, 111, -1, 73, 74, -1, 73, 100, 00677 74, -1, -1, 56, 107, 103, -1, -1, -1, -1, 00678 55, 75, 128, 76, 109, 103, 110, 106, -1, -1, 00679 60, 75, 114, 117, 118, 76, 112, 121, -1, -1, 00680 120, 113, 121, -1, -1, 116, 71, 115, 77, 122, 00681 78, -1, 37, -1, -1, 128, 78, -1, 119, 7, 00682 -1, 119, 8, -1, 7, 119, -1, 8, 119, -1, 00683 119, 77, 119, 79, 72, -1, 119, 77, 119, 80, 00684 72, -1, 119, 20, 72, -1, 119, 21, 72, -1, 00685 71, -1, 75, 119, 76, -1, 58, 75, 72, 76, 00686 -1, 60, 75, 78, 78, 76, -1, 103, -1, 133, 00687 -1, 123, 75, 122, 81, 122, 76, -1, 67, -1, 00688 68, -1, 136, -1, 67, 75, 124, 81, 124, 76, 00689 -1, 135, -1, 68, 75, 125, 81, 125, 76, -1, 00690 125, 82, 124, -1, 124, 83, 125, -1, 125, 11, 00691 124, -1, 124, 12, 125, -1, 132, 13, 132, -1, 00692 75, 128, 76, -1, 84, 75, 128, 76, -1, 132, 00693 85, 72, 13, 72, -1, 126, -1, 127, 15, 126, 00694 -1, 127, -1, 128, 16, 127, -1, 71, -1, 72, 00695 -1, 75, 132, 76, -1, 129, -1, 79, 129, -1, 00696 80, 129, -1, 130, -1, 131, 86, 130, -1, 131, 00697 87, 130, -1, 131, -1, 132, 79, 131, -1, 132, 00698 80, 131, -1, 132, -1, 134, 75, 132, 81, 72, 00699 76, -1, 69, -1, 70, -1, 132, -1, 69, 75, 00700 132, 81, 72, 76, -1, 132, -1, 70, 75, 132, 00701 81, 72, 76, -1, 71, -1, 3, -1, 72, -1, 00702 4, -1, 75, 159, 76, -1, 137, -1, 138, 88, 00703 132, 89, -1, 138, 75, 76, -1, -1, 138, 75, 00704 139, 140, 76, -1, 138, 90, 71, -1, 138, 6, 00705 71, -1, 138, 143, -1, 156, -1, 140, 81, 156, 00706 -1, 138, -1, 143, 141, -1, 142, 144, -1, 5, 00707 141, -1, 5, 75, 185, 76, -1, 91, -1, 86, 00708 -1, 79, -1, 80, -1, 92, -1, 84, -1, 7, 00709 -1, 8, -1, 141, -1, 75, 185, 76, 144, -1, 00710 144, -1, 145, 86, 144, -1, 145, 87, 144, -1, 00711 145, 85, 144, -1, 145, -1, 146, 79, 145, -1, 00712 146, 80, 145, -1, 146, -1, 147, 9, 146, -1, 00713 147, 10, 146, -1, 147, -1, 148, 82, 147, -1, 00714 148, 83, 147, -1, 148, 11, 147, -1, 148, 12, 00715 147, -1, 148, -1, 149, 13, 148, -1, 149, 14, 00716 148, -1, 149, -1, 150, 91, 149, -1, 150, -1, 00717 151, 93, 150, -1, 151, -1, 152, 94, 151, -1, 00718 152, -1, 153, 15, 152, -1, 153, -1, 154, 16, 00719 153, -1, 154, -1, 154, 95, 159, 96, 155, -1, 00720 155, -1, 141, 157, 156, -1, 77, -1, 158, -1, 00721 17, -1, 18, -1, 19, -1, 20, -1, 21, -1, 00722 22, -1, 23, -1, 24, -1, 25, -1, 26, -1, 00723 156, -1, 159, 81, 156, -1, 78, -1, -1, 161, 00724 159, 78, -1, 155, -1, 164, -1, 164, 163, -1, 00725 165, -1, 165, 163, -1, 176, -1, 176, 163, -1, 00726 28, -1, 29, -1, 30, -1, 31, -1, 32, -1, 00727 45, -1, 35, -1, 36, -1, 37, -1, 38, -1, 00728 41, -1, 42, -1, 39, -1, 40, -1, 166, -1, 00729 173, -1, 27, -1, 167, 71, 73, 168, 74, -1, 00730 167, 73, 168, 74, -1, 167, 71, -1, 49, -1, 00731 50, -1, 169, -1, 168, 169, -1, 170, 171, 78, 00732 -1, 165, 170, -1, 165, -1, 176, 170, -1, 176, 00733 -1, 172, -1, 171, 81, 172, -1, 177, -1, 96, 00734 162, -1, 177, 96, 162, -1, 51, 73, 174, 74, 00735 -1, 51, 71, 73, 174, 74, -1, 51, 71, -1, 00736 175, -1, 174, 81, 175, -1, 71, -1, 71, 77, 00737 162, -1, 43, -1, 44, -1, 179, 178, -1, 178, 00738 -1, 71, -1, 75, 177, 76, -1, 178, 88, 162, 00739 89, -1, 178, 88, 89, -1, 178, 75, 181, 76, 00740 -1, 178, 75, 184, 76, -1, 178, 75, 76, -1, 00741 86, -1, 86, 180, -1, 86, 179, -1, 86, 180, 00742 179, -1, 176, -1, 180, 176, -1, 182, -1, 182, 00743 81, 52, -1, 183, -1, 182, 81, 183, -1, 163, 00744 177, -1, 163, 186, -1, 163, -1, 71, -1, 184, 00745 81, 71, -1, 170, -1, 170, 186, -1, 179, -1, 00746 187, -1, 179, 187, -1, 75, 186, 76, -1, 88, 00747 89, -1, 88, 162, 89, -1, 187, 88, 89, -1, 00748 187, 88, 162, 89, -1, 75, 76, -1, 75, 181, 00749 76, -1, 187, 75, 76, -1, 187, 75, 181, 76, 00750 -1 00751 }; 00752 00753 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 00754 static const yytype_uint16 yyrline[] = 00755 { 00756 0, 228, 228, 229, 230, 231, 237, 293, 294, 302, 00757 302, 316, 317, 318, 319, 319, 349, 350, 361, 360, 00758 374, 383, 392, 382, 424, 423, 496, 495, 534, 533, 00759 550, 551, 556, 573, 574, 575, 576, 577, 578, 579, 00760 580, 584, 585, 590, 591, 596, 616, 623, 636, 637, 00761 649, 659, 679, 689, 712, 723, 734, 745, 756, 779, 00762 788, 803, 820, 826, 839, 845, 857, 887, 893, 904, 00763 910, 916, 927, 934, 958, 982, 989, 998, 1011, 1017, 00764 1029, 1030, 1035, 1041, 1053, 1059, 1076, 1111, 1113, 1115, 00765 1117, 1123, 1125, 1138, 1152, 1151, 1166, 1182, 1198, 1225, 00766 1227, 1235, 1237, 1261, 1263, 1265, 1270, 1271, 1272, 1273, 00767 1274, 1275, 1279, 1280, 1284, 1286, 1291, 1293, 1298, 1303, 00768 1311, 1313, 1318, 1326, 1328, 1333, 1341, 1343, 1348, 1353, 00769 1358, 1366, 1368, 1373, 1381, 1383, 1391, 1393, 1401, 1403, 00770 1411, 1413, 1421, 1423, 1431, 1433, 1442, 1449, 1479, 1481, 00771 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 00772 1499, 1501, 1509, 1516, 1516, 1587, 1591, 1592, 1593, 1594, 00773 1595, 1596, 1600, 1601, 1602, 1603, 1604, 1608, 1609, 1610, 00774 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1623, 00775 1624, 1625, 1629, 1630, 1634, 1635, 1639, 1643, 1644, 1645, 00776 1646, 1650, 1651, 1655, 1656, 1657, 1661, 1662, 1663, 1667, 00777 1668, 1672, 1673, 1677, 1678, 1682, 1683, 1687, 1688, 1689, 00778 1690, 1691, 1692, 1693, 1697, 1698, 1699, 1700, 1704, 1705, 00779 1710, 1711, 1715, 1716, 1720, 1721, 1722, 1726, 1727, 1731, 00780 1732, 1736, 1737, 1738, 1742, 1743, 1744, 1745, 1746, 1747, 00781 1748, 1749, 1750 00782 }; 00783 #endif 00784 00785 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 00786 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 00787 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 00788 static const char *const yytname[] = 00789 { 00790 "$end", "error", "$undefined", "CONSTANT", "STRING_LITERAL", "SIZEOF", 00791 "PTR_OP", "INC_OP", "DEC_OP", "LEFT_OP", "RIGHT_OP", "LE_OP", "GE_OP", 00792 "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "MUL_ASSIGN", "DIV_ASSIGN", 00793 "MOD_ASSIGN", "ADD_ASSIGN", "SUB_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", 00794 "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "TYPE_NAME", "TYPEDEF", 00795 "EXTERN", "STATIC", "AUTO", "REGISTER", "INLINE", "RESTRICT", "CHAR", 00796 "SHORT", "INT", "LONG", "SIGNED", "UNSIGNED", "FLOAT", "DOUBLE", "CONST", 00797 "VOLATILE", "VOID", "BOOL", "COMPLEX", "IMAGINARY", "STRUCT", "UNION", 00798 "ENUM", "ELLIPSIS", "CASE", "DEFAULT", "IF", "ELSE", "SWITCH", "WHILE", 00799 "DO", "FOR", "GOTO", "CONTINUE", "BREAK", "RETURN", "IGNORE", "PRAGMA", 00800 "MIN", "MAX", "CEILD", "FLOORD", "ID", "INTEGER", "'{'", "'}'", "'('", 00801 "')'", "'='", "';'", "'+'", "'-'", "','", "'<'", "'>'", "'!'", "'%'", 00802 "'*'", "'/'", "'['", "']'", "'.'", "'&'", "'~'", "'^'", "'|'", "'?'", 00803 "':'", "$accept", "scop_list", "scop", "statement_list", 00804 "statement_indented", "$@1", "statement", "$@2", "compound_statement", 00805 "selection_else_statement", "$@3", "selection_statement", "$@4", "$@5", 00806 "iteration_statement", "$@6", "$@7", "loop_initialization", "$@8", 00807 "loop_declaration", "loop_condition", "loop_stride", "idparent", 00808 "loop_infinite", "loop_body", "affine_minmax_expression", "minmax", 00809 "affine_min_expression", "affine_max_expression", "affine_relation", 00810 "affine_logical_and_expression", "affine_condition", 00811 "affine_primary_expression", "affine_unary_expression", 00812 "affine_multiplicative_expression", "affine_expression", 00813 "affine_ceildfloord_expression", "ceildfloord", 00814 "affine_ceild_expression", "affine_floord_expression", 00815 "primary_expression", "postfix_expression", "$@9", 00816 "argument_expression_list", "unary_expression", "unary_operator", 00817 "unary_increment_operator", "cast_expression", 00818 "multiplicative_expression", "additive_expression", "shift_expression", 00819 "relational_expression", "equality_expression", "and_expression", 00820 "exclusive_or_expression", "inclusive_or_expression", 00821 "logical_and_expression", "logical_or_expression", 00822 "conditional_expression", "assignment_expression", "assignment_operator", 00823 "assignment_rdwr_operator", "expression", "expression_statement", "$@10", 00824 "constant_expression", "declaration_specifiers", 00825 "storage_class_specifier", "type_specifier", "struct_or_union_specifier", 00826 "struct_or_union", "struct_declaration_list", "struct_declaration", 00827 "specifier_qualifier_list", "struct_declarator_list", 00828 "struct_declarator", "enum_specifier", "enumerator_list", "enumerator", 00829 "type_qualifier", "declarator", "direct_declarator", "pointer", 00830 "type_qualifier_list", "parameter_type_list", "parameter_list", 00831 "parameter_declaration", "identifier_list", "type_name", 00832 "abstract_declarator", "direct_abstract_declarator", 0 00833 }; 00834 #endif 00835 00836 # ifdef YYPRINT 00837 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 00838 token YYLEX-NUM. */ 00839 static const yytype_uint16 yytoknum[] = 00840 { 00841 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 00842 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 00843 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 00844 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 00845 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 00846 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 00847 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 00848 325, 326, 327, 123, 125, 40, 41, 61, 59, 43, 00849 45, 44, 60, 62, 33, 37, 42, 47, 91, 93, 00850 46, 38, 126, 94, 124, 63, 58 00851 }; 00852 # endif 00853 00854 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 00855 static const yytype_uint8 yyr1[] = 00856 { 00857 0, 97, 98, 98, 98, 98, 99, 100, 100, 102, 00858 101, 103, 103, 103, 104, 103, 105, 105, 107, 106, 00859 106, 109, 110, 108, 112, 111, 113, 111, 115, 114, 00860 116, 116, 117, 118, 118, 118, 118, 118, 118, 118, 00861 118, 119, 119, 120, 120, 121, 122, 122, 123, 123, 00862 124, 124, 125, 125, 126, 126, 126, 126, 126, 126, 00863 126, 126, 127, 127, 128, 128, 129, 129, 129, 130, 00864 130, 130, 131, 131, 131, 132, 132, 132, 133, 133, 00865 134, 134, 135, 135, 136, 136, 137, 137, 137, 137, 00866 137, 138, 138, 138, 139, 138, 138, 138, 138, 140, 00867 140, 141, 141, 141, 141, 141, 142, 142, 142, 142, 00868 142, 142, 143, 143, 144, 144, 145, 145, 145, 145, 00869 146, 146, 146, 147, 147, 147, 148, 148, 148, 148, 00870 148, 149, 149, 149, 150, 150, 151, 151, 152, 152, 00871 153, 153, 154, 154, 155, 155, 156, 156, 157, 157, 00872 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, 00873 159, 159, 160, 161, 160, 162, 163, 163, 163, 163, 00874 163, 163, 164, 164, 164, 164, 164, 165, 165, 165, 00875 165, 165, 165, 165, 165, 165, 165, 165, 165, 166, 00876 166, 166, 167, 167, 168, 168, 169, 170, 170, 170, 00877 170, 171, 171, 172, 172, 172, 173, 173, 173, 174, 00878 174, 175, 175, 176, 176, 177, 177, 178, 178, 178, 00879 178, 178, 178, 178, 179, 179, 179, 179, 180, 180, 00880 181, 181, 182, 182, 183, 183, 183, 184, 184, 185, 00881 185, 186, 186, 186, 187, 187, 187, 187, 187, 187, 00882 187, 187, 187 00883 }; 00884 00885 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 00886 static const yytype_uint8 yyr2[] = 00887 { 00888 0, 2, 1, 2, 2, 1, 2, 1, 2, 0, 00889 2, 1, 1, 1, 0, 2, 2, 3, 0, 3, 00890 0, 0, 0, 8, 0, 8, 0, 3, 0, 6, 00891 1, 0, 2, 2, 2, 2, 2, 5, 5, 3, 00892 3, 1, 3, 4, 5, 1, 1, 6, 1, 1, 00893 1, 6, 1, 6, 3, 3, 3, 3, 3, 3, 00894 4, 5, 1, 3, 1, 3, 1, 1, 3, 1, 00895 2, 2, 1, 3, 3, 1, 3, 3, 1, 6, 00896 1, 1, 1, 6, 1, 6, 1, 1, 1, 1, 00897 3, 1, 4, 3, 0, 5, 3, 3, 2, 1, 00898 3, 1, 2, 2, 2, 4, 1, 1, 1, 1, 00899 1, 1, 1, 1, 1, 4, 1, 3, 3, 3, 00900 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, 00901 3, 1, 3, 3, 1, 3, 1, 3, 1, 3, 00902 1, 3, 1, 3, 1, 5, 1, 3, 1, 1, 00903 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00904 1, 3, 1, 0, 3, 1, 1, 2, 1, 2, 00905 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 00906 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 00907 4, 2, 1, 1, 1, 2, 3, 2, 1, 2, 00908 1, 1, 3, 1, 2, 3, 4, 5, 2, 1, 00909 3, 1, 3, 1, 1, 2, 1, 1, 3, 4, 00910 3, 4, 4, 3, 1, 2, 2, 3, 1, 2, 00911 1, 3, 1, 3, 2, 2, 1, 1, 3, 1, 00912 2, 1, 1, 2, 3, 2, 3, 3, 4, 2, 00913 3, 3, 4 00914 }; 00915 00916 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. 00917 Performed when YYTABLE doesn't specify something else to do. Zero 00918 means the default is an error. */ 00919 static const yytype_uint8 yydefact[] = 00920 { 00921 9, 5, 9, 2, 9, 7, 163, 1, 4, 3, 00922 6, 8, 0, 9, 162, 10, 0, 11, 13, 12, 00923 0, 0, 16, 9, 0, 0, 15, 26, 87, 89, 00924 0, 112, 113, 86, 88, 0, 108, 109, 111, 107, 00925 106, 110, 91, 101, 114, 0, 0, 116, 120, 123, 00926 126, 131, 134, 136, 138, 140, 142, 144, 146, 160, 00927 0, 0, 0, 0, 0, 66, 67, 0, 0, 0, 00928 0, 0, 0, 62, 64, 0, 69, 72, 75, 82, 00929 52, 50, 17, 0, 31, 163, 0, 104, 188, 178, 00930 179, 180, 181, 184, 185, 182, 183, 213, 214, 177, 00931 192, 193, 0, 0, 198, 186, 0, 239, 187, 200, 00932 0, 0, 94, 0, 0, 98, 150, 151, 152, 153, 00933 154, 155, 156, 157, 158, 159, 148, 0, 149, 114, 00934 103, 0, 102, 0, 0, 0, 0, 0, 0, 0, 00935 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 00936 0, 0, 164, 0, 0, 0, 0, 0, 0, 82, 00937 0, 70, 71, 0, 0, 0, 0, 0, 0, 0, 00938 21, 0, 0, 0, 0, 0, 0, 0, 30, 0, 00939 0, 0, 45, 27, 0, 208, 0, 90, 197, 191, 00940 0, 0, 224, 0, 241, 240, 242, 199, 0, 97, 00941 93, 0, 0, 96, 147, 119, 117, 118, 121, 122, 00942 124, 125, 129, 130, 127, 128, 132, 133, 135, 137, 00943 139, 141, 143, 0, 161, 0, 84, 0, 82, 0, 00944 0, 59, 68, 0, 0, 57, 55, 56, 54, 63, 00945 65, 163, 73, 74, 58, 76, 77, 0, 43, 0, 00946 0, 0, 28, 105, 0, 211, 0, 209, 0, 0, 00947 194, 0, 172, 173, 174, 175, 176, 249, 236, 166, 00948 168, 170, 0, 230, 232, 0, 228, 226, 225, 245, 00949 165, 0, 243, 0, 0, 115, 0, 99, 92, 0, 00950 0, 0, 0, 0, 60, 22, 0, 44, 0, 0, 00951 41, 0, 0, 0, 32, 0, 0, 0, 206, 0, 00952 0, 190, 195, 217, 0, 0, 0, 201, 203, 216, 00953 0, 0, 234, 241, 235, 167, 169, 171, 250, 0, 00954 244, 229, 227, 246, 251, 0, 247, 0, 95, 0, 00955 145, 0, 0, 0, 0, 20, 61, 35, 36, 0, 00956 24, 33, 34, 0, 0, 0, 0, 207, 212, 210, 00957 189, 0, 204, 196, 0, 0, 0, 0, 215, 231, 00958 233, 252, 248, 100, 51, 53, 83, 85, 18, 23, 00959 42, 163, 39, 40, 0, 48, 49, 80, 81, 0, 00960 0, 78, 46, 0, 218, 202, 205, 237, 223, 0, 00961 0, 220, 0, 163, 25, 0, 0, 29, 0, 0, 00962 221, 222, 0, 219, 19, 37, 38, 0, 0, 238, 00963 0, 0, 0, 0, 47, 79 00964 }; 00965 00966 /* YYDEFGOTO[NTERM-NUM]. */ 00967 static const yytype_int16 yydefgoto[] = 00968 { 00969 -1, 2, 3, 4, 5, 6, 182, 16, 17, 379, 00970 403, 18, 241, 345, 26, 381, 85, 180, 305, 181, 00971 250, 302, 303, 27, 183, 389, 390, 71, 72, 73, 00972 74, 75, 76, 77, 78, 79, 392, 393, 80, 81, 00973 42, 43, 201, 286, 129, 45, 46, 47, 48, 49, 00974 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 00975 127, 128, 103, 19, 20, 281, 268, 269, 104, 105, 00976 106, 259, 260, 261, 316, 317, 108, 256, 257, 109, 00977 318, 319, 320, 278, 272, 273, 274, 400, 110, 275, 00978 196 00979 }; 00980 00981 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 00982 STATE-NUM. */ 00983 #define YYPACT_NINF -261 00984 static const yytype_int16 yypact[] = 00985 { 00986 -5, -261, 53, -261, -2, -261, 211, -261, -261, -261, 00987 -261, -261, -32, 57, -261, -261, 117, -261, -261, -261, 00988 345, 331, -261, 127, 5, 92, -261, -261, -261, -261, 00989 355, -261, -261, -261, -261, 201, -261, -261, -261, -261, 00990 -261, -261, -261, 42, 365, 345, 373, -261, 251, 168, 00991 304, 137, 310, 94, 128, 113, 217, 19, -261, -261, 00992 230, 151, 189, 213, 227, -261, -261, 331, -39, -39, 00993 232, -7, 4, -261, 271, 39, -261, -261, 246, 131, 00994 -261, -261, -261, 228, 114, 211, 201, -261, -261, -261, 00995 -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, 00996 -261, -261, 183, -19, 458, -261, 206, 182, -261, 458, 00997 233, 258, 264, 203, 274, -261, -261, -261, -261, -261, 00998 -261, -261, -261, -261, -261, -261, -261, 345, -261, -261, 00999 -261, 345, -261, 345, 345, 345, 345, 345, 345, 345, 01000 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 01001 345, 345, -261, 345, 224, 660, 203, 203, 43, 111, 01002 203, -261, -261, 331, 660, 660, 224, 224, 331, 331, 01003 -261, 203, 203, 203, 203, 203, 279, 285, -261, 286, 01004 331, 308, -261, -261, 299, 319, 338, -261, -261, 323, 01005 458, 501, -3, 66, 78, -261, 101, -261, 345, -261, 01006 -261, 345, 123, -261, -261, -261, -261, -261, 251, 251, 01007 168, 168, 304, 304, 304, 304, 137, 137, 310, 94, 01008 128, 113, 217, -50, -261, 333, 325, 340, 325, 276, 01009 290, -261, -261, 240, 50, -261, -261, -261, -261, -261, 01010 271, 211, -261, -261, 325, 246, 246, 415, -261, 362, 01011 190, 6, -261, -261, 338, 363, -20, -261, 458, 598, 01012 -261, 88, -261, -261, -261, -261, -261, -261, 107, 676, 01013 676, 676, 367, 370, -261, 378, -261, -261, -3, -261, 01014 -261, 366, 101, 579, 226, -261, 80, -261, -261, 345, 01015 224, 660, 384, 386, -261, -261, 390, -261, 10, 10, 01016 -261, 10, 387, 31, -261, 395, -16, 345, -261, 338, 01017 624, -261, -261, -261, -41, 345, 244, -261, 377, 125, 01018 178, 439, -261, 93, -261, -261, -261, -261, -261, 650, 01019 -261, -261, -261, -261, -261, 410, -261, 398, -261, 345, 01020 -261, 416, 428, 429, 430, 435, -261, -261, -261, 436, 01021 -261, -261, -261, 441, 444, 10, 523, -261, -261, -261, 01022 -261, 442, -261, -261, 88, 345, 529, 255, 125, -261, 01023 -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, 01024 -261, 211, -261, -261, 328, -261, -261, -261, -261, 433, 01025 445, 325, -261, 446, -261, -261, -261, -261, -261, 443, 01026 142, -261, 434, 211, -261, 450, 452, -261, 523, 203, 01027 -261, -261, 455, -261, -261, -261, -261, 453, 293, -261, 01028 523, 463, 471, 472, -261, -261 01029 }; 01030 01031 /* YYPGOTO[NTERM-NUM]. */ 01032 static const yytype_int16 yypgoto[] = 01033 { 01034 -261, -261, 515, 536, 33, -261, -6, -261, -261, -261, 01035 -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, 01036 -261, -261, -128, -261, 172, -153, -261, -148, -144, 394, 01037 385, -51, 344, 247, 248, -66, -261, -261, -261, -261, 01038 -261, -261, -261, -261, -18, -261, 512, -38, 296, 311, 01039 225, 316, 417, 437, 427, 432, 438, -261, -179, -124, 01040 -261, -261, -11, -261, -261, -240, 124, -261, -149, -261, 01041 -261, 324, -232, -22, -261, 219, -261, 332, 287, -167, 01042 -242, 8, -99, -261, -260, -261, 256, -261, 511, -103, 01043 -184 01044 }; 01045 01046 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 01047 positive, shift that token. If negative, reduce the rule which 01048 number is the opposite. If YYTABLE_NINF, syntax error. */ 01049 #define YYTABLE_NINF -85 01050 static const yytype_int16 yytable[] = 01051 { 01052 15, 159, 44, 204, 195, 164, 225, 130, 194, 60, 01053 282, 227, 87, 107, 280, 166, 158, 44, 237, 238, 01054 235, 236, 169, 335, 271, 276, 322, 312, 132, 224, 01055 313, 153, 65, 66, 314, 150, 160, 11, 351, 352, 01056 97, 98, 270, 21, 337, 192, 289, 202, 111, 31, 01057 32, 353, 354, 7, 308, 169, 11, 187, 357, 169, 01058 1, 309, 153, 10, 107, 309, 169, 358, 44, 28, 01059 29, 30, 361, 31, 32, 362, 165, 287, 312, 361, 01060 83, 300, 188, 192, 304, 301, 167, 197, 226, 228, 01061 229, 230, 194, 277, 233, 205, 206, 207, 228, 228, 01062 226, 226, 271, 271, 271, 280, 399, 244, 355, 44, 01063 340, 331, 234, 44, 151, 170, 271, 112, 8, 231, 01064 270, 270, 270, -84, 173, 396, 294, 402, 280, 251, 01065 113, 22, 114, 44, 270, 44, 280, 33, 34, 282, 01066 223, 35, 341, -84, 173, 36, 37, 342, 140, 141, 01067 38, 178, 39, 191, 271, 279, 338, 40, 41, 313, 01068 285, 339, 271, 314, 313, 324, 193, 84, 321, 323, 01069 347, 348, 270, 349, 192, 24, 283, 25, 313, 332, 01070 270, 193, 321, 44, 315, 146, 280, 232, 280, 284, 01071 174, 175, 179, 192, -84, 193, 176, 298, 299, 271, 01072 366, 82, 174, 175, 28, 29, 30, 148, 31, 32, 01073 174, 175, 288, 367, -84, 373, 176, 270, 411, 142, 01074 143, 147, 323, 412, 226, 228, 154, 384, 88, 28, 01075 29, 30, 149, 31, 32, 295, 89, 90, 91, 92, 01076 93, 94, 95, 96, 97, 98, 99, 136, 137, 313, 01077 100, 101, 102, 314, 185, 417, 186, 191, 28, 29, 01078 30, 300, 31, 32, 155, 301, 12, 422, 192, -14, 01079 193, -14, 33, 34, 65, 66, 35, 189, 160, 190, 01080 36, 37, 68, 69, 13, 38, 168, 39, 156, 14, 01081 391, 61, 40, 41, 64, 65, 66, 33, 34, 160, 01082 177, 35, 157, 68, 69, 36, 37, 163, 152, 198, 01083 38, 153, 39, 138, 139, 336, 232, 40, 41, 174, 01084 175, 44, 363, 144, 145, 364, 33, 34, 368, 199, 01085 35, 368, 171, 172, 36, 37, 133, 134, 135, 38, 01086 200, 39, 391, 418, 401, 203, 40, 41, 28, 29, 01087 30, 247, 31, 32, 391, 174, 175, 292, 28, 29, 01088 30, 248, 31, 32, 249, 212, 213, 214, 215, 174, 01089 175, 293, 174, 175, 421, 253, 28, 29, 30, 252, 01090 31, 32, 116, 117, 118, 119, 120, 121, 122, 123, 01091 124, 125, 254, 325, 326, 327, 258, 414, 61, 62, 01092 63, 64, 65, 66, 174, 175, 67, 405, 406, 255, 01093 68, 69, 161, 162, 290, 70, 33, 34, 242, 243, 01094 35, 291, 245, 246, 36, 37, 33, 34, 296, 38, 01095 86, 39, 208, 209, 36, 37, 40, 41, 297, 38, 01096 307, 39, 126, 328, 33, 34, 40, 41, 131, 210, 01097 211, 329, 36, 37, 330, 333, 343, 38, 344, 39, 01098 216, 217, 346, 350, 40, 41, 88, 262, 263, 264, 01099 265, 266, 356, 365, 89, 90, 91, 92, 93, 94, 01100 95, 96, 97, 98, 99, 88, 371, 372, 100, 101, 01101 102, 378, 374, 89, 90, 91, 92, 93, 94, 95, 01102 96, 97, 98, 99, 375, 376, 377, 100, 101, 102, 01103 313, 407, 380, 382, 321, 267, 383, 9, 394, 410, 01104 408, 409, 415, 413, 416, 192, 419, 193, 88, 262, 01105 263, 264, 265, 266, 420, 423, 89, 90, 91, 92, 01106 93, 94, 95, 96, 97, 98, 99, 424, 425, 23, 01107 100, 101, 102, 404, 240, 115, 88, 262, 263, 264, 01108 265, 266, 239, 218, 89, 90, 91, 92, 93, 94, 01109 95, 96, 97, 98, 99, 220, 191, 267, 100, 101, 01110 102, 221, 310, 395, 219, 370, 306, 192, 222, 193, 01111 385, 386, 387, 388, 65, 66, 359, 184, 160, 0, 01112 397, 0, 68, 69, 0, 398, 88, 262, 263, 264, 01113 265, 266, 0, 0, 89, 90, 91, 92, 93, 94, 01114 95, 96, 97, 98, 99, 88, 0, 0, 100, 101, 01115 102, 0, 0, 89, 90, 91, 92, 93, 94, 95, 01116 96, 97, 98, 99, 0, 0, 0, 100, 101, 102, 01117 0, 88, 0, 0, 0, 334, 0, 0, 0, 89, 01118 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 01119 0, 0, 311, 100, 101, 102, 0, 88, 262, 263, 01120 264, 265, 266, 0, 0, 89, 90, 91, 92, 93, 01121 94, 95, 96, 97, 98, 99, 0, 0, 360, 100, 01122 101, 102, 369, 88, 262, 263, 264, 265, 266, 0, 01123 0, 89, 90, 91, 92, 93, 94, 95, 96, 97, 01124 98, 99, 0, 0, 0, 100, 101, 102, 62, 63, 01125 0, 65, 66, 0, 0, 160, 0, 0, 0, 68, 01126 69 01127 }; 01128 01129 #define yypact_value_is_default(yystate) \ 01130 ((yystate) == (-261)) 01131 01132 #define yytable_value_is_error(yytable_value) \ 01133 YYID (0) 01134 01135 static const yytype_int16 yycheck[] = 01136 { 01137 6, 67, 20, 127, 107, 12, 154, 45, 107, 20, 01138 194, 155, 30, 35, 193, 11, 67, 35, 166, 167, 01139 164, 165, 16, 283, 191, 192, 268, 259, 46, 153, 01140 71, 81, 71, 72, 75, 16, 75, 4, 7, 8, 01141 43, 44, 191, 75, 284, 86, 96, 113, 6, 7, 01142 8, 20, 21, 0, 74, 16, 23, 76, 74, 16, 01143 65, 81, 81, 65, 86, 81, 16, 307, 86, 3, 01144 4, 5, 314, 7, 8, 315, 83, 201, 310, 321, 01145 75, 71, 104, 86, 78, 75, 82, 109, 154, 155, 01146 156, 157, 191, 192, 160, 133, 134, 135, 164, 165, 01147 166, 167, 269, 270, 271, 284, 366, 173, 77, 127, 01148 289, 278, 163, 131, 95, 76, 283, 75, 65, 76, 01149 269, 270, 271, 12, 13, 365, 76, 367, 307, 180, 01150 88, 74, 90, 151, 283, 153, 315, 71, 72, 323, 01151 151, 75, 290, 12, 13, 79, 80, 291, 11, 12, 01152 84, 37, 86, 75, 321, 89, 76, 91, 92, 71, 01153 198, 81, 329, 75, 71, 268, 88, 75, 75, 268, 01154 298, 299, 321, 301, 86, 58, 75, 60, 71, 278, 01155 329, 88, 75, 201, 96, 91, 365, 76, 367, 88, 01156 79, 80, 78, 86, 83, 88, 85, 7, 8, 366, 01157 75, 74, 79, 80, 3, 4, 5, 94, 7, 8, 01158 79, 80, 89, 88, 83, 339, 85, 366, 76, 82, 01159 83, 93, 321, 81, 290, 291, 75, 355, 27, 3, 01160 4, 5, 15, 7, 8, 241, 35, 36, 37, 38, 01161 39, 40, 41, 42, 43, 44, 45, 79, 80, 71, 01162 49, 50, 51, 75, 71, 408, 73, 75, 3, 4, 01163 5, 71, 7, 8, 75, 75, 55, 420, 86, 58, 01164 88, 60, 71, 72, 71, 72, 75, 71, 75, 73, 01165 79, 80, 79, 80, 73, 84, 15, 86, 75, 78, 01166 356, 67, 91, 92, 70, 71, 72, 71, 72, 75, 01167 72, 75, 75, 79, 80, 79, 80, 75, 78, 76, 01168 84, 81, 86, 9, 10, 89, 76, 91, 92, 79, 01169 80, 339, 78, 13, 14, 81, 71, 72, 320, 71, 01170 75, 323, 86, 87, 79, 80, 85, 86, 87, 84, 01171 76, 86, 408, 409, 89, 71, 91, 92, 3, 4, 01172 5, 72, 7, 8, 420, 79, 80, 81, 3, 4, 01173 5, 76, 7, 8, 78, 140, 141, 142, 143, 79, 01174 80, 81, 79, 80, 81, 76, 3, 4, 5, 71, 01175 7, 8, 17, 18, 19, 20, 21, 22, 23, 24, 01176 25, 26, 73, 269, 270, 271, 73, 403, 67, 68, 01177 69, 70, 71, 72, 79, 80, 75, 79, 80, 71, 01178 79, 80, 68, 69, 81, 84, 71, 72, 171, 172, 01179 75, 81, 174, 175, 79, 80, 71, 72, 13, 84, 01180 75, 86, 136, 137, 79, 80, 91, 92, 76, 84, 01181 77, 86, 77, 76, 71, 72, 91, 92, 75, 138, 01182 139, 81, 79, 80, 76, 89, 72, 84, 72, 86, 01183 144, 145, 72, 76, 91, 92, 27, 28, 29, 30, 01184 31, 32, 77, 96, 35, 36, 37, 38, 39, 40, 01185 41, 42, 43, 44, 45, 27, 76, 89, 49, 50, 01186 51, 56, 76, 35, 36, 37, 38, 39, 40, 41, 01187 42, 43, 44, 45, 76, 76, 76, 49, 50, 51, 01188 71, 78, 76, 72, 75, 76, 72, 2, 76, 76, 01189 75, 75, 72, 89, 72, 86, 71, 88, 27, 28, 01190 29, 30, 31, 32, 81, 72, 35, 36, 37, 38, 01191 39, 40, 41, 42, 43, 44, 45, 76, 76, 13, 01192 49, 50, 51, 381, 169, 43, 27, 28, 29, 30, 01193 31, 32, 168, 146, 35, 36, 37, 38, 39, 40, 01194 41, 42, 43, 44, 45, 148, 75, 76, 49, 50, 01195 51, 149, 258, 364, 147, 329, 254, 86, 150, 88, 01196 67, 68, 69, 70, 71, 72, 309, 86, 75, -1, 01197 71, -1, 79, 80, -1, 76, 27, 28, 29, 30, 01198 31, 32, -1, -1, 35, 36, 37, 38, 39, 40, 01199 41, 42, 43, 44, 45, 27, -1, -1, 49, 50, 01200 51, -1, -1, 35, 36, 37, 38, 39, 40, 41, 01201 42, 43, 44, 45, -1, -1, -1, 49, 50, 51, 01202 -1, 27, -1, -1, -1, 76, -1, -1, -1, 35, 01203 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 01204 -1, -1, 74, 49, 50, 51, -1, 27, 28, 29, 01205 30, 31, 32, -1, -1, 35, 36, 37, 38, 39, 01206 40, 41, 42, 43, 44, 45, -1, -1, 74, 49, 01207 50, 51, 52, 27, 28, 29, 30, 31, 32, -1, 01208 -1, 35, 36, 37, 38, 39, 40, 41, 42, 43, 01209 44, 45, -1, -1, -1, 49, 50, 51, 68, 69, 01210 -1, 71, 72, -1, -1, 75, -1, -1, -1, 79, 01211 80 01212 }; 01213 01214 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 01215 symbol of state STATE-NUM. */ 01216 static const yytype_uint8 yystos[] = 01217 { 01218 0, 65, 98, 99, 100, 101, 102, 0, 65, 99, 01219 65, 101, 55, 73, 78, 103, 104, 105, 108, 160, 01220 161, 75, 74, 100, 58, 60, 111, 120, 3, 4, 01221 5, 7, 8, 71, 72, 75, 79, 80, 84, 86, 01222 91, 92, 137, 138, 141, 142, 143, 144, 145, 146, 01223 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 01224 159, 67, 68, 69, 70, 71, 72, 75, 79, 80, 01225 84, 124, 125, 126, 127, 128, 129, 130, 131, 132, 01226 135, 136, 74, 75, 75, 113, 75, 141, 27, 35, 01227 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 01228 49, 50, 51, 159, 165, 166, 167, 170, 173, 176, 01229 185, 6, 75, 88, 90, 143, 17, 18, 19, 20, 01230 21, 22, 23, 24, 25, 26, 77, 157, 158, 141, 01231 144, 75, 141, 85, 86, 87, 79, 80, 9, 10, 01232 11, 12, 82, 83, 13, 14, 91, 93, 94, 15, 01233 16, 95, 78, 81, 75, 75, 75, 75, 128, 132, 01234 75, 129, 129, 75, 12, 83, 11, 82, 15, 16, 01235 76, 86, 87, 13, 79, 80, 85, 72, 37, 78, 01236 114, 116, 103, 121, 185, 71, 73, 76, 170, 71, 01237 73, 75, 86, 88, 179, 186, 187, 170, 76, 71, 01238 76, 139, 132, 71, 156, 144, 144, 144, 145, 145, 01239 146, 146, 147, 147, 147, 147, 148, 148, 149, 150, 01240 151, 152, 153, 159, 156, 124, 132, 125, 132, 132, 01241 132, 76, 76, 132, 128, 125, 125, 124, 124, 126, 01242 127, 109, 130, 130, 132, 131, 131, 72, 76, 78, 01243 117, 128, 71, 76, 73, 71, 174, 175, 73, 168, 01244 169, 170, 28, 29, 30, 31, 32, 76, 163, 164, 01245 165, 176, 181, 182, 183, 186, 176, 179, 180, 89, 01246 155, 162, 187, 75, 88, 144, 140, 156, 89, 96, 01247 81, 81, 81, 81, 76, 103, 13, 76, 7, 8, 01248 71, 75, 118, 119, 78, 115, 174, 77, 74, 81, 01249 168, 74, 169, 71, 75, 96, 171, 172, 177, 178, 01250 179, 75, 177, 179, 186, 163, 163, 163, 76, 81, 01251 76, 176, 179, 89, 76, 181, 89, 162, 76, 81, 01252 155, 124, 125, 72, 72, 110, 72, 119, 119, 119, 01253 76, 7, 8, 20, 21, 77, 77, 74, 162, 175, 01254 74, 177, 162, 78, 81, 96, 75, 88, 178, 52, 01255 183, 76, 89, 156, 76, 76, 76, 76, 56, 106, 01256 76, 112, 72, 72, 119, 67, 68, 69, 70, 122, 01257 123, 132, 133, 134, 76, 172, 162, 71, 76, 181, 01258 184, 89, 162, 107, 121, 79, 80, 78, 75, 75, 01259 76, 76, 81, 89, 103, 72, 72, 122, 132, 71, 01260 81, 81, 122, 72, 76, 76 01261 }; 01262 01263 #define yyerrok (yyerrstatus = 0) 01264 #define yyclearin (yychar = YYEMPTY) 01265 #define YYEMPTY (-2) 01266 #define YYEOF 0 01267 01268 #define YYACCEPT goto yyacceptlab 01269 #define YYABORT goto yyabortlab 01270 #define YYERROR goto yyerrorlab 01271 01272 01273 /* Like YYERROR except do call yyerror. This remains here temporarily 01274 to ease the transition to the new meaning of YYERROR, for GCC. 01275 Once GCC version 2 has supplanted version 1, this can go. However, 01276 YYFAIL appears to be in use. Nevertheless, it is formally deprecated 01277 in Bison 2.4.2's NEWS entry, where a plan to phase it out is 01278 discussed. */ 01279 01280 #define YYFAIL goto yyerrlab 01281 #if defined YYFAIL 01282 /* This is here to suppress warnings from the GCC cpp's 01283 -Wunused-macros. Normally we don't worry about that warning, but 01284 some users do, and we want to make it easy for users to remove 01285 YYFAIL uses, which will produce warnings from Bison 2.5. */ 01286 #endif 01287 01288 #define YYRECOVERING() (!!yyerrstatus) 01289 01290 #define YYBACKUP(Token, Value) \ 01291 do \ 01292 if (yychar == YYEMPTY && yylen == 1) \ 01293 { \ 01294 yychar = (Token); \ 01295 yylval = (Value); \ 01296 YYPOPSTACK (1); \ 01297 goto yybackup; \ 01298 } \ 01299 else \ 01300 { \ 01301 yyerror (YY_("syntax error: cannot back up")); \ 01302 YYERROR; \ 01303 } \ 01304 while (YYID (0)) 01305 01306 01307 #define YYTERROR 1 01308 #define YYERRCODE 256 01309 01310 01311 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 01312 If N is 0, then set CURRENT to the empty location which ends 01313 the previous symbol: RHS[0] (always defined). */ 01314 01315 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 01316 #ifndef YYLLOC_DEFAULT 01317 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 01318 do \ 01319 if (YYID (N)) \ 01320 { \ 01321 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 01322 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 01323 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 01324 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 01325 } \ 01326 else \ 01327 { \ 01328 (Current).first_line = (Current).last_line = \ 01329 YYRHSLOC (Rhs, 0).last_line; \ 01330 (Current).first_column = (Current).last_column = \ 01331 YYRHSLOC (Rhs, 0).last_column; \ 01332 } \ 01333 while (YYID (0)) 01334 #endif 01335 01336 01337 /* This macro is provided for backward compatibility. */ 01338 01339 #ifndef YY_LOCATION_PRINT 01340 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 01341 #endif 01342 01343 01344 /* YYLEX -- calling `yylex' with the right arguments. */ 01345 01346 #ifdef YYLEX_PARAM 01347 # define YYLEX yylex (YYLEX_PARAM) 01348 #else 01349 # define YYLEX yylex () 01350 #endif 01351 01352 /* Enable debugging if requested. */ 01353 #if YYDEBUG 01354 01355 # ifndef YYFPRINTF 01356 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 01357 # define YYFPRINTF fprintf 01358 # endif 01359 01360 # define YYDPRINTF(Args) \ 01361 do { \ 01362 if (yydebug) \ 01363 YYFPRINTF Args; \ 01364 } while (YYID (0)) 01365 01366 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 01367 do { \ 01368 if (yydebug) \ 01369 { \ 01370 YYFPRINTF (stderr, "%s ", Title); \ 01371 yy_symbol_print (stderr, \ 01372 Type, Value); \ 01373 YYFPRINTF (stderr, "\n"); \ 01374 } \ 01375 } while (YYID (0)) 01376 01377 01378 /*--------------------------------. 01379 | Print this symbol on YYOUTPUT. | 01380 `--------------------------------*/ 01381 01382 /*ARGSUSED*/ 01383 #if (defined __STDC__ || defined __C99__FUNC__ \ 01384 || defined __cplusplus || defined _MSC_VER) 01385 static void 01386 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 01387 #else 01388 static void 01389 yy_symbol_value_print (yyoutput, yytype, yyvaluep) 01390 FILE *yyoutput; 01391 int yytype; 01392 YYSTYPE const * const yyvaluep; 01393 #endif 01394 { 01395 if (!yyvaluep) 01396 return; 01397 # ifdef YYPRINT 01398 if (yytype < YYNTOKENS) 01399 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 01400 # else 01401 YYUSE (yyoutput); 01402 # endif 01403 switch (yytype) 01404 { 01405 default: 01406 break; 01407 } 01408 } 01409 01410 01411 /*--------------------------------. 01412 | Print this symbol on YYOUTPUT. | 01413 `--------------------------------*/ 01414 01415 #if (defined __STDC__ || defined __C99__FUNC__ \ 01416 || defined __cplusplus || defined _MSC_VER) 01417 static void 01418 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 01419 #else 01420 static void 01421 yy_symbol_print (yyoutput, yytype, yyvaluep) 01422 FILE *yyoutput; 01423 int yytype; 01424 YYSTYPE const * const yyvaluep; 01425 #endif 01426 { 01427 if (yytype < YYNTOKENS) 01428 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 01429 else 01430 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 01431 01432 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 01433 YYFPRINTF (yyoutput, ")"); 01434 } 01435 01436 /*------------------------------------------------------------------. 01437 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 01438 | TOP (included). | 01439 `------------------------------------------------------------------*/ 01440 01441 #if (defined __STDC__ || defined __C99__FUNC__ \ 01442 || defined __cplusplus || defined _MSC_VER) 01443 static void 01444 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 01445 #else 01446 static void 01447 yy_stack_print (yybottom, yytop) 01448 yytype_int16 *yybottom; 01449 yytype_int16 *yytop; 01450 #endif 01451 { 01452 YYFPRINTF (stderr, "Stack now"); 01453 for (; yybottom <= yytop; yybottom++) 01454 { 01455 int yybot = *yybottom; 01456 YYFPRINTF (stderr, " %d", yybot); 01457 } 01458 YYFPRINTF (stderr, "\n"); 01459 } 01460 01461 # define YY_STACK_PRINT(Bottom, Top) \ 01462 do { \ 01463 if (yydebug) \ 01464 yy_stack_print ((Bottom), (Top)); \ 01465 } while (YYID (0)) 01466 01467 01468 /*------------------------------------------------. 01469 | Report that the YYRULE is going to be reduced. | 01470 `------------------------------------------------*/ 01471 01472 #if (defined __STDC__ || defined __C99__FUNC__ \ 01473 || defined __cplusplus || defined _MSC_VER) 01474 static void 01475 yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 01476 #else 01477 static void 01478 yy_reduce_print (yyvsp, yyrule) 01479 YYSTYPE *yyvsp; 01480 int yyrule; 01481 #endif 01482 { 01483 int yynrhs = yyr2[yyrule]; 01484 int yyi; 01485 unsigned long int yylno = yyrline[yyrule]; 01486 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 01487 yyrule - 1, yylno); 01488 /* The symbols being reduced. */ 01489 for (yyi = 0; yyi < yynrhs; yyi++) 01490 { 01491 YYFPRINTF (stderr, " $%d = ", yyi + 1); 01492 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 01493 &(yyvsp[(yyi + 1) - (yynrhs)]) 01494 ); 01495 YYFPRINTF (stderr, "\n"); 01496 } 01497 } 01498 01499 # define YY_REDUCE_PRINT(Rule) \ 01500 do { \ 01501 if (yydebug) \ 01502 yy_reduce_print (yyvsp, Rule); \ 01503 } while (YYID (0)) 01504 01505 /* Nonzero means print parse trace. It is left uninitialized so that 01506 multiple parsers can coexist. */ 01507 int yydebug; 01508 #else /* !YYDEBUG */ 01509 # define YYDPRINTF(Args) 01510 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 01511 # define YY_STACK_PRINT(Bottom, Top) 01512 # define YY_REDUCE_PRINT(Rule) 01513 #endif /* !YYDEBUG */ 01514 01515 01516 /* YYINITDEPTH -- initial size of the parser's stacks. */ 01517 #ifndef YYINITDEPTH 01518 # define YYINITDEPTH 200 01519 #endif 01520 01521 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 01522 if the built-in stack extension method is used). 01523 01524 Do not make this value too large; the results are undefined if 01525 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 01526 evaluated with infinite-precision integer arithmetic. */ 01527 01528 #ifndef YYMAXDEPTH 01529 # define YYMAXDEPTH 10000 01530 #endif 01531 01532 01533 #if YYERROR_VERBOSE 01534 01535 # ifndef yystrlen 01536 # if defined __GLIBC__ && defined _STRING_H 01537 # define yystrlen strlen 01538 # else 01539 /* Return the length of YYSTR. */ 01540 #if (defined __STDC__ || defined __C99__FUNC__ \ 01541 || defined __cplusplus || defined _MSC_VER) 01542 static YYSIZE_T 01543 yystrlen (const char *yystr) 01544 #else 01545 static YYSIZE_T 01546 yystrlen (yystr) 01547 const char *yystr; 01548 #endif 01549 { 01550 YYSIZE_T yylen; 01551 for (yylen = 0; yystr[yylen]; yylen++) 01552 continue; 01553 return yylen; 01554 } 01555 # endif 01556 # endif 01557 01558 # ifndef yystpcpy 01559 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 01560 # define yystpcpy stpcpy 01561 # else 01562 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 01563 YYDEST. */ 01564 #if (defined __STDC__ || defined __C99__FUNC__ \ 01565 || defined __cplusplus || defined _MSC_VER) 01566 static char * 01567 yystpcpy (char *yydest, const char *yysrc) 01568 #else 01569 static char * 01570 yystpcpy (yydest, yysrc) 01571 char *yydest; 01572 const char *yysrc; 01573 #endif 01574 { 01575 char *yyd = yydest; 01576 const char *yys = yysrc; 01577 01578 while ((*yyd++ = *yys++) != '\0') 01579 continue; 01580 01581 return yyd - 1; 01582 } 01583 # endif 01584 # endif 01585 01586 # ifndef yytnamerr 01587 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 01588 quotes and backslashes, so that it's suitable for yyerror. The 01589 heuristic is that double-quoting is unnecessary unless the string 01590 contains an apostrophe, a comma, or backslash (other than 01591 backslash-backslash). YYSTR is taken from yytname. If YYRES is 01592 null, do not copy; instead, return the length of what the result 01593 would have been. */ 01594 static YYSIZE_T 01595 yytnamerr (char *yyres, const char *yystr) 01596 { 01597 if (*yystr == '"') 01598 { 01599 YYSIZE_T yyn = 0; 01600 char const *yyp = yystr; 01601 01602 for (;;) 01603 switch (*++yyp) 01604 { 01605 case '\'': 01606 case ',': 01607 goto do_not_strip_quotes; 01608 01609 case '\\': 01610 if (*++yyp != '\\') 01611 goto do_not_strip_quotes; 01612 /* Fall through. */ 01613 default: 01614 if (yyres) 01615 yyres[yyn] = *yyp; 01616 yyn++; 01617 break; 01618 01619 case '"': 01620 if (yyres) 01621 yyres[yyn] = '\0'; 01622 return yyn; 01623 } 01624 do_not_strip_quotes: ; 01625 } 01626 01627 if (! yyres) 01628 return yystrlen (yystr); 01629 01630 return yystpcpy (yyres, yystr) - yyres; 01631 } 01632 # endif 01633 01634 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 01635 about the unexpected token YYTOKEN for the state stack whose top is 01636 YYSSP. 01637 01638 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 01639 not large enough to hold the message. In that case, also set 01640 *YYMSG_ALLOC to the required number of bytes. Return 2 if the 01641 required number of bytes is too large to store. */ 01642 static int 01643 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 01644 yytype_int16 *yyssp, int yytoken) 01645 { 01646 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); 01647 YYSIZE_T yysize = yysize0; 01648 YYSIZE_T yysize1; 01649 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 01650 /* Internationalized format string. */ 01651 const char *yyformat = 0; 01652 /* Arguments of yyformat. */ 01653 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 01654 /* Number of reported tokens (one for the "unexpected", one per 01655 "expected"). */ 01656 int yycount = 0; 01657 01658 /* There are many possibilities here to consider: 01659 - Assume YYFAIL is not used. It's too flawed to consider. See 01660 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> 01661 for details. YYERROR is fine as it does not invoke this 01662 function. 01663 - If this state is a consistent state with a default action, then 01664 the only way this function was invoked is if the default action 01665 is an error action. In that case, don't check for expected 01666 tokens because there are none. 01667 - The only way there can be no lookahead present (in yychar) is if 01668 this state is a consistent state with a default action. Thus, 01669 detecting the absence of a lookahead is sufficient to determine 01670 that there is no unexpected or expected token to report. In that 01671 case, just report a simple "syntax error". 01672 - Don't assume there isn't a lookahead just because this state is a 01673 consistent state with a default action. There might have been a 01674 previous inconsistent state, consistent state with a non-default 01675 action, or user semantic action that manipulated yychar. 01676 - Of course, the expected token list depends on states to have 01677 correct lookahead information, and it depends on the parser not 01678 to perform extra reductions after fetching a lookahead from the 01679 scanner and before detecting a syntax error. Thus, state merging 01680 (from LALR or IELR) and default reductions corrupt the expected 01681 token list. However, the list is correct for canonical LR with 01682 one exception: it will still contain any token that will not be 01683 accepted due to an error action in a later state. 01684 */ 01685 if (yytoken != YYEMPTY) 01686 { 01687 int yyn = yypact[*yyssp]; 01688 yyarg[yycount++] = yytname[yytoken]; 01689 if (!yypact_value_is_default (yyn)) 01690 { 01691 /* Start YYX at -YYN if negative to avoid negative indexes in 01692 YYCHECK. In other words, skip the first -YYN actions for 01693 this state because they are default actions. */ 01694 int yyxbegin = yyn < 0 ? -yyn : 0; 01695 /* Stay within bounds of both yycheck and yytname. */ 01696 int yychecklim = YYLAST - yyn + 1; 01697 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 01698 int yyx; 01699 01700 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 01701 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 01702 && !yytable_value_is_error (yytable[yyx + yyn])) 01703 { 01704 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 01705 { 01706 yycount = 1; 01707 yysize = yysize0; 01708 break; 01709 } 01710 yyarg[yycount++] = yytname[yyx]; 01711 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 01712 if (! (yysize <= yysize1 01713 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 01714 return 2; 01715 yysize = yysize1; 01716 } 01717 } 01718 } 01719 01720 switch (yycount) 01721 { 01722 # define YYCASE_(N, S) \ 01723 case N: \ 01724 yyformat = S; \ 01725 break 01726 YYCASE_(0, YY_("syntax error")); 01727 YYCASE_(1, YY_("syntax error, unexpected %s")); 01728 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 01729 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 01730 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 01731 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 01732 # undef YYCASE_ 01733 } 01734 01735 yysize1 = yysize + yystrlen (yyformat); 01736 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 01737 return 2; 01738 yysize = yysize1; 01739 01740 if (*yymsg_alloc < yysize) 01741 { 01742 *yymsg_alloc = 2 * yysize; 01743 if (! (yysize <= *yymsg_alloc 01744 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 01745 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 01746 return 1; 01747 } 01748 01749 /* Avoid sprintf, as that infringes on the user's name space. 01750 Don't have undefined behavior even if the translation 01751 produced a string with the wrong number of "%s"s. */ 01752 { 01753 char *yyp = *yymsg; 01754 int yyi = 0; 01755 while ((*yyp = *yyformat) != '\0') 01756 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 01757 { 01758 yyp += yytnamerr (yyp, yyarg[yyi++]); 01759 yyformat += 2; 01760 } 01761 else 01762 { 01763 yyp++; 01764 yyformat++; 01765 } 01766 } 01767 return 0; 01768 } 01769 #endif /* YYERROR_VERBOSE */ 01770 01771 /*-----------------------------------------------. 01772 | Release the memory associated to this symbol. | 01773 `-----------------------------------------------*/ 01774 01775 /*ARGSUSED*/ 01776 #if (defined __STDC__ || defined __C99__FUNC__ \ 01777 || defined __cplusplus || defined _MSC_VER) 01778 static void 01779 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 01780 #else 01781 static void 01782 yydestruct (yymsg, yytype, yyvaluep) 01783 const char *yymsg; 01784 int yytype; 01785 YYSTYPE *yyvaluep; 01786 #endif 01787 { 01788 YYUSE (yyvaluep); 01789 01790 if (!yymsg) 01791 yymsg = "Deleting"; 01792 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 01793 01794 switch (yytype) 01795 { 01796 case 71: /* "ID" */ 01797 01798 /* Line 1391 of yacc.c */ 01799 #line 213 "parser.y" 01800 { free((yyvaluep->symbol)); }; 01801 01802 /* Line 1391 of yacc.c */ 01803 #line 1804 "source/parser.c" 01804 break; 01805 case 100: /* "statement_list" */ 01806 01807 /* Line 1391 of yacc.c */ 01808 #line 216 "parser.y" 01809 { osl_statement_free((yyvaluep->stmt)); }; 01810 01811 /* Line 1391 of yacc.c */ 01812 #line 1813 "source/parser.c" 01813 break; 01814 case 101: /* "statement_indented" */ 01815 01816 /* Line 1391 of yacc.c */ 01817 #line 216 "parser.y" 01818 { osl_statement_free((yyvaluep->stmt)); }; 01819 01820 /* Line 1391 of yacc.c */ 01821 #line 1822 "source/parser.c" 01822 break; 01823 case 103: /* "statement" */ 01824 01825 /* Line 1391 of yacc.c */ 01826 #line 216 "parser.y" 01827 { osl_statement_free((yyvaluep->stmt)); }; 01828 01829 /* Line 1391 of yacc.c */ 01830 #line 1831 "source/parser.c" 01831 break; 01832 case 105: /* "compound_statement" */ 01833 01834 /* Line 1391 of yacc.c */ 01835 #line 216 "parser.y" 01836 { osl_statement_free((yyvaluep->stmt)); }; 01837 01838 /* Line 1391 of yacc.c */ 01839 #line 1840 "source/parser.c" 01840 break; 01841 case 106: /* "selection_else_statement" */ 01842 01843 /* Line 1391 of yacc.c */ 01844 #line 216 "parser.y" 01845 { osl_statement_free((yyvaluep->stmt)); }; 01846 01847 /* Line 1391 of yacc.c */ 01848 #line 1849 "source/parser.c" 01849 break; 01850 case 108: /* "selection_statement" */ 01851 01852 /* Line 1391 of yacc.c */ 01853 #line 216 "parser.y" 01854 { osl_statement_free((yyvaluep->stmt)); }; 01855 01856 /* Line 1391 of yacc.c */ 01857 #line 1858 "source/parser.c" 01858 break; 01859 case 111: /* "iteration_statement" */ 01860 01861 /* Line 1391 of yacc.c */ 01862 #line 216 "parser.y" 01863 { osl_statement_free((yyvaluep->stmt)); }; 01864 01865 /* Line 1391 of yacc.c */ 01866 #line 1867 "source/parser.c" 01867 break; 01868 case 119: /* "idparent" */ 01869 01870 /* Line 1391 of yacc.c */ 01871 #line 213 "parser.y" 01872 { free((yyvaluep->symbol)); }; 01873 01874 /* Line 1391 of yacc.c */ 01875 #line 1876 "source/parser.c" 01876 break; 01877 case 121: /* "loop_body" */ 01878 01879 /* Line 1391 of yacc.c */ 01880 #line 216 "parser.y" 01881 { osl_statement_free((yyvaluep->stmt)); }; 01882 01883 /* Line 1391 of yacc.c */ 01884 #line 1885 "source/parser.c" 01885 break; 01886 case 129: /* "affine_primary_expression" */ 01887 01888 /* Line 1391 of yacc.c */ 01889 #line 214 "parser.y" 01890 { osl_vector_free((yyvaluep->affex)); }; 01891 01892 /* Line 1391 of yacc.c */ 01893 #line 1894 "source/parser.c" 01894 break; 01895 case 130: /* "affine_unary_expression" */ 01896 01897 /* Line 1391 of yacc.c */ 01898 #line 214 "parser.y" 01899 { osl_vector_free((yyvaluep->affex)); }; 01900 01901 /* Line 1391 of yacc.c */ 01902 #line 1903 "source/parser.c" 01903 break; 01904 case 131: /* "affine_multiplicative_expression" */ 01905 01906 /* Line 1391 of yacc.c */ 01907 #line 214 "parser.y" 01908 { osl_vector_free((yyvaluep->affex)); }; 01909 01910 /* Line 1391 of yacc.c */ 01911 #line 1912 "source/parser.c" 01912 break; 01913 case 132: /* "affine_expression" */ 01914 01915 /* Line 1391 of yacc.c */ 01916 #line 214 "parser.y" 01917 { osl_vector_free((yyvaluep->affex)); }; 01918 01919 /* Line 1391 of yacc.c */ 01920 #line 1921 "source/parser.c" 01921 break; 01922 case 133: /* "affine_ceildfloord_expression" */ 01923 01924 /* Line 1391 of yacc.c */ 01925 #line 214 "parser.y" 01926 { osl_vector_free((yyvaluep->affex)); }; 01927 01928 /* Line 1391 of yacc.c */ 01929 #line 1930 "source/parser.c" 01930 break; 01931 case 135: /* "affine_ceild_expression" */ 01932 01933 /* Line 1391 of yacc.c */ 01934 #line 214 "parser.y" 01935 { osl_vector_free((yyvaluep->affex)); }; 01936 01937 /* Line 1391 of yacc.c */ 01938 #line 1939 "source/parser.c" 01939 break; 01940 case 136: /* "affine_floord_expression" */ 01941 01942 /* Line 1391 of yacc.c */ 01943 #line 214 "parser.y" 01944 { osl_vector_free((yyvaluep->affex)); }; 01945 01946 /* Line 1391 of yacc.c */ 01947 #line 1948 "source/parser.c" 01948 break; 01949 case 137: /* "primary_expression" */ 01950 01951 /* Line 1391 of yacc.c */ 01952 #line 215 "parser.y" 01953 { osl_relation_list_free((yyvaluep->list)); }; 01954 01955 /* Line 1391 of yacc.c */ 01956 #line 1957 "source/parser.c" 01957 break; 01958 case 138: /* "postfix_expression" */ 01959 01960 /* Line 1391 of yacc.c */ 01961 #line 215 "parser.y" 01962 { osl_relation_list_free((yyvaluep->list)); }; 01963 01964 /* Line 1391 of yacc.c */ 01965 #line 1966 "source/parser.c" 01966 break; 01967 case 140: /* "argument_expression_list" */ 01968 01969 /* Line 1391 of yacc.c */ 01970 #line 215 "parser.y" 01971 { osl_relation_list_free((yyvaluep->list)); }; 01972 01973 /* Line 1391 of yacc.c */ 01974 #line 1975 "source/parser.c" 01975 break; 01976 case 141: /* "unary_expression" */ 01977 01978 /* Line 1391 of yacc.c */ 01979 #line 215 "parser.y" 01980 { osl_relation_list_free((yyvaluep->list)); }; 01981 01982 /* Line 1391 of yacc.c */ 01983 #line 1984 "source/parser.c" 01984 break; 01985 case 144: /* "cast_expression" */ 01986 01987 /* Line 1391 of yacc.c */ 01988 #line 215 "parser.y" 01989 { osl_relation_list_free((yyvaluep->list)); }; 01990 01991 /* Line 1391 of yacc.c */ 01992 #line 1993 "source/parser.c" 01993 break; 01994 case 145: /* "multiplicative_expression" */ 01995 01996 /* Line 1391 of yacc.c */ 01997 #line 215 "parser.y" 01998 { osl_relation_list_free((yyvaluep->list)); }; 01999 02000 /* Line 1391 of yacc.c */ 02001 #line 2002 "source/parser.c" 02002 break; 02003 case 146: /* "additive_expression" */ 02004 02005 /* Line 1391 of yacc.c */ 02006 #line 215 "parser.y" 02007 { osl_relation_list_free((yyvaluep->list)); }; 02008 02009 /* Line 1391 of yacc.c */ 02010 #line 2011 "source/parser.c" 02011 break; 02012 case 147: /* "shift_expression" */ 02013 02014 /* Line 1391 of yacc.c */ 02015 #line 215 "parser.y" 02016 { osl_relation_list_free((yyvaluep->list)); }; 02017 02018 /* Line 1391 of yacc.c */ 02019 #line 2020 "source/parser.c" 02020 break; 02021 case 148: /* "relational_expression" */ 02022 02023 /* Line 1391 of yacc.c */ 02024 #line 215 "parser.y" 02025 { osl_relation_list_free((yyvaluep->list)); }; 02026 02027 /* Line 1391 of yacc.c */ 02028 #line 2029 "source/parser.c" 02029 break; 02030 case 149: /* "equality_expression" */ 02031 02032 /* Line 1391 of yacc.c */ 02033 #line 215 "parser.y" 02034 { osl_relation_list_free((yyvaluep->list)); }; 02035 02036 /* Line 1391 of yacc.c */ 02037 #line 2038 "source/parser.c" 02038 break; 02039 case 150: /* "and_expression" */ 02040 02041 /* Line 1391 of yacc.c */ 02042 #line 215 "parser.y" 02043 { osl_relation_list_free((yyvaluep->list)); }; 02044 02045 /* Line 1391 of yacc.c */ 02046 #line 2047 "source/parser.c" 02047 break; 02048 case 151: /* "exclusive_or_expression" */ 02049 02050 /* Line 1391 of yacc.c */ 02051 #line 215 "parser.y" 02052 { osl_relation_list_free((yyvaluep->list)); }; 02053 02054 /* Line 1391 of yacc.c */ 02055 #line 2056 "source/parser.c" 02056 break; 02057 case 152: /* "inclusive_or_expression" */ 02058 02059 /* Line 1391 of yacc.c */ 02060 #line 215 "parser.y" 02061 { osl_relation_list_free((yyvaluep->list)); }; 02062 02063 /* Line 1391 of yacc.c */ 02064 #line 2065 "source/parser.c" 02065 break; 02066 case 153: /* "logical_and_expression" */ 02067 02068 /* Line 1391 of yacc.c */ 02069 #line 215 "parser.y" 02070 { osl_relation_list_free((yyvaluep->list)); }; 02071 02072 /* Line 1391 of yacc.c */ 02073 #line 2074 "source/parser.c" 02074 break; 02075 case 154: /* "logical_or_expression" */ 02076 02077 /* Line 1391 of yacc.c */ 02078 #line 215 "parser.y" 02079 { osl_relation_list_free((yyvaluep->list)); }; 02080 02081 /* Line 1391 of yacc.c */ 02082 #line 2083 "source/parser.c" 02083 break; 02084 case 155: /* "conditional_expression" */ 02085 02086 /* Line 1391 of yacc.c */ 02087 #line 215 "parser.y" 02088 { osl_relation_list_free((yyvaluep->list)); }; 02089 02090 /* Line 1391 of yacc.c */ 02091 #line 2092 "source/parser.c" 02092 break; 02093 case 156: /* "assignment_expression" */ 02094 02095 /* Line 1391 of yacc.c */ 02096 #line 215 "parser.y" 02097 { osl_relation_list_free((yyvaluep->list)); }; 02098 02099 /* Line 1391 of yacc.c */ 02100 #line 2101 "source/parser.c" 02101 break; 02102 case 159: /* "expression" */ 02103 02104 /* Line 1391 of yacc.c */ 02105 #line 215 "parser.y" 02106 { osl_relation_list_free((yyvaluep->list)); }; 02107 02108 /* Line 1391 of yacc.c */ 02109 #line 2110 "source/parser.c" 02110 break; 02111 case 160: /* "expression_statement" */ 02112 02113 /* Line 1391 of yacc.c */ 02114 #line 216 "parser.y" 02115 { osl_statement_free((yyvaluep->stmt)); }; 02116 02117 /* Line 1391 of yacc.c */ 02118 #line 2119 "source/parser.c" 02119 break; 02120 02121 default: 02122 break; 02123 } 02124 } 02125 02126 02127 /* Prevent warnings from -Wmissing-prototypes. */ 02128 #ifdef YYPARSE_PARAM 02129 #if defined __STDC__ || defined __cplusplus 02130 int yyparse (void *YYPARSE_PARAM); 02131 #else 02132 int yyparse (); 02133 #endif 02134 #else /* ! YYPARSE_PARAM */ 02135 #if defined __STDC__ || defined __cplusplus 02136 int yyparse (void); 02137 #else 02138 int yyparse (); 02139 #endif 02140 #endif /* ! YYPARSE_PARAM */ 02141 02142 02143 /* The lookahead symbol. */ 02144 int yychar; 02145 02146 /* The semantic value of the lookahead symbol. */ 02147 YYSTYPE yylval; 02148 02149 /* Number of syntax errors so far. */ 02150 int yynerrs; 02151 02152 02153 /*----------. 02154 | yyparse. | 02155 `----------*/ 02156 02157 #ifdef YYPARSE_PARAM 02158 #if (defined __STDC__ || defined __C99__FUNC__ \ 02159 || defined __cplusplus || defined _MSC_VER) 02160 int 02161 yyparse (void *YYPARSE_PARAM) 02162 #else 02163 int 02164 yyparse (YYPARSE_PARAM) 02165 void *YYPARSE_PARAM; 02166 #endif 02167 #else /* ! YYPARSE_PARAM */ 02168 #if (defined __STDC__ || defined __C99__FUNC__ \ 02169 || defined __cplusplus || defined _MSC_VER) 02170 int 02171 yyparse (void) 02172 #else 02173 int 02174 yyparse () 02175 02176 #endif 02177 #endif 02178 { 02179 int yystate; 02180 /* Number of tokens to shift before error messages enabled. */ 02181 int yyerrstatus; 02182 02183 /* The stacks and their tools: 02184 `yyss': related to states. 02185 `yyvs': related to semantic values. 02186 02187 Refer to the stacks thru separate pointers, to allow yyoverflow 02188 to reallocate them elsewhere. */ 02189 02190 /* The state stack. */ 02191 yytype_int16 yyssa[YYINITDEPTH]; 02192 yytype_int16 *yyss; 02193 yytype_int16 *yyssp; 02194 02195 /* The semantic value stack. */ 02196 YYSTYPE yyvsa[YYINITDEPTH]; 02197 YYSTYPE *yyvs; 02198 YYSTYPE *yyvsp; 02199 02200 YYSIZE_T yystacksize; 02201 02202 int yyn; 02203 int yyresult; 02204 /* Lookahead token as an internal (translated) token number. */ 02205 int yytoken; 02206 /* The variables used to return semantic value and location from the 02207 action routines. */ 02208 YYSTYPE yyval; 02209 02210 #if YYERROR_VERBOSE 02211 /* Buffer for error messages, and its allocated size. */ 02212 char yymsgbuf[128]; 02213 char *yymsg = yymsgbuf; 02214 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 02215 #endif 02216 02217 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 02218 02219 /* The number of symbols on the RHS of the reduced rule. 02220 Keep to zero when no symbol should be popped. */ 02221 int yylen = 0; 02222 02223 yytoken = 0; 02224 yyss = yyssa; 02225 yyvs = yyvsa; 02226 yystacksize = YYINITDEPTH; 02227 02228 YYDPRINTF ((stderr, "Starting parse\n")); 02229 02230 yystate = 0; 02231 yyerrstatus = 0; 02232 yynerrs = 0; 02233 yychar = YYEMPTY; /* Cause a token to be read. */ 02234 02235 /* Initialize stack pointers. 02236 Waste one element of value and location stack 02237 so that they stay on the same level as the state stack. 02238 The wasted elements are never initialized. */ 02239 yyssp = yyss; 02240 yyvsp = yyvs; 02241 02242 goto yysetstate; 02243 02244 /*------------------------------------------------------------. 02245 | yynewstate -- Push a new state, which is found in yystate. | 02246 `------------------------------------------------------------*/ 02247 yynewstate: 02248 /* In all cases, when you get here, the value and location stacks 02249 have just been pushed. So pushing a state here evens the stacks. */ 02250 yyssp++; 02251 02252 yysetstate: 02253 *yyssp = yystate; 02254 02255 if (yyss + yystacksize - 1 <= yyssp) 02256 { 02257 /* Get the current used size of the three stacks, in elements. */ 02258 YYSIZE_T yysize = yyssp - yyss + 1; 02259 02260 #ifdef yyoverflow 02261 { 02262 /* Give user a chance to reallocate the stack. Use copies of 02263 these so that the &'s don't force the real ones into 02264 memory. */ 02265 YYSTYPE *yyvs1 = yyvs; 02266 yytype_int16 *yyss1 = yyss; 02267 02268 /* Each stack pointer address is followed by the size of the 02269 data in use in that stack, in bytes. This used to be a 02270 conditional around just the two extra args, but that might 02271 be undefined if yyoverflow is a macro. */ 02272 yyoverflow (YY_("memory exhausted"), 02273 &yyss1, yysize * sizeof (*yyssp), 02274 &yyvs1, yysize * sizeof (*yyvsp), 02275 &yystacksize); 02276 02277 yyss = yyss1; 02278 yyvs = yyvs1; 02279 } 02280 #else /* no yyoverflow */ 02281 # ifndef YYSTACK_RELOCATE 02282 goto yyexhaustedlab; 02283 # else 02284 /* Extend the stack our own way. */ 02285 if (YYMAXDEPTH <= yystacksize) 02286 goto yyexhaustedlab; 02287 yystacksize *= 2; 02288 if (YYMAXDEPTH < yystacksize) 02289 yystacksize = YYMAXDEPTH; 02290 02291 { 02292 yytype_int16 *yyss1 = yyss; 02293 union yyalloc *yyptr = 02294 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 02295 if (! yyptr) 02296 goto yyexhaustedlab; 02297 YYSTACK_RELOCATE (yyss_alloc, yyss); 02298 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 02299 # undef YYSTACK_RELOCATE 02300 if (yyss1 != yyssa) 02301 YYSTACK_FREE (yyss1); 02302 } 02303 # endif 02304 #endif /* no yyoverflow */ 02305 02306 yyssp = yyss + yysize - 1; 02307 yyvsp = yyvs + yysize - 1; 02308 02309 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 02310 (unsigned long int) yystacksize)); 02311 02312 if (yyss + yystacksize - 1 <= yyssp) 02313 YYABORT; 02314 } 02315 02316 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 02317 02318 if (yystate == YYFINAL) 02319 YYACCEPT; 02320 02321 goto yybackup; 02322 02323 /*-----------. 02324 | yybackup. | 02325 `-----------*/ 02326 yybackup: 02327 02328 /* Do appropriate processing given the current state. Read a 02329 lookahead token if we need one and don't already have one. */ 02330 02331 /* First try to decide what to do without reference to lookahead token. */ 02332 yyn = yypact[yystate]; 02333 if (yypact_value_is_default (yyn)) 02334 goto yydefault; 02335 02336 /* Not known => get a lookahead token if don't already have one. */ 02337 02338 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 02339 if (yychar == YYEMPTY) 02340 { 02341 YYDPRINTF ((stderr, "Reading a token: ")); 02342 yychar = YYLEX; 02343 } 02344 02345 if (yychar <= YYEOF) 02346 { 02347 yychar = yytoken = YYEOF; 02348 YYDPRINTF ((stderr, "Now at end of input.\n")); 02349 } 02350 else 02351 { 02352 yytoken = YYTRANSLATE (yychar); 02353 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 02354 } 02355 02356 /* If the proper action on seeing token YYTOKEN is to reduce or to 02357 detect an error, take that action. */ 02358 yyn += yytoken; 02359 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 02360 goto yydefault; 02361 yyn = yytable[yyn]; 02362 if (yyn <= 0) 02363 { 02364 if (yytable_value_is_error (yyn)) 02365 goto yyerrlab; 02366 yyn = -yyn; 02367 goto yyreduce; 02368 } 02369 02370 /* Count tokens shifted since error; after three, turn off error 02371 status. */ 02372 if (yyerrstatus) 02373 yyerrstatus--; 02374 02375 /* Shift the lookahead token. */ 02376 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 02377 02378 /* Discard the shifted token. */ 02379 yychar = YYEMPTY; 02380 02381 yystate = yyn; 02382 *++yyvsp = yylval; 02383 02384 goto yynewstate; 02385 02386 02387 /*-----------------------------------------------------------. 02388 | yydefault -- do the default action for the current state. | 02389 `-----------------------------------------------------------*/ 02390 yydefault: 02391 yyn = yydefact[yystate]; 02392 if (yyn == 0) 02393 goto yyerrlab; 02394 goto yyreduce; 02395 02396 02397 /*-----------------------------. 02398 | yyreduce -- Do a reduction. | 02399 `-----------------------------*/ 02400 yyreduce: 02401 /* yyn is the number of a rule to reduce with. */ 02402 yylen = yyr2[yyn]; 02403 02404 /* If YYLEN is nonzero, implement the default value of the action: 02405 `$$ = $1'. 02406 02407 Otherwise, the following line sets YYVAL to garbage. 02408 This behavior is undocumented and Bison 02409 users should not rely upon it. Assigning to YYVAL 02410 unconditionally makes the parser a bit smaller, and it avoids a 02411 GCC warning that YYVAL may be used uninitialized. */ 02412 yyval = yyvsp[1-yylen]; 02413 02414 02415 YY_REDUCE_PRINT (yyn); 02416 switch (yyn) 02417 { 02418 case 2: 02419 02420 /* Line 1806 of yacc.c */ 02421 #line 228 "parser.y" 02422 { CLAN_debug("rule scop_list.1: scop"); } 02423 break; 02424 02425 case 3: 02426 02427 /* Line 1806 of yacc.c */ 02428 #line 229 "parser.y" 02429 { CLAN_debug("rule scop_list.2: scop_list scop"); } 02430 break; 02431 02432 case 4: 02433 02434 /* Line 1806 of yacc.c */ 02435 #line 230 "parser.y" 02436 { CLAN_debug("rule scop_list.3: scop_list IGNORE"); } 02437 break; 02438 02439 case 5: 02440 02441 /* Line 1806 of yacc.c */ 02442 #line 231 "parser.y" 02443 { CLAN_debug("rule scop_list.4: IGNORE"); } 02444 break; 02445 02446 case 6: 02447 02448 /* Line 1806 of yacc.c */ 02449 #line 238 "parser.y" 02450 { 02451 int nb_parameters; 02452 osl_scop_p scop; 02453 osl_generic_p arrays; 02454 02455 CLAN_debug("rule scop.1: statement_list IGNORE"); 02456 scop = osl_scop_malloc(); 02457 CLAN_strdup(scop->language, "C"); 02458 02459 // Build the SCoP context. 02460 nb_parameters = clan_symbol_nb_of_type(parser_symbol, 02461 CLAN_TYPE_PARAMETER); 02462 scop->parameters = clan_symbol_to_strings(parser_symbol, 02463 CLAN_TYPE_PARAMETER); 02464 scop->context = clan_relation_build_context(nb_parameters, 02465 parser_options); 02466 02467 // Set the statements. 02468 scop->statement = (yyvsp[(1) - (2)].stmt); 02469 02470 // Compact the SCoP relations. 02471 if (CLAN_DEBUG) { 02472 CLAN_debug("SCoP before compaction:"); 02473 osl_scop_dump(stderr, scop); 02474 } 02475 clan_scop_compact(scop); 02476 if (CLAN_DEBUG) { 02477 CLAN_debug("SCoP after compaction:"); 02478 osl_scop_dump(stderr, scop); 02479 } 02480 02481 // Simplify the SCoP iteration domains. 02482 if (!parser_options->nosimplify) 02483 clan_scop_simplify(scop); 02484 02485 // Add extensions. 02486 scop->registry = osl_interface_get_default_registry(); 02487 clan_scop_generate_scatnames(scop); 02488 arrays = clan_symbol_to_arrays(parser_symbol); 02489 osl_generic_add(&scop->extension, arrays); 02490 clan_scop_generate_coordinates(scop, parser_options->name); 02491 clan_scop_generate_clay(scop, scanner_clay); 02492 02493 // Add the SCoP to parser_scop and prepare the state for the next SCoP. 02494 osl_scop_add(&parser_scop, scop); 02495 clan_symbol_free(parser_symbol); 02496 clan_parser_state_initialize(parser_options); 02497 CLAN_debug_call(osl_scop_dump(stderr, scop)); 02498 } 02499 break; 02500 02501 case 7: 02502 02503 /* Line 1806 of yacc.c */ 02504 #line 293 "parser.y" 02505 { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); } 02506 break; 02507 02508 case 8: 02509 02510 /* Line 1806 of yacc.c */ 02511 #line 295 "parser.y" 02512 { (yyval.stmt) = (yyvsp[(1) - (2)].stmt); osl_statement_add(&(yyval.stmt), (yyvsp[(2) - (2)].stmt)); } 02513 break; 02514 02515 case 9: 02516 02517 /* Line 1806 of yacc.c */ 02518 #line 302 "parser.y" 02519 { 02520 if (parser_indent == CLAN_UNDEFINED) 02521 parser_indent = scanner_column_LALR - 1; 02522 } 02523 break; 02524 02525 case 10: 02526 02527 /* Line 1806 of yacc.c */ 02528 #line 307 "parser.y" 02529 { 02530 (yyval.stmt) = (yyvsp[(2) - (2)].stmt); 02531 } 02532 break; 02533 02534 case 11: 02535 02536 /* Line 1806 of yacc.c */ 02537 #line 316 "parser.y" 02538 { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); } 02539 break; 02540 02541 case 12: 02542 02543 /* Line 1806 of yacc.c */ 02544 #line 317 "parser.y" 02545 { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); } 02546 break; 02547 02548 case 13: 02549 02550 /* Line 1806 of yacc.c */ 02551 #line 318 "parser.y" 02552 { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); } 02553 break; 02554 02555 case 14: 02556 02557 /* Line 1806 of yacc.c */ 02558 #line 319 "parser.y" 02559 { 02560 if (parser_options->autoscop && !parser_autoscop && !parser_loop_depth) { 02561 parser_line_start = scanner_line; 02562 parser_column_start = scanner_column_LALR; 02563 parser_autoscop = CLAN_TRUE; 02564 // Reinitialize the symbol table. 02565 clan_symbol_free(parser_symbol); 02566 parser_symbol = NULL; 02567 if (CLAN_DEBUG) 02568 fprintf(stderr, "Autoscop start: line %3d column %3d\n", 02569 parser_line_start, parser_column_start); 02570 } 02571 } 02572 break; 02573 02574 case 15: 02575 02576 /* Line 1806 of yacc.c */ 02577 #line 333 "parser.y" 02578 { 02579 (yyval.stmt) = (yyvsp[(2) - (2)].stmt); 02580 if (parser_options->autoscop && parser_autoscop && !parser_loop_depth) { 02581 parser_line_end = scanner_line; 02582 parser_column_end = scanner_column; 02583 if (CLAN_DEBUG) 02584 fprintf(stderr, "Autoscop found: line %3d column %3d\n", 02585 parser_line_end, parser_column_end); 02586 } 02587 } 02588 break; 02589 02590 case 16: 02591 02592 /* Line 1806 of yacc.c */ 02593 #line 349 "parser.y" 02594 { (yyval.stmt) = NULL; } 02595 break; 02596 02597 case 17: 02598 02599 /* Line 1806 of yacc.c */ 02600 #line 350 "parser.y" 02601 { (yyval.stmt) = (yyvsp[(2) - (3)].stmt); } 02602 break; 02603 02604 case 18: 02605 02606 /* Line 1806 of yacc.c */ 02607 #line 361 "parser.y" 02608 { 02609 if (!parser_valid_else[parser_if_depth]) { 02610 yyerror("unsupported negation of a condition involving a modulo"); 02611 YYABORT; 02612 } 02613 } 02614 break; 02615 02616 case 19: 02617 02618 /* Line 1806 of yacc.c */ 02619 #line 368 "parser.y" 02620 { 02621 CLAN_debug("rule selection_else_statement.1: else <stmt>"); 02622 (yyval.stmt) = (yyvsp[(3) - (3)].stmt); 02623 CLAN_debug_call(osl_statement_dump(stderr, (yyval.stmt))); 02624 } 02625 break; 02626 02627 case 20: 02628 02629 /* Line 1806 of yacc.c */ 02630 #line 374 "parser.y" 02631 { 02632 CLAN_debug("rule selection_else_statement.2: <void>"); 02633 (yyval.stmt) = NULL; 02634 } 02635 break; 02636 02637 case 21: 02638 02639 /* Line 1806 of yacc.c */ 02640 #line 383 "parser.y" 02641 { 02642 CLAN_debug("rule selection_statement.1.1: if ( condition ) ..."); 02643 osl_relation_list_dup(&parser_stack); 02644 clan_relation_and(parser_stack->elt, (yyvsp[(3) - (4)].setex)); 02645 parser_if_depth++; 02646 if ((parser_loop_depth + parser_if_depth) > CLAN_MAX_DEPTH) 02647 CLAN_error("CLAN_MAX_DEPTH reached, recompile with a higher value"); 02648 } 02649 break; 02650 02651 case 22: 02652 02653 /* Line 1806 of yacc.c */ 02654 #line 392 "parser.y" 02655 { 02656 osl_relation_p not_if; 02657 02658 CLAN_debug("rule selection_statement.1.2: if ( condition ) <stmt> ..."); 02659 osl_relation_list_drop(&parser_stack); 02660 osl_relation_list_dup(&parser_stack); 02661 if (!clan_relation_existential((yyvsp[(3) - (6)].setex))) { 02662 not_if = clan_relation_not((yyvsp[(3) - (6)].setex)); 02663 clan_relation_and(parser_stack->elt, not_if); 02664 osl_relation_free(not_if); 02665 parser_valid_else[parser_if_depth] = 1; 02666 } else { 02667 parser_valid_else[parser_if_depth] = 0; 02668 } 02669 osl_relation_free((yyvsp[(3) - (6)].setex)); 02670 } 02671 break; 02672 02673 case 23: 02674 02675 /* Line 1806 of yacc.c */ 02676 #line 409 "parser.y" 02677 { 02678 CLAN_debug("rule selection_statement.1.3: if ( condition ) <stmt>" 02679 "[else <stmt>]"); 02680 osl_relation_list_drop(&parser_stack); 02681 (yyval.stmt) = (yyvsp[(6) - (8)].stmt); 02682 osl_statement_add(&(yyval.stmt), (yyvsp[(8) - (8)].stmt)); 02683 parser_if_depth--; 02684 parser_nb_local_dims[parser_loop_depth + parser_if_depth] = 0; 02685 CLAN_debug_call(osl_statement_dump(stderr, (yyval.stmt))); 02686 } 02687 break; 02688 02689 case 24: 02690 02691 /* Line 1806 of yacc.c */ 02692 #line 424 "parser.y" 02693 { 02694 osl_vector_p iterator_term; 02695 osl_relation_p iterator_relation; 02696 osl_relation_p init_constraints; 02697 osl_relation_p stride_constraints; 02698 02699 CLAN_debug("rule iteration_statement.1.1: for ( init cond stride ) ..."); 02700 clan_parser_increment_loop_depth(); 02701 02702 // Check the stride and the initialization are correct. 02703 if (((yyvsp[(5) - (6)].value) == 0) || 02704 (((yyvsp[(5) - (6)].value) > 0) && (parser_min || parser_floord)) || 02705 (((yyvsp[(5) - (6)].value) < 0) && (parser_max || parser_ceild))) { 02706 osl_relation_free((yyvsp[(3) - (6)].setex)); 02707 osl_relation_free((yyvsp[(4) - (6)].setex)); 02708 if ((yyvsp[(5) - (6)].value) == 0) 02709 yyerror("unsupported zero loop stride"); 02710 else if ((yyvsp[(5) - (6)].value) > 0) 02711 yyerror("illegal min or floord in forward loop initialization"); 02712 else 02713 yyerror("illegal max or ceild in backward loop initialization"); 02714 YYABORT; 02715 } 02716 parser_ceild = 0; 02717 parser_floord = 0; 02718 parser_min = 0; 02719 parser_max = 0; 02720 02721 // Generate the set of constraints contributed by the initialization. 02722 iterator_term = clan_vector_term(parser_symbol, 0, NULL, 02723 parser_options->precision); 02724 osl_int_set_si(parser_options->precision, 02725 &iterator_term->v[parser_loop_depth], 1); 02726 iterator_relation = osl_relation_from_vector(iterator_term); 02727 if ((yyvsp[(5) - (6)].value) > 0) 02728 init_constraints = clan_relation_greater(iterator_relation, (yyvsp[(3) - (6)].setex), 0); 02729 else 02730 init_constraints = clan_relation_greater((yyvsp[(3) - (6)].setex), iterator_relation, 0); 02731 osl_vector_free(iterator_term); 02732 osl_relation_free(iterator_relation); 02733 02734 // Add the contribution of the initialization to the current domain. 02735 osl_relation_list_dup(&parser_stack); 02736 clan_relation_and(parser_stack->elt, init_constraints); 02737 02738 // Add the contribution of the condition to the current domain. 02739 if (!parser_options->noloopcontext) 02740 clan_relation_loop_context((yyvsp[(4) - (6)].setex), init_constraints, parser_loop_depth); 02741 clan_relation_and(parser_stack->elt, (yyvsp[(4) - (6)].setex)); 02742 02743 // Add the contribution of the stride to the current domain. 02744 if (((yyvsp[(5) - (6)].value) != 1) && ((yyvsp[(5) - (6)].value) != -1)) { 02745 stride_constraints = clan_relation_stride(parser_stack->elt, 02746 parser_loop_depth, (yyvsp[(5) - (6)].value)); 02747 osl_relation_free(parser_stack->elt); 02748 parser_stack->elt = stride_constraints; 02749 } 02750 02751 osl_relation_free(init_constraints); 02752 osl_relation_free((yyvsp[(3) - (6)].setex)); 02753 osl_relation_free((yyvsp[(4) - (6)].setex)); 02754 parser_scattering[2*parser_loop_depth-1] = ((yyvsp[(5) - (6)].value) > 0) ? 1 : -1; 02755 parser_scattering[2*parser_loop_depth] = 0; 02756 } 02757 break; 02758 02759 case 25: 02760 02761 /* Line 1806 of yacc.c */ 02762 #line 489 "parser.y" 02763 { 02764 CLAN_debug("rule iteration_statement.1.2: for ( init cond stride ) " 02765 "body"); 02766 (yyval.stmt) = (yyvsp[(8) - (8)].stmt); 02767 CLAN_debug_call(osl_statement_dump(stderr, (yyval.stmt))); 02768 } 02769 break; 02770 02771 case 26: 02772 02773 /* Line 1806 of yacc.c */ 02774 #line 496 "parser.y" 02775 { 02776 osl_vector_p iterator_term; 02777 osl_relation_p iterator_relation; 02778 02779 CLAN_debug("rule iteration_statement.2.1: loop_infinite ..."); 02780 if (!clan_symbol_new_iterator(&parser_symbol, parser_iterators, 02781 "clan_infinite_loop", parser_loop_depth)) 02782 YYABORT; 02783 02784 clan_parser_increment_loop_depth(); 02785 02786 // Generate the constraint clan_infinite_loop >= 0. 02787 iterator_term = clan_vector_term(parser_symbol, 0, NULL, 02788 parser_options->precision); 02789 osl_int_set_si(parser_options->precision, 02790 &iterator_term->v[parser_loop_depth], 1); 02791 osl_int_set_si(parser_options->precision, &iterator_term->v[0], 1); 02792 iterator_relation = osl_relation_from_vector(iterator_term); 02793 02794 // Add it to the domain stack. 02795 osl_relation_list_dup(&parser_stack); 02796 clan_relation_and(parser_stack->elt, iterator_relation); 02797 osl_vector_free(iterator_term); 02798 osl_relation_free(iterator_relation); 02799 parser_scattering[2*parser_loop_depth-1] = 1; 02800 parser_scattering[2*parser_loop_depth] = 0; 02801 } 02802 break; 02803 02804 case 27: 02805 02806 /* Line 1806 of yacc.c */ 02807 #line 524 "parser.y" 02808 { 02809 CLAN_debug("rule iteration_statement.2.2: loop_infinite body"); 02810 (yyval.stmt) = (yyvsp[(3) - (3)].stmt); 02811 CLAN_debug_call(osl_statement_dump(stderr, (yyval.stmt))); 02812 } 02813 break; 02814 02815 case 28: 02816 02817 /* Line 1806 of yacc.c */ 02818 #line 534 "parser.y" 02819 { 02820 if (!clan_symbol_new_iterator(&parser_symbol, parser_iterators, (yyvsp[(2) - (2)].symbol), 02821 parser_loop_depth)) 02822 YYABORT; 02823 } 02824 break; 02825 02826 case 29: 02827 02828 /* Line 1806 of yacc.c */ 02829 #line 540 "parser.y" 02830 { 02831 CLAN_debug("rule lower_bound.1: ID = max_affex ;"); 02832 free((yyvsp[(2) - (6)].symbol)); 02833 (yyval.setex) = (yyvsp[(5) - (6)].setex); 02834 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 02835 } 02836 break; 02837 02838 case 32: 02839 02840 /* Line 1806 of yacc.c */ 02841 #line 557 "parser.y" 02842 { 02843 CLAN_debug("rule upper_bound.1: <affex> ;"); 02844 (yyval.setex) = (yyvsp[(1) - (2)].setex); 02845 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 02846 } 02847 break; 02848 02849 case 33: 02850 02851 /* Line 1806 of yacc.c */ 02852 #line 573 "parser.y" 02853 { (yyval.value) = 1; free((yyvsp[(1) - (2)].symbol)); } 02854 break; 02855 02856 case 34: 02857 02858 /* Line 1806 of yacc.c */ 02859 #line 574 "parser.y" 02860 { (yyval.value) = -1; free((yyvsp[(1) - (2)].symbol)); } 02861 break; 02862 02863 case 35: 02864 02865 /* Line 1806 of yacc.c */ 02866 #line 575 "parser.y" 02867 { (yyval.value) = 1; free((yyvsp[(2) - (2)].symbol)); } 02868 break; 02869 02870 case 36: 02871 02872 /* Line 1806 of yacc.c */ 02873 #line 576 "parser.y" 02874 { (yyval.value) = -1; free((yyvsp[(2) - (2)].symbol)); } 02875 break; 02876 02877 case 37: 02878 02879 /* Line 1806 of yacc.c */ 02880 #line 577 "parser.y" 02881 { (yyval.value) = (yyvsp[(5) - (5)].value); free((yyvsp[(1) - (5)].symbol)); free((yyvsp[(3) - (5)].symbol)); } 02882 break; 02883 02884 case 38: 02885 02886 /* Line 1806 of yacc.c */ 02887 #line 578 "parser.y" 02888 { (yyval.value) = -(yyvsp[(5) - (5)].value); free((yyvsp[(1) - (5)].symbol)); free((yyvsp[(3) - (5)].symbol)); } 02889 break; 02890 02891 case 39: 02892 02893 /* Line 1806 of yacc.c */ 02894 #line 579 "parser.y" 02895 { (yyval.value) = (yyvsp[(3) - (3)].value); free((yyvsp[(1) - (3)].symbol)); } 02896 break; 02897 02898 case 40: 02899 02900 /* Line 1806 of yacc.c */ 02901 #line 580 "parser.y" 02902 { (yyval.value) = -(yyvsp[(3) - (3)].value); free((yyvsp[(1) - (3)].symbol)); } 02903 break; 02904 02905 case 41: 02906 02907 /* Line 1806 of yacc.c */ 02908 #line 584 "parser.y" 02909 { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); } 02910 break; 02911 02912 case 42: 02913 02914 /* Line 1806 of yacc.c */ 02915 #line 586 "parser.y" 02916 { (yyval.symbol) = (yyvsp[(2) - (3)].symbol); } 02917 break; 02918 02919 case 45: 02920 02921 /* Line 1806 of yacc.c */ 02922 #line 597 "parser.y" 02923 { 02924 CLAN_debug("rule loop_body.1: <stmt>"); 02925 parser_loop_depth--; 02926 clan_symbol_free(parser_iterators[parser_loop_depth]); 02927 osl_relation_list_drop(&parser_stack); 02928 (yyval.stmt) = (yyvsp[(1) - (1)].stmt); 02929 parser_scattering[2*parser_loop_depth]++; 02930 parser_nb_local_dims[parser_loop_depth + parser_if_depth] = 0; 02931 CLAN_debug_call(osl_statement_dump(stderr, (yyval.stmt))); 02932 } 02933 break; 02934 02935 case 46: 02936 02937 /* Line 1806 of yacc.c */ 02938 #line 617 "parser.y" 02939 { 02940 CLAN_debug("rule affine_minmax_expression.1: <affex>"); 02941 (yyval.setex) = osl_relation_from_vector((yyvsp[(1) - (1)].affex)); 02942 osl_vector_free((yyvsp[(1) - (1)].affex)); 02943 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 02944 } 02945 break; 02946 02947 case 47: 02948 02949 /* Line 1806 of yacc.c */ 02950 #line 624 "parser.y" 02951 { 02952 CLAN_debug("rule affine_minmax_expression.2: " 02953 "MAX (affine_minmaxexpression , affine_minmax_expression )"); 02954 (yyval.setex) = osl_relation_concat_constraints((yyvsp[(3) - (6)].setex), (yyvsp[(5) - (6)].setex)); 02955 osl_relation_free((yyvsp[(3) - (6)].setex)); 02956 osl_relation_free((yyvsp[(5) - (6)].setex)); 02957 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 02958 } 02959 break; 02960 02961 case 48: 02962 02963 /* Line 1806 of yacc.c */ 02964 #line 636 "parser.y" 02965 { parser_min = 1; } 02966 break; 02967 02968 case 49: 02969 02970 /* Line 1806 of yacc.c */ 02971 #line 637 "parser.y" 02972 { parser_max = 1; } 02973 break; 02974 02975 case 50: 02976 02977 /* Line 1806 of yacc.c */ 02978 #line 650 "parser.y" 02979 { 02980 CLAN_debug("rule affine_min_expression.1: <affex>"); 02981 (yyval.setex) = osl_relation_from_vector((yyvsp[(1) - (1)].affex)); 02982 osl_vector_free((yyvsp[(1) - (1)].affex)); 02983 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 02984 } 02985 break; 02986 02987 case 51: 02988 02989 /* Line 1806 of yacc.c */ 02990 #line 660 "parser.y" 02991 { 02992 CLAN_debug("rule affine_min_expression.2: " 02993 "MIN ( affine_min_expression , affine_min_expresssion"); 02994 (yyval.setex) = osl_relation_concat_constraints((yyvsp[(3) - (6)].setex), (yyvsp[(5) - (6)].setex)); 02995 osl_relation_free((yyvsp[(3) - (6)].setex)); 02996 osl_relation_free((yyvsp[(5) - (6)].setex)); 02997 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 02998 } 02999 break; 03000 03001 case 52: 03002 03003 /* Line 1806 of yacc.c */ 03004 #line 680 "parser.y" 03005 { 03006 CLAN_debug("rule affine_max_expression.1: <affex>"); 03007 (yyval.setex) = osl_relation_from_vector((yyvsp[(1) - (1)].affex)); 03008 osl_vector_free((yyvsp[(1) - (1)].affex)); 03009 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03010 } 03011 break; 03012 03013 case 53: 03014 03015 /* Line 1806 of yacc.c */ 03016 #line 690 "parser.y" 03017 { 03018 CLAN_debug("rule affine_max_expression.2: " 03019 "MAX ( affine_max_expression , affine_max_expression )"); 03020 (yyval.setex) = osl_relation_concat_constraints((yyvsp[(3) - (6)].setex), (yyvsp[(5) - (6)].setex)); 03021 osl_relation_free((yyvsp[(3) - (6)].setex)); 03022 osl_relation_free((yyvsp[(5) - (6)].setex)); 03023 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03024 } 03025 break; 03026 03027 case 54: 03028 03029 /* Line 1806 of yacc.c */ 03030 #line 713 "parser.y" 03031 { 03032 CLAN_debug("rule affine_relation.1: max_affex < min_affex"); 03033 (yyval.setex) = clan_relation_greater((yyvsp[(3) - (3)].setex), (yyvsp[(1) - (3)].setex), 1); 03034 osl_relation_free((yyvsp[(1) - (3)].setex)); 03035 osl_relation_free((yyvsp[(3) - (3)].setex)); 03036 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03037 } 03038 break; 03039 03040 case 55: 03041 03042 /* Line 1806 of yacc.c */ 03043 #line 724 "parser.y" 03044 { 03045 CLAN_debug("rule affine_relation.2: min_affex > max_affex"); 03046 (yyval.setex) = clan_relation_greater((yyvsp[(1) - (3)].setex), (yyvsp[(3) - (3)].setex), 1); 03047 osl_relation_free((yyvsp[(1) - (3)].setex)); 03048 osl_relation_free((yyvsp[(3) - (3)].setex)); 03049 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03050 } 03051 break; 03052 03053 case 56: 03054 03055 /* Line 1806 of yacc.c */ 03056 #line 735 "parser.y" 03057 { 03058 CLAN_debug("rule affine_relation.3: max_affex <= min_affex"); 03059 (yyval.setex) = clan_relation_greater((yyvsp[(3) - (3)].setex), (yyvsp[(1) - (3)].setex), 0); 03060 osl_relation_free((yyvsp[(1) - (3)].setex)); 03061 osl_relation_free((yyvsp[(3) - (3)].setex)); 03062 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03063 } 03064 break; 03065 03066 case 57: 03067 03068 /* Line 1806 of yacc.c */ 03069 #line 746 "parser.y" 03070 { 03071 CLAN_debug("rule affine_relation.4: min_affex >= max_affex"); 03072 (yyval.setex) = clan_relation_greater((yyvsp[(1) - (3)].setex), (yyvsp[(3) - (3)].setex), 0); 03073 osl_relation_free((yyvsp[(1) - (3)].setex)); 03074 osl_relation_free((yyvsp[(3) - (3)].setex)); 03075 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03076 } 03077 break; 03078 03079 case 58: 03080 03081 /* Line 1806 of yacc.c */ 03082 #line 757 "parser.y" 03083 { 03084 // a==b translates to a-b==0. 03085 osl_vector_p res; 03086 03087 CLAN_debug("rule affine_relation.5: <affex> == <affex>"); 03088 // Warning: cases like ceild(M,32) == ceild(N,32) are not handled. 03089 // Assert if we encounter such a case. 03090 assert ((osl_int_zero(parser_options->precision, (yyvsp[(1) - (3)].affex)->v[0]) || 03091 osl_int_one(parser_options->precision, (yyvsp[(1) - (3)].affex)->v[0])) && 03092 (osl_int_zero(parser_options->precision, (yyvsp[(3) - (3)].affex)->v[0]) || 03093 osl_int_one(parser_options->precision, (yyvsp[(3) - (3)].affex)->v[0]))); 03094 res = osl_vector_sub((yyvsp[(1) - (3)].affex), (yyvsp[(3) - (3)].affex)); 03095 osl_vector_tag_equality(res); 03096 (yyval.setex) = osl_relation_from_vector(res); 03097 osl_vector_free(res); 03098 osl_vector_free((yyvsp[(1) - (3)].affex)); 03099 osl_vector_free((yyvsp[(3) - (3)].affex)); 03100 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03101 } 03102 break; 03103 03104 case 59: 03105 03106 /* Line 1806 of yacc.c */ 03107 #line 780 "parser.y" 03108 { 03109 CLAN_debug("rule affine_relation.6: ( condition )"); 03110 (yyval.setex) = (yyvsp[(2) - (3)].setex); 03111 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03112 } 03113 break; 03114 03115 case 60: 03116 03117 /* Line 1806 of yacc.c */ 03118 #line 789 "parser.y" 03119 { 03120 CLAN_debug("rule affine_relation.7: ! ( condition )"); 03121 if (clan_relation_existential((yyvsp[(3) - (4)].setex))) { 03122 osl_relation_free((yyvsp[(3) - (4)].setex)); 03123 yyerror("unsupported negation of a condition involving a modulo"); 03124 YYABORT; 03125 } 03126 (yyval.setex) = clan_relation_not((yyvsp[(3) - (4)].setex)); 03127 osl_relation_free((yyvsp[(3) - (4)].setex)); 03128 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03129 } 03130 break; 03131 03132 case 61: 03133 03134 /* Line 1806 of yacc.c */ 03135 #line 804 "parser.y" 03136 { 03137 CLAN_debug("rule affine_relation.8: " 03138 "affine_expression %% INTEGER == INTEGER"); 03139 osl_int_set_si(parser_options->precision, 03140 &((yyvsp[(1) - (5)].affex)->v[CLAN_MAX_DEPTH + 1 + clan_parser_nb_ld()]), -(yyvsp[(3) - (5)].value)); 03141 osl_int_add_si(parser_options->precision, 03142 &((yyvsp[(1) - (5)].affex)->v[(yyvsp[(1) - (5)].affex)->size - 1]), (yyvsp[(1) - (5)].affex)->v[(yyvsp[(1) - (5)].affex)->size - 1], -(yyvsp[(5) - (5)].value)); 03143 clan_parser_add_ld(); 03144 (yyval.setex) = osl_relation_from_vector((yyvsp[(1) - (5)].affex)); 03145 osl_vector_free((yyvsp[(1) - (5)].affex)); 03146 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03147 } 03148 break; 03149 03150 case 62: 03151 03152 /* Line 1806 of yacc.c */ 03153 #line 821 "parser.y" 03154 { 03155 CLAN_debug("rule affine_logical_and_expression.1: affine_relation"); 03156 (yyval.setex) = (yyvsp[(1) - (1)].setex); 03157 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03158 } 03159 break; 03160 03161 case 63: 03162 03163 /* Line 1806 of yacc.c */ 03164 #line 827 "parser.y" 03165 { 03166 CLAN_debug("rule affine_logical_and_expression.2: " 03167 "affine_logical_and_expression && affine_relation"); 03168 clan_relation_and((yyvsp[(1) - (3)].setex), (yyvsp[(3) - (3)].setex)); 03169 (yyval.setex) = (yyvsp[(1) - (3)].setex); 03170 osl_relation_free((yyvsp[(3) - (3)].setex)); 03171 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03172 } 03173 break; 03174 03175 case 64: 03176 03177 /* Line 1806 of yacc.c */ 03178 #line 840 "parser.y" 03179 { 03180 CLAN_debug("rule affine_condition.1: affine_logical_and_expression"); 03181 (yyval.setex) = (yyvsp[(1) - (1)].setex); 03182 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03183 } 03184 break; 03185 03186 case 65: 03187 03188 /* Line 1806 of yacc.c */ 03189 #line 846 "parser.y" 03190 { 03191 CLAN_debug("rule affine_condition.2: " 03192 "affine_condition || affine_logical_and_expression"); 03193 osl_relation_add(&(yyvsp[(1) - (3)].setex), (yyvsp[(3) - (3)].setex)); 03194 (yyval.setex) = (yyvsp[(1) - (3)].setex); 03195 CLAN_debug_call(osl_relation_dump(stderr, (yyval.setex))); 03196 } 03197 break; 03198 03199 case 66: 03200 03201 /* Line 1806 of yacc.c */ 03202 #line 858 "parser.y" 03203 { 03204 clan_symbol_p id; 03205 03206 CLAN_debug("rule affine_primary_expression.1: id"); 03207 id = clan_symbol_add(&parser_symbol, (yyvsp[(1) - (1)].symbol), CLAN_UNDEFINED); 03208 // An id in an affex can be either an iterator or a parameter. If it is 03209 // an unknown (embeds read-only variables), it is updated to a parameter. 03210 if (id->type == CLAN_UNDEFINED) { 03211 if ((parser_nb_parameters + 1) > CLAN_MAX_PARAMETERS) 03212 CLAN_error("CLAN_MAX_PARAMETERS reached," 03213 "recompile with a higher value"); 03214 id->type = CLAN_TYPE_PARAMETER; 03215 id->rank = ++parser_nb_parameters; 03216 } 03217 03218 if ((id->type != CLAN_TYPE_ITERATOR) && 03219 (id->type != CLAN_TYPE_PARAMETER)) { 03220 free((yyvsp[(1) - (1)].symbol)); 03221 if (id->type == CLAN_TYPE_ARRAY) 03222 yyerror("variable or array reference in an affine expression"); 03223 else 03224 yyerror("function call in an affine expression"); 03225 YYABORT; 03226 } 03227 03228 (yyval.affex) = clan_vector_term(parser_symbol, 1, (yyvsp[(1) - (1)].symbol), parser_options->precision); 03229 free((yyvsp[(1) - (1)].symbol)); 03230 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03231 } 03232 break; 03233 03234 case 67: 03235 03236 /* Line 1806 of yacc.c */ 03237 #line 888 "parser.y" 03238 { 03239 CLAN_debug("rule affine_primary_expression.2: INTEGER"); 03240 (yyval.affex) = clan_vector_term(parser_symbol, (yyvsp[(1) - (1)].value), NULL, parser_options->precision); 03241 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03242 } 03243 break; 03244 03245 case 68: 03246 03247 /* Line 1806 of yacc.c */ 03248 #line 894 "parser.y" 03249 { 03250 CLAN_debug("rule affine_primary_expression.3: " 03251 "affine_additive_expression"); 03252 (yyval.affex) = (yyvsp[(2) - (3)].affex); 03253 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03254 } 03255 break; 03256 03257 case 69: 03258 03259 /* Line 1806 of yacc.c */ 03260 #line 905 "parser.y" 03261 { 03262 CLAN_debug("rule affine_unary_expression.1: affine_primary_expression"); 03263 (yyval.affex) = (yyvsp[(1) - (1)].affex); 03264 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03265 } 03266 break; 03267 03268 case 70: 03269 03270 /* Line 1806 of yacc.c */ 03271 #line 911 "parser.y" 03272 { 03273 CLAN_debug("rule affine_unary_expression.2: +affine_primary_expression"); 03274 (yyval.affex) = (yyvsp[(2) - (2)].affex); 03275 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03276 } 03277 break; 03278 03279 case 71: 03280 03281 /* Line 1806 of yacc.c */ 03282 #line 917 "parser.y" 03283 { 03284 CLAN_debug("rule affine_unary_expression.2: -affine_primary_expression"); 03285 (yyval.affex) = osl_vector_mul_scalar((yyvsp[(2) - (2)].affex), -1); 03286 osl_vector_free((yyvsp[(2) - (2)].affex)); 03287 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03288 } 03289 break; 03290 03291 case 72: 03292 03293 /* Line 1806 of yacc.c */ 03294 #line 928 "parser.y" 03295 { 03296 CLAN_debug("rule affine_multiplicative_expression.1: " 03297 "affine_unary_expression"); 03298 (yyval.affex) = (yyvsp[(1) - (1)].affex); 03299 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03300 } 03301 break; 03302 03303 case 73: 03304 03305 /* Line 1806 of yacc.c */ 03306 #line 935 "parser.y" 03307 { 03308 int coef; 03309 03310 CLAN_debug("rule affine_multiplicative_expression.2: " 03311 "affine_multiplicative_expression * affine_unary_expression"); 03312 if (!osl_vector_is_scalar((yyvsp[(1) - (3)].affex)) && !osl_vector_is_scalar((yyvsp[(3) - (3)].affex))) { 03313 osl_vector_free((yyvsp[(1) - (3)].affex)); 03314 osl_vector_free((yyvsp[(3) - (3)].affex)); 03315 yyerror("non-affine expression"); 03316 YYABORT; 03317 } 03318 03319 if (osl_vector_is_scalar((yyvsp[(1) - (3)].affex))) { 03320 coef = osl_int_get_si((yyvsp[(1) - (3)].affex)->precision, (yyvsp[(1) - (3)].affex)->v[(yyvsp[(1) - (3)].affex)->size - 1]); 03321 (yyval.affex) = osl_vector_mul_scalar((yyvsp[(3) - (3)].affex), coef); 03322 } else { 03323 coef = osl_int_get_si((yyvsp[(3) - (3)].affex)->precision, (yyvsp[(3) - (3)].affex)->v[(yyvsp[(3) - (3)].affex)->size - 1]); 03324 (yyval.affex) = osl_vector_mul_scalar((yyvsp[(1) - (3)].affex), coef); 03325 } 03326 osl_vector_free((yyvsp[(1) - (3)].affex)); 03327 osl_vector_free((yyvsp[(3) - (3)].affex)); 03328 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03329 } 03330 break; 03331 03332 case 74: 03333 03334 /* Line 1806 of yacc.c */ 03335 #line 959 "parser.y" 03336 { 03337 int val1, val2; 03338 03339 CLAN_debug("rule affine_multiplicative_expression.3: " 03340 "affine_multiplicative_expression / affine_unary_expression"); 03341 if (!osl_vector_is_scalar((yyvsp[(1) - (3)].affex)) || !osl_vector_is_scalar((yyvsp[(3) - (3)].affex))) { 03342 osl_vector_free((yyvsp[(1) - (3)].affex)); 03343 osl_vector_free((yyvsp[(3) - (3)].affex)); 03344 yyerror("non-affine expression"); 03345 YYABORT; 03346 } 03347 val1 = osl_int_get_si((yyvsp[(1) - (3)].affex)->precision, (yyvsp[(1) - (3)].affex)->v[(yyvsp[(1) - (3)].affex)->size - 1]); 03348 val2 = osl_int_get_si((yyvsp[(3) - (3)].affex)->precision, (yyvsp[(3) - (3)].affex)->v[(yyvsp[(3) - (3)].affex)->size - 1]); 03349 (yyval.affex) = clan_vector_term(parser_symbol, val1 / val2, NULL, 03350 parser_options->precision); 03351 osl_vector_free((yyvsp[(1) - (3)].affex)); 03352 osl_vector_free((yyvsp[(3) - (3)].affex)); 03353 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03354 } 03355 break; 03356 03357 case 75: 03358 03359 /* Line 1806 of yacc.c */ 03360 #line 983 "parser.y" 03361 { 03362 CLAN_debug("rule affine_expression.1: " 03363 "affine_multiplicative_expression"); 03364 (yyval.affex) = (yyvsp[(1) - (1)].affex); 03365 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03366 } 03367 break; 03368 03369 case 76: 03370 03371 /* Line 1806 of yacc.c */ 03372 #line 990 "parser.y" 03373 { 03374 CLAN_debug("rule affine_expression.2: " 03375 "affine_expression + affine_multiplicative_expression"); 03376 (yyval.affex) = osl_vector_add((yyvsp[(1) - (3)].affex), (yyvsp[(3) - (3)].affex)); 03377 osl_vector_free((yyvsp[(1) - (3)].affex)); 03378 osl_vector_free((yyvsp[(3) - (3)].affex)); 03379 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03380 } 03381 break; 03382 03383 case 77: 03384 03385 /* Line 1806 of yacc.c */ 03386 #line 999 "parser.y" 03387 { 03388 CLAN_debug("rule affine_expression.3: " 03389 "affine_expression - affine_multiplicative_expression"); 03390 (yyval.affex) = osl_vector_sub((yyvsp[(1) - (3)].affex), (yyvsp[(3) - (3)].affex)); 03391 osl_vector_free((yyvsp[(1) - (3)].affex)); 03392 osl_vector_free((yyvsp[(3) - (3)].affex)); 03393 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03394 } 03395 break; 03396 03397 case 78: 03398 03399 /* Line 1806 of yacc.c */ 03400 #line 1012 "parser.y" 03401 { 03402 CLAN_debug("affine_ceildloord_expression.1: affine_expression"); 03403 (yyval.affex) = (yyvsp[(1) - (1)].affex); 03404 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03405 } 03406 break; 03407 03408 case 79: 03409 03410 /* Line 1806 of yacc.c */ 03411 #line 1018 "parser.y" 03412 { 03413 CLAN_debug("affine_ceildfloord_expression.2: " 03414 "ceildfloord ( affine_expression , INTEGER )"); 03415 osl_int_set_si(parser_options->precision, &((yyvsp[(3) - (6)].affex)->v[0]), (yyvsp[(5) - (6)].value)); 03416 (yyval.affex) = (yyvsp[(3) - (6)].affex); 03417 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03418 } 03419 break; 03420 03421 case 80: 03422 03423 /* Line 1806 of yacc.c */ 03424 #line 1029 "parser.y" 03425 { parser_ceild = 1; } 03426 break; 03427 03428 case 81: 03429 03430 /* Line 1806 of yacc.c */ 03431 #line 1030 "parser.y" 03432 { parser_floord = 1; } 03433 break; 03434 03435 case 82: 03436 03437 /* Line 1806 of yacc.c */ 03438 #line 1036 "parser.y" 03439 { 03440 CLAN_debug("affine_ceil_expression.1: affine_expression"); 03441 (yyval.affex) = (yyvsp[(1) - (1)].affex); 03442 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03443 } 03444 break; 03445 03446 case 83: 03447 03448 /* Line 1806 of yacc.c */ 03449 #line 1042 "parser.y" 03450 { 03451 CLAN_debug("affine_ceil_expression.2: " 03452 "CEILD ( affine_expression , INTEGER )"); 03453 osl_int_set_si(parser_options->precision, &((yyvsp[(3) - (6)].affex)->v[0]), (yyvsp[(5) - (6)].value)); 03454 (yyval.affex) = (yyvsp[(3) - (6)].affex); 03455 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03456 } 03457 break; 03458 03459 case 84: 03460 03461 /* Line 1806 of yacc.c */ 03462 #line 1054 "parser.y" 03463 { 03464 CLAN_debug("affine_floor_expression.1: affine_expression"); 03465 (yyval.affex) = (yyvsp[(1) - (1)].affex); 03466 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03467 } 03468 break; 03469 03470 case 85: 03471 03472 /* Line 1806 of yacc.c */ 03473 #line 1060 "parser.y" 03474 { 03475 CLAN_debug("affine_floor_expression.2: " 03476 "FLOORD ( affine_expression , INTEGER )"); 03477 osl_int_set_si(parser_options->precision, &((yyvsp[(3) - (6)].affex)->v[0]), (yyvsp[(5) - (6)].value)); 03478 (yyval.affex) = (yyvsp[(3) - (6)].affex); 03479 CLAN_debug_call(osl_vector_dump(stderr, (yyval.affex))); 03480 } 03481 break; 03482 03483 case 86: 03484 03485 /* Line 1806 of yacc.c */ 03486 #line 1077 "parser.y" 03487 { 03488 int nb_columns; 03489 osl_relation_p id; 03490 osl_relation_list_p list; 03491 clan_symbol_p symbol; 03492 03493 CLAN_debug("rule primary_expression.1: ID"); 03494 symbol = clan_symbol_add(&parser_symbol, (yyvsp[(1) - (1)].symbol), CLAN_UNDEFINED); 03495 nb_columns = CLAN_MAX_DEPTH + CLAN_MAX_LOCAL_DIMS + 03496 CLAN_MAX_PARAMETERS + 2; 03497 id = osl_relation_pmalloc(parser_options->precision, 0, nb_columns); 03498 osl_relation_set_attributes(id, 0, parser_loop_depth, 0, 03499 CLAN_MAX_PARAMETERS); 03500 clan_relation_tag_array(id, symbol->key); 03501 list = osl_relation_list_malloc(); 03502 list->elt = id; 03503 03504 // add the id to the extbody 03505 if (parser_options->extbody) { 03506 if (parser_access_start != -1) { 03507 osl_extbody_add(parser_access_extbody, 03508 parser_access_start, 03509 parser_access_length); 03510 } 03511 03512 int len = strlen(parser_record); 03513 parser_access_start = len - strlen((yyvsp[(1) - (1)].symbol)); 03514 parser_access_length = len - parser_access_start; 03515 } 03516 03517 free((yyvsp[(1) - (1)].symbol)); 03518 (yyval.list) = list; 03519 CLAN_debug_call(osl_relation_list_dump(stderr, (yyval.list))); 03520 } 03521 break; 03522 03523 case 87: 03524 03525 /* Line 1806 of yacc.c */ 03526 #line 1112 "parser.y" 03527 { (yyval.list) = NULL; } 03528 break; 03529 03530 case 88: 03531 03532 /* Line 1806 of yacc.c */ 03533 #line 1114 "parser.y" 03534 { (yyval.list) = NULL; } 03535 break; 03536 03537 case 89: 03538 03539 /* Line 1806 of yacc.c */ 03540 #line 1116 "parser.y" 03541 { (yyval.list) = NULL; } 03542 break; 03543 03544 case 90: 03545 03546 /* Line 1806 of yacc.c */ 03547 #line 1118 "parser.y" 03548 { (yyval.list) = (yyvsp[(2) - (3)].list); } 03549 break; 03550 03551 case 91: 03552 03553 /* Line 1806 of yacc.c */ 03554 #line 1124 "parser.y" 03555 { (yyval.list) = (yyvsp[(1) - (1)].list); } 03556 break; 03557 03558 case 92: 03559 03560 /* Line 1806 of yacc.c */ 03561 #line 1126 "parser.y" 03562 { 03563 if (parser_options->extbody) 03564 parser_access_length = strlen(parser_record) - parser_access_start; 03565 03566 CLAN_debug("rule postfix_expression.2: postfix_expression [ <affex> ]"); 03567 if (!clan_symbol_update_type(parser_symbol, (yyvsp[(1) - (4)].list), CLAN_TYPE_ARRAY)) 03568 YYABORT; 03569 clan_relation_new_output_vector((yyvsp[(1) - (4)].list)->elt, (yyvsp[(3) - (4)].affex)); 03570 osl_vector_free((yyvsp[(3) - (4)].affex)); 03571 (yyval.list) = (yyvsp[(1) - (4)].list); 03572 CLAN_debug_call(osl_relation_list_dump(stderr, (yyval.list))); 03573 } 03574 break; 03575 03576 case 93: 03577 03578 /* Line 1806 of yacc.c */ 03579 #line 1139 "parser.y" 03580 { 03581 // don't save access name of a function 03582 if (parser_options->extbody) { 03583 parser_access_extbody->nb_access -= osl_relation_list_count((yyvsp[(1) - (3)].list)) - 1; 03584 parser_access_start = -1; 03585 } 03586 03587 if (!clan_symbol_update_type(parser_symbol, (yyvsp[(1) - (3)].list), CLAN_TYPE_FUNCTION)) 03588 YYABORT; 03589 osl_relation_list_free((yyvsp[(1) - (3)].list)); 03590 (yyval.list) = NULL; 03591 } 03592 break; 03593 03594 case 94: 03595 03596 /* Line 1806 of yacc.c */ 03597 #line 1152 "parser.y" 03598 { 03599 // don't save access name of a function 03600 if (parser_options->extbody) { 03601 parser_access_extbody->nb_access -= osl_relation_list_count((yyvsp[(1) - (2)].list)) - 1; 03602 parser_access_start = -1; 03603 } 03604 } 03605 break; 03606 03607 case 95: 03608 03609 /* Line 1806 of yacc.c */ 03610 #line 1160 "parser.y" 03611 { 03612 if (!clan_symbol_update_type(parser_symbol, (yyvsp[(1) - (5)].list), CLAN_TYPE_FUNCTION)) 03613 YYABORT; 03614 osl_relation_list_free((yyvsp[(1) - (5)].list)); 03615 (yyval.list) = (yyvsp[(4) - (5)].list); 03616 } 03617 break; 03618 03619 case 96: 03620 03621 /* Line 1806 of yacc.c */ 03622 #line 1167 "parser.y" 03623 { 03624 if (parser_options->extbody) 03625 parser_access_length = strlen(parser_record) - parser_access_start; 03626 03627 clan_symbol_p symbol; 03628 03629 CLAN_debug("rule postfix_expression.4: postfix_expression . ID"); 03630 if (!clan_symbol_update_type(parser_symbol, (yyvsp[(1) - (3)].list), CLAN_TYPE_ARRAY)) 03631 YYABORT; 03632 symbol = clan_symbol_add(&parser_symbol, (yyvsp[(3) - (3)].symbol), CLAN_TYPE_FIELD); 03633 clan_relation_new_output_scalar((yyvsp[(1) - (3)].list)->elt, symbol->key); 03634 free((yyvsp[(3) - (3)].symbol)); 03635 (yyval.list) = (yyvsp[(1) - (3)].list); 03636 CLAN_debug_call(osl_relation_list_dump(stderr, (yyval.list))); 03637 } 03638 break; 03639 03640 case 97: 03641 03642 /* Line 1806 of yacc.c */ 03643 #line 1183 "parser.y" 03644 { 03645 if (parser_options->extbody) 03646 parser_access_length = strlen(parser_record) - parser_access_start; 03647 03648 clan_symbol_p symbol; 03649 03650 CLAN_debug("rule postfix_expression.5: postfix_expression -> ID"); 03651 if (!clan_symbol_update_type(parser_symbol, (yyvsp[(1) - (3)].list), CLAN_TYPE_ARRAY)) 03652 YYABORT; 03653 symbol = clan_symbol_add(&parser_symbol, (yyvsp[(3) - (3)].symbol), CLAN_TYPE_FIELD); 03654 clan_relation_new_output_scalar((yyvsp[(1) - (3)].list)->elt, symbol->key); 03655 free((yyvsp[(3) - (3)].symbol)); 03656 (yyval.list) = (yyvsp[(1) - (3)].list); 03657 CLAN_debug_call(osl_relation_list_dump(stderr, (yyval.list))); 03658 } 03659 break; 03660 03661 case 98: 03662 03663 /* Line 1806 of yacc.c */ 03664 #line 1199 "parser.y" 03665 { 03666 osl_relation_list_p list; 03667 03668 CLAN_debug("rule postfix_expression.6: postfix_expression -> " 03669 "postfix_expression ++/--"); 03670 if (!clan_symbol_update_type(parser_symbol, (yyvsp[(1) - (2)].list), CLAN_TYPE_ARRAY)) 03671 YYABORT; 03672 list = (yyvsp[(1) - (2)].list); 03673 // The last reference in the list is also written. 03674 if (list != NULL) { 03675 while (list->next != NULL) 03676 list = list->next; 03677 list->next = osl_relation_list_node(list->elt); 03678 list->next->elt->type = OSL_TYPE_WRITE; 03679 } 03680 (yyval.list) = (yyvsp[(1) - (2)].list); 03681 CLAN_debug_call(osl_relation_list_dump(stderr, (yyval.list))); 03682 03683 // add an empty line in the extbody 03684 if (parser_options->extbody) { 03685 osl_extbody_add(parser_access_extbody, -1, -1); 03686 } 03687 } 03688 break; 03689 03690 case 99: 03691 03692 /* Line 1806 of yacc.c */ 03693 #line 1226 "parser.y" 03694 { (yyval.list) = (yyvsp[(1) - (1)].list); } 03695 break; 03696 03697 case 100: 03698 03699 /* Line 1806 of yacc.c */ 03700 #line 1228 "parser.y" 03701 { 03702 (yyval.list) = (yyvsp[(1) - (3)].list); 03703 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03704 } 03705 break; 03706 03707 case 101: 03708 03709 /* Line 1806 of yacc.c */ 03710 #line 1236 "parser.y" 03711 { (yyval.list) = (yyvsp[(1) - (1)].list); } 03712 break; 03713 03714 case 102: 03715 03716 /* Line 1806 of yacc.c */ 03717 #line 1238 "parser.y" 03718 { 03719 osl_relation_list_p list; 03720 03721 CLAN_debug("rule unary_expression.2: unary_expression -> " 03722 "++/-- unary_expression"); 03723 if (!clan_symbol_update_type(parser_symbol, (yyvsp[(2) - (2)].list), CLAN_TYPE_ARRAY)) 03724 YYABORT; 03725 list = (yyvsp[(2) - (2)].list); 03726 // The last reference in the list is also written. 03727 if (list != NULL) { 03728 while (list->next != NULL) 03729 list = list->next; 03730 list->next = osl_relation_list_node(list->elt); 03731 list->next->elt->type = OSL_TYPE_WRITE; 03732 } 03733 (yyval.list) = (yyvsp[(2) - (2)].list); 03734 CLAN_debug_call(osl_relation_list_dump(stderr, (yyval.list))); 03735 03736 // add an empty line in the extbody 03737 if (parser_options->extbody) { 03738 osl_extbody_add(parser_access_extbody, -1, -1); 03739 } 03740 } 03741 break; 03742 03743 case 103: 03744 03745 /* Line 1806 of yacc.c */ 03746 #line 1262 "parser.y" 03747 { (yyval.list) = (yyvsp[(2) - (2)].list); } 03748 break; 03749 03750 case 104: 03751 03752 /* Line 1806 of yacc.c */ 03753 #line 1264 "parser.y" 03754 { (yyval.list) = (yyvsp[(2) - (2)].list); } 03755 break; 03756 03757 case 105: 03758 03759 /* Line 1806 of yacc.c */ 03760 #line 1266 "parser.y" 03761 { (yyval.list) = NULL; } 03762 break; 03763 03764 case 114: 03765 03766 /* Line 1806 of yacc.c */ 03767 #line 1285 "parser.y" 03768 { (yyval.list) = (yyvsp[(1) - (1)].list); } 03769 break; 03770 03771 case 115: 03772 03773 /* Line 1806 of yacc.c */ 03774 #line 1287 "parser.y" 03775 { (yyval.list) = (yyvsp[(4) - (4)].list); } 03776 break; 03777 03778 case 116: 03779 03780 /* Line 1806 of yacc.c */ 03781 #line 1292 "parser.y" 03782 { (yyval.list) = (yyvsp[(1) - (1)].list); } 03783 break; 03784 03785 case 117: 03786 03787 /* Line 1806 of yacc.c */ 03788 #line 1294 "parser.y" 03789 { 03790 (yyval.list) = (yyvsp[(1) - (3)].list); 03791 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03792 } 03793 break; 03794 03795 case 118: 03796 03797 /* Line 1806 of yacc.c */ 03798 #line 1299 "parser.y" 03799 { 03800 (yyval.list) = (yyvsp[(1) - (3)].list); 03801 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03802 } 03803 break; 03804 03805 case 119: 03806 03807 /* Line 1806 of yacc.c */ 03808 #line 1304 "parser.y" 03809 { 03810 (yyval.list) = (yyvsp[(1) - (3)].list); 03811 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03812 } 03813 break; 03814 03815 case 120: 03816 03817 /* Line 1806 of yacc.c */ 03818 #line 1312 "parser.y" 03819 { (yyval.list) = (yyvsp[(1) - (1)].list); } 03820 break; 03821 03822 case 121: 03823 03824 /* Line 1806 of yacc.c */ 03825 #line 1314 "parser.y" 03826 { 03827 (yyval.list) = (yyvsp[(1) - (3)].list); 03828 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03829 } 03830 break; 03831 03832 case 122: 03833 03834 /* Line 1806 of yacc.c */ 03835 #line 1319 "parser.y" 03836 { 03837 (yyval.list) = (yyvsp[(1) - (3)].list); 03838 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03839 } 03840 break; 03841 03842 case 123: 03843 03844 /* Line 1806 of yacc.c */ 03845 #line 1327 "parser.y" 03846 { (yyval.list) = (yyvsp[(1) - (1)].list); } 03847 break; 03848 03849 case 124: 03850 03851 /* Line 1806 of yacc.c */ 03852 #line 1329 "parser.y" 03853 { 03854 (yyval.list) = (yyvsp[(1) - (3)].list); 03855 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03856 } 03857 break; 03858 03859 case 125: 03860 03861 /* Line 1806 of yacc.c */ 03862 #line 1334 "parser.y" 03863 { 03864 (yyval.list) = (yyvsp[(1) - (3)].list); 03865 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03866 } 03867 break; 03868 03869 case 126: 03870 03871 /* Line 1806 of yacc.c */ 03872 #line 1342 "parser.y" 03873 { (yyval.list) = (yyvsp[(1) - (1)].list); } 03874 break; 03875 03876 case 127: 03877 03878 /* Line 1806 of yacc.c */ 03879 #line 1344 "parser.y" 03880 { 03881 (yyval.list) = (yyvsp[(1) - (3)].list); 03882 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03883 } 03884 break; 03885 03886 case 128: 03887 03888 /* Line 1806 of yacc.c */ 03889 #line 1349 "parser.y" 03890 { 03891 (yyval.list) = (yyvsp[(1) - (3)].list); 03892 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03893 } 03894 break; 03895 03896 case 129: 03897 03898 /* Line 1806 of yacc.c */ 03899 #line 1354 "parser.y" 03900 { 03901 (yyval.list) = (yyvsp[(1) - (3)].list); 03902 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03903 } 03904 break; 03905 03906 case 130: 03907 03908 /* Line 1806 of yacc.c */ 03909 #line 1359 "parser.y" 03910 { 03911 (yyval.list) = (yyvsp[(1) - (3)].list); 03912 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03913 } 03914 break; 03915 03916 case 131: 03917 03918 /* Line 1806 of yacc.c */ 03919 #line 1367 "parser.y" 03920 { (yyval.list) = (yyvsp[(1) - (1)].list); } 03921 break; 03922 03923 case 132: 03924 03925 /* Line 1806 of yacc.c */ 03926 #line 1369 "parser.y" 03927 { 03928 (yyval.list) = (yyvsp[(1) - (3)].list); 03929 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03930 } 03931 break; 03932 03933 case 133: 03934 03935 /* Line 1806 of yacc.c */ 03936 #line 1374 "parser.y" 03937 { 03938 (yyval.list) = (yyvsp[(1) - (3)].list); 03939 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03940 } 03941 break; 03942 03943 case 134: 03944 03945 /* Line 1806 of yacc.c */ 03946 #line 1382 "parser.y" 03947 { (yyval.list) = (yyvsp[(1) - (1)].list); } 03948 break; 03949 03950 case 135: 03951 03952 /* Line 1806 of yacc.c */ 03953 #line 1384 "parser.y" 03954 { 03955 (yyval.list) = (yyvsp[(1) - (3)].list); 03956 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03957 } 03958 break; 03959 03960 case 136: 03961 03962 /* Line 1806 of yacc.c */ 03963 #line 1392 "parser.y" 03964 { (yyval.list) = (yyvsp[(1) - (1)].list); } 03965 break; 03966 03967 case 137: 03968 03969 /* Line 1806 of yacc.c */ 03970 #line 1394 "parser.y" 03971 { 03972 (yyval.list) = (yyvsp[(1) - (3)].list); 03973 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03974 } 03975 break; 03976 03977 case 138: 03978 03979 /* Line 1806 of yacc.c */ 03980 #line 1402 "parser.y" 03981 { (yyval.list) = (yyvsp[(1) - (1)].list); } 03982 break; 03983 03984 case 139: 03985 03986 /* Line 1806 of yacc.c */ 03987 #line 1404 "parser.y" 03988 { 03989 (yyval.list) = (yyvsp[(1) - (3)].list); 03990 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 03991 } 03992 break; 03993 03994 case 140: 03995 03996 /* Line 1806 of yacc.c */ 03997 #line 1412 "parser.y" 03998 { (yyval.list) = (yyvsp[(1) - (1)].list); } 03999 break; 04000 04001 case 141: 04002 04003 /* Line 1806 of yacc.c */ 04004 #line 1414 "parser.y" 04005 { 04006 (yyval.list) = (yyvsp[(1) - (3)].list); 04007 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 04008 } 04009 break; 04010 04011 case 142: 04012 04013 /* Line 1806 of yacc.c */ 04014 #line 1422 "parser.y" 04015 { (yyval.list) = (yyvsp[(1) - (1)].list); } 04016 break; 04017 04018 case 143: 04019 04020 /* Line 1806 of yacc.c */ 04021 #line 1424 "parser.y" 04022 { 04023 (yyval.list) = (yyvsp[(1) - (3)].list); 04024 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 04025 } 04026 break; 04027 04028 case 144: 04029 04030 /* Line 1806 of yacc.c */ 04031 #line 1432 "parser.y" 04032 { (yyval.list) = (yyvsp[(1) - (1)].list); } 04033 break; 04034 04035 case 145: 04036 04037 /* Line 1806 of yacc.c */ 04038 #line 1434 "parser.y" 04039 { 04040 (yyval.list) = (yyvsp[(1) - (5)].list); 04041 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (5)].list)); 04042 osl_relation_list_add(&(yyval.list), (yyvsp[(5) - (5)].list)); 04043 } 04044 break; 04045 04046 case 146: 04047 04048 /* Line 1806 of yacc.c */ 04049 #line 1443 "parser.y" 04050 { 04051 CLAN_debug("rule assignment_expression.1: conditional_expression;"); 04052 (yyval.list) = (yyvsp[(1) - (1)].list); 04053 clan_relation_list_define_type((yyval.list), OSL_TYPE_READ); 04054 CLAN_debug_call(osl_relation_list_dump(stderr, (yyval.list))); 04055 } 04056 break; 04057 04058 case 147: 04059 04060 /* Line 1806 of yacc.c */ 04061 #line 1450 "parser.y" 04062 { 04063 osl_relation_list_p list; 04064 04065 CLAN_debug("rule assignment_expression.2: unary_expression " 04066 "assignment_operator assignment_expression;"); 04067 if (!clan_symbol_update_type(parser_symbol, (yyvsp[(1) - (3)].list), CLAN_TYPE_ARRAY)) 04068 YYABORT; 04069 (yyval.list) = (yyvsp[(1) - (3)].list); 04070 // Accesses of $1 are READ except the last one which is a WRITE or both. 04071 clan_relation_list_define_type((yyval.list), OSL_TYPE_READ); 04072 list = (yyval.list); 04073 while (list->next != NULL) 04074 list = list->next; 04075 if ((yyvsp[(2) - (3)].value) == CLAN_TYPE_RDWR) { 04076 list->next = osl_relation_list_node(list->elt); 04077 list = list->next; 04078 04079 // add an empty line in the extbody 04080 if (parser_options->extbody) { 04081 osl_extbody_add(parser_access_extbody, -1, -1); 04082 } 04083 } 04084 osl_relation_set_type(list->elt, OSL_TYPE_WRITE); 04085 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 04086 CLAN_debug_call(osl_relation_list_dump(stderr, (yyval.list))); 04087 } 04088 break; 04089 04090 case 148: 04091 04092 /* Line 1806 of yacc.c */ 04093 #line 1480 "parser.y" 04094 { (yyval.value) = CLAN_TYPE_WRITE; } 04095 break; 04096 04097 case 149: 04098 04099 /* Line 1806 of yacc.c */ 04100 #line 1482 "parser.y" 04101 { (yyval.value) = CLAN_TYPE_RDWR; } 04102 break; 04103 04104 case 160: 04105 04106 /* Line 1806 of yacc.c */ 04107 #line 1500 "parser.y" 04108 { (yyval.list) = (yyvsp[(1) - (1)].list); } 04109 break; 04110 04111 case 161: 04112 04113 /* Line 1806 of yacc.c */ 04114 #line 1502 "parser.y" 04115 { 04116 (yyval.list) = (yyvsp[(1) - (3)].list); 04117 osl_relation_list_add(&(yyval.list), (yyvsp[(3) - (3)].list)); 04118 } 04119 break; 04120 04121 case 162: 04122 04123 /* Line 1806 of yacc.c */ 04124 #line 1510 "parser.y" 04125 { 04126 CLAN_debug("rule expression_statement.1: ;"); 04127 (yyval.stmt) = NULL; 04128 CLAN_debug_call(osl_statement_dump(stderr, (yyval.stmt))); 04129 } 04130 break; 04131 04132 case 163: 04133 04134 /* Line 1806 of yacc.c */ 04135 #line 1516 "parser.y" 04136 { 04137 if (parser_options->extbody) { 04138 parser_access_start = -1; 04139 parser_access_extbody = osl_extbody_malloc(); 04140 } 04141 04142 CLAN_strdup(parser_record, scanner_latest_text); 04143 parser_recording = CLAN_TRUE; 04144 } 04145 break; 04146 04147 case 164: 04148 04149 /* Line 1806 of yacc.c */ 04150 #line 1526 "parser.y" 04151 { 04152 osl_statement_p statement; 04153 osl_body_p body; 04154 osl_generic_p gen; 04155 04156 CLAN_debug("rule expression_statement.2: expression ;"); 04157 statement = osl_statement_malloc(); 04158 04159 // - 1. Domain 04160 statement->domain = osl_relation_clone(parser_stack->elt); 04161 osl_relation_set_type(statement->domain, OSL_TYPE_DOMAIN); 04162 osl_relation_set_attributes(statement->domain, parser_loop_depth, 0, 04163 clan_parser_nb_ld(), CLAN_MAX_PARAMETERS); 04164 04165 // - 2. Scattering 04166 statement->scattering = clan_relation_scattering(parser_scattering, 04167 parser_loop_depth, parser_options->precision); 04168 04169 // - 3. Array accesses 04170 statement->access = (yyvsp[(2) - (3)].list); 04171 04172 // - 4. Body. 04173 body = osl_body_malloc(); 04174 body->iterators = clan_symbol_array_to_strings(parser_iterators, 04175 parser_loop_depth); 04176 body->expression = osl_strings_encapsulate(parser_record); 04177 gen = osl_generic_shell(body, osl_body_interface()); 04178 osl_generic_add(&statement->extension, gen); 04179 04180 if (parser_options->extbody) { 04181 // Extended body 04182 04183 // add the last access 04184 if (parser_access_start != -1) { 04185 osl_extbody_add(parser_access_extbody, 04186 parser_access_start, 04187 parser_access_length); 04188 } 04189 04190 parser_access_extbody->body = osl_body_clone(body); 04191 gen = osl_generic_shell(parser_access_extbody, osl_extbody_interface()); 04192 osl_generic_add(&statement->extension, gen); 04193 } 04194 04195 parser_recording = CLAN_FALSE; 04196 parser_record = NULL; 04197 04198 parser_scattering[2*parser_loop_depth]++; 04199 04200 (yyval.stmt) = statement; 04201 CLAN_debug_call(osl_statement_dump(stderr, (yyval.stmt))); 04202 } 04203 break; 04204 04205 case 189: 04206 04207 /* Line 1806 of yacc.c */ 04208 #line 1623 "parser.y" 04209 { free((yyvsp[(2) - (5)].symbol)); } 04210 break; 04211 04212 case 191: 04213 04214 /* Line 1806 of yacc.c */ 04215 #line 1625 "parser.y" 04216 { free((yyvsp[(2) - (2)].symbol)); } 04217 break; 04218 04219 case 207: 04220 04221 /* Line 1806 of yacc.c */ 04222 #line 1662 "parser.y" 04223 { free((yyvsp[(2) - (5)].symbol)); } 04224 break; 04225 04226 case 208: 04227 04228 /* Line 1806 of yacc.c */ 04229 #line 1663 "parser.y" 04230 { free((yyvsp[(2) - (2)].symbol)); } 04231 break; 04232 04233 case 211: 04234 04235 /* Line 1806 of yacc.c */ 04236 #line 1672 "parser.y" 04237 { free((yyvsp[(1) - (1)].symbol)); } 04238 break; 04239 04240 case 212: 04241 04242 /* Line 1806 of yacc.c */ 04243 #line 1673 "parser.y" 04244 { free((yyvsp[(1) - (3)].symbol)); } 04245 break; 04246 04247 case 217: 04248 04249 /* Line 1806 of yacc.c */ 04250 #line 1687 "parser.y" 04251 { free((yyvsp[(1) - (1)].symbol)); } 04252 break; 04253 04254 case 237: 04255 04256 /* Line 1806 of yacc.c */ 04257 #line 1726 "parser.y" 04258 { free((yyvsp[(1) - (1)].symbol)); } 04259 break; 04260 04261 case 238: 04262 04263 /* Line 1806 of yacc.c */ 04264 #line 1727 "parser.y" 04265 { free((yyvsp[(3) - (3)].symbol)); } 04266 break; 04267 04268 04269 04270 /* Line 1806 of yacc.c */ 04271 #line 4272 "source/parser.c" 04272 default: break; 04273 } 04274 /* User semantic actions sometimes alter yychar, and that requires 04275 that yytoken be updated with the new translation. We take the 04276 approach of translating immediately before every use of yytoken. 04277 One alternative is translating here after every semantic action, 04278 but that translation would be missed if the semantic action invokes 04279 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 04280 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 04281 incorrect destructor might then be invoked immediately. In the 04282 case of YYERROR or YYBACKUP, subsequent parser actions might lead 04283 to an incorrect destructor call or verbose syntax error message 04284 before the lookahead is translated. */ 04285 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 04286 04287 YYPOPSTACK (yylen); 04288 yylen = 0; 04289 YY_STACK_PRINT (yyss, yyssp); 04290 04291 *++yyvsp = yyval; 04292 04293 /* Now `shift' the result of the reduction. Determine what state 04294 that goes to, based on the state we popped back to and the rule 04295 number reduced by. */ 04296 04297 yyn = yyr1[yyn]; 04298 04299 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 04300 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 04301 yystate = yytable[yystate]; 04302 else 04303 yystate = yydefgoto[yyn - YYNTOKENS]; 04304 04305 goto yynewstate; 04306 04307 04308 /*------------------------------------. 04309 | yyerrlab -- here on detecting error | 04310 `------------------------------------*/ 04311 yyerrlab: 04312 /* Make sure we have latest lookahead translation. See comments at 04313 user semantic actions for why this is necessary. */ 04314 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 04315 04316 /* If not already recovering from an error, report this error. */ 04317 if (!yyerrstatus) 04318 { 04319 ++yynerrs; 04320 #if ! YYERROR_VERBOSE 04321 yyerror (YY_("syntax error")); 04322 #else 04323 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 04324 yyssp, yytoken) 04325 { 04326 char const *yymsgp = YY_("syntax error"); 04327 int yysyntax_error_status; 04328 yysyntax_error_status = YYSYNTAX_ERROR; 04329 if (yysyntax_error_status == 0) 04330 yymsgp = yymsg; 04331 else if (yysyntax_error_status == 1) 04332 { 04333 if (yymsg != yymsgbuf) 04334 YYSTACK_FREE (yymsg); 04335 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 04336 if (!yymsg) 04337 { 04338 yymsg = yymsgbuf; 04339 yymsg_alloc = sizeof yymsgbuf; 04340 yysyntax_error_status = 2; 04341 } 04342 else 04343 { 04344 yysyntax_error_status = YYSYNTAX_ERROR; 04345 yymsgp = yymsg; 04346 } 04347 } 04348 yyerror (yymsgp); 04349 if (yysyntax_error_status == 2) 04350 goto yyexhaustedlab; 04351 } 04352 # undef YYSYNTAX_ERROR 04353 #endif 04354 } 04355 04356 04357 04358 if (yyerrstatus == 3) 04359 { 04360 /* If just tried and failed to reuse lookahead token after an 04361 error, discard it. */ 04362 04363 if (yychar <= YYEOF) 04364 { 04365 /* Return failure if at end of input. */ 04366 if (yychar == YYEOF) 04367 YYABORT; 04368 } 04369 else 04370 { 04371 yydestruct ("Error: discarding", 04372 yytoken, &yylval); 04373 yychar = YYEMPTY; 04374 } 04375 } 04376 04377 /* Else will try to reuse lookahead token after shifting the error 04378 token. */ 04379 goto yyerrlab1; 04380 04381 04382 /*---------------------------------------------------. 04383 | yyerrorlab -- error raised explicitly by YYERROR. | 04384 `---------------------------------------------------*/ 04385 yyerrorlab: 04386 04387 /* Pacify compilers like GCC when the user code never invokes 04388 YYERROR and the label yyerrorlab therefore never appears in user 04389 code. */ 04390 if (/*CONSTCOND*/ 0) 04391 goto yyerrorlab; 04392 04393 /* Do not reclaim the symbols of the rule which action triggered 04394 this YYERROR. */ 04395 YYPOPSTACK (yylen); 04396 yylen = 0; 04397 YY_STACK_PRINT (yyss, yyssp); 04398 yystate = *yyssp; 04399 goto yyerrlab1; 04400 04401 04402 /*-------------------------------------------------------------. 04403 | yyerrlab1 -- common code for both syntax error and YYERROR. | 04404 `-------------------------------------------------------------*/ 04405 yyerrlab1: 04406 yyerrstatus = 3; /* Each real token shifted decrements this. */ 04407 04408 for (;;) 04409 { 04410 yyn = yypact[yystate]; 04411 if (!yypact_value_is_default (yyn)) 04412 { 04413 yyn += YYTERROR; 04414 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 04415 { 04416 yyn = yytable[yyn]; 04417 if (0 < yyn) 04418 break; 04419 } 04420 } 04421 04422 /* Pop the current state because it cannot handle the error token. */ 04423 if (yyssp == yyss) 04424 YYABORT; 04425 04426 04427 yydestruct ("Error: popping", 04428 yystos[yystate], yyvsp); 04429 YYPOPSTACK (1); 04430 yystate = *yyssp; 04431 YY_STACK_PRINT (yyss, yyssp); 04432 } 04433 04434 *++yyvsp = yylval; 04435 04436 04437 /* Shift the error token. */ 04438 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 04439 04440 yystate = yyn; 04441 goto yynewstate; 04442 04443 04444 /*-------------------------------------. 04445 | yyacceptlab -- YYACCEPT comes here. | 04446 `-------------------------------------*/ 04447 yyacceptlab: 04448 yyresult = 0; 04449 goto yyreturn; 04450 04451 /*-----------------------------------. 04452 | yyabortlab -- YYABORT comes here. | 04453 `-----------------------------------*/ 04454 yyabortlab: 04455 yyresult = 1; 04456 goto yyreturn; 04457 04458 #if !defined(yyoverflow) || YYERROR_VERBOSE 04459 /*-------------------------------------------------. 04460 | yyexhaustedlab -- memory exhaustion comes here. | 04461 `-------------------------------------------------*/ 04462 yyexhaustedlab: 04463 yyerror (YY_("memory exhausted")); 04464 yyresult = 2; 04465 /* Fall through. */ 04466 #endif 04467 04468 yyreturn: 04469 if (yychar != YYEMPTY) 04470 { 04471 /* Make sure we have latest lookahead translation. See comments at 04472 user semantic actions for why this is necessary. */ 04473 yytoken = YYTRANSLATE (yychar); 04474 yydestruct ("Cleanup: discarding lookahead", 04475 yytoken, &yylval); 04476 } 04477 /* Do not reclaim the symbols of the rule which action triggered 04478 this YYABORT or YYACCEPT. */ 04479 YYPOPSTACK (yylen); 04480 YY_STACK_PRINT (yyss, yyssp); 04481 while (yyssp != yyss) 04482 { 04483 yydestruct ("Cleanup: popping", 04484 yystos[*yyssp], yyvsp); 04485 YYPOPSTACK (1); 04486 } 04487 #ifndef yyoverflow 04488 if (yyss != yyssa) 04489 YYSTACK_FREE (yyss); 04490 #endif 04491 #if YYERROR_VERBOSE 04492 if (yymsg != yymsgbuf) 04493 YYSTACK_FREE (yymsg); 04494 #endif 04495 /* Make sure YYID is used. */ 04496 return YYID (yyresult); 04497 } 04498 04499 04500 04501 /* Line 2067 of yacc.c */ 04502 #line 1753 "parser.y" 04503 04504 04505 04506 void yyerror(char *s) { 04507 int i, line = 1; 04508 char c = 'C'; 04509 FILE* file; 04510 04511 CLAN_debug("parse error notified"); 04512 04513 if (!parser_options->autoscop) { 04514 fprintf(stderr, "[Clan] Error: %s at line %d, column %d.\n", s, 04515 scanner_line, scanner_column - 1); 04516 04517 // Print a message to show where is the problem. 04518 if ((parser_options != NULL) && (parser_options->name != NULL)) { 04519 file = fopen(parser_options->name, "r"); 04520 if (file != NULL) { 04521 // Go to the right line. 04522 while (line != scanner_line) { 04523 c = fgetc(file); 04524 if (c == '\n') 04525 line++; 04526 } 04527 04528 // Print the line. 04529 while (c != EOF) { 04530 c = fgetc(file); 04531 fprintf(stderr, "%c", c); 04532 if (c == '\n') 04533 break; 04534 } 04535 04536 // Print the situation line. 04537 for (i = 0; i < scanner_column - 1; i++) { 04538 if (i < scanner_column - 5) 04539 fprintf(stderr, " "); 04540 else if (i < scanner_column - 2) 04541 fprintf(stderr, "~"); 04542 else 04543 fprintf(stderr, "^\n"); 04544 } 04545 fclose(file); 04546 } else { 04547 CLAN_warning("cannot open input file"); 04548 } 04549 } 04550 } 04551 parser_error = CLAN_TRUE; 04552 } 04553 04554 04555 void clan_parser_add_ld() { 04556 parser_nb_local_dims[parser_loop_depth + parser_if_depth]++; 04557 04558 if (CLAN_DEBUG) { 04559 int i; 04560 CLAN_debug("parser_nb_local_dims updated"); 04561 for (i = 0; i <= parser_loop_depth + parser_if_depth; i++) 04562 fprintf(stderr, "%d:%d ", i, parser_nb_local_dims[i]); 04563 fprintf(stderr, "\n"); 04564 } 04565 04566 if (clan_parser_nb_ld() > CLAN_MAX_LOCAL_DIMS) 04567 CLAN_error("CLAN_MAX_LOCAL_DIMS reached, recompile with a higher value"); 04568 } 04569 04570 04571 int clan_parser_nb_ld() { 04572 int i, nb_ld = 0; 04573 04574 for (i = 0; i <= parser_loop_depth + parser_if_depth; i++) 04575 nb_ld += parser_nb_local_dims[i]; 04576 return nb_ld; 04577 } 04578 04579 04580 void clan_parser_increment_loop_depth() { 04581 parser_loop_depth++; 04582 if ((parser_loop_depth + parser_if_depth) > CLAN_MAX_DEPTH) 04583 CLAN_error("CLAN_MAX_DEPTH reached, recompile with a higher value"); 04584 } 04585 04586 04592 void clan_parser_state_malloc(int precision) { 04593 int nb_columns, depth; 04594 04595 nb_columns = CLAN_MAX_DEPTH + CLAN_MAX_LOCAL_DIMS + 04596 CLAN_MAX_PARAMETERS + 2; 04597 depth = CLAN_MAX_DEPTH; 04598 parser_stack = osl_relation_list_malloc(); 04599 parser_stack->elt = osl_relation_pmalloc(precision, 0, nb_columns); 04600 CLAN_malloc(parser_nb_local_dims, int*, depth * sizeof(int)); 04601 CLAN_malloc(parser_valid_else, int*, depth * sizeof(int)); 04602 CLAN_malloc(parser_scattering, int*, (2 * depth + 1) * sizeof(int)); 04603 CLAN_malloc(parser_iterators, clan_symbol_p*, depth* sizeof(clan_symbol_p)); 04604 } 04605 04606 04612 void clan_parser_state_free() { 04613 clan_symbol_free(parser_symbol); 04614 free(parser_scattering); 04615 free(parser_iterators); 04616 free(parser_nb_local_dims); 04617 free(parser_valid_else); 04618 osl_relation_list_drop(&parser_stack); 04619 } 04620 04621 04627 void clan_parser_state_initialize(clan_options_p options) { 04628 int i; 04629 04630 parser_symbol = NULL; 04631 parser_loop_depth = 0; 04632 parser_options = options; 04633 parser_recording = CLAN_FALSE; 04634 parser_record = NULL; 04635 parser_if_depth = 0; 04636 parser_ceild = 0; 04637 parser_floord = 0; 04638 parser_min = 0; 04639 parser_max = 0; 04640 parser_indent = CLAN_UNDEFINED; 04641 parser_error = CLAN_FALSE; 04642 parser_autoscop = CLAN_FALSE; 04643 parser_line_start = 1; 04644 parser_line_end = 1; 04645 parser_column_start = 1; 04646 parser_column_end = 1; 04647 parser_nb_parameters = 0; 04648 04649 for (i = 0; i < CLAN_MAX_DEPTH; i++) { 04650 parser_nb_local_dims[i] = 0; 04651 parser_valid_else[i] = 0; 04652 } 04653 04654 for (i = 0; i < 2 * CLAN_MAX_DEPTH + 1; i++) 04655 parser_scattering[i] = 0; 04656 } 04657 04658 04665 void clan_parser_reinitialize() { 04666 int i; 04667 04668 free(parser_record); 04669 clan_symbol_free(parser_symbol); 04670 for (i = 0; i < parser_loop_depth; i++) 04671 clan_symbol_free(parser_iterators[i]); 04672 while (parser_stack->next != NULL) 04673 osl_relation_list_drop(&parser_stack); 04674 osl_scop_free(parser_scop); 04675 clan_parser_state_initialize(parser_options); 04676 } 04677 04678 04689 void clan_parser_autoscop() { 04690 int new_scop, nb_scops = 0; 04691 int line, column, restart_line, restart_column; 04692 long position; 04693 char c; 04694 int coordinates[5][CLAN_MAX_SCOPS]; // 0, 1: line start, end 04695 // 2, 3: column start, end 04696 // 4: autoscop or not 04697 04698 while (1) { 04699 // For the automatic extraction, we parse everything except user-SCoPs. 04700 if (!scanner_pragma) 04701 scanner_parsing = CLAN_TRUE; 04702 yyparse(); 04703 04704 new_scop = (parser_line_end != 1) || (parser_column_end != 1); 04705 restart_line = (new_scop) ? parser_line_end : scanner_line; 04706 restart_column = (new_scop) ? parser_column_end : scanner_column; 04707 if (CLAN_DEBUG) { 04708 if (new_scop) 04709 fprintf(stderr, "[Clan] Debug: new autoscop, "); 04710 else 04711 fprintf(stderr, "[Clan] Debug: no autoscop, "); 04712 fprintf(stderr, "restart at line %d, column %d\n", 04713 restart_line, restart_column); 04714 } 04715 04716 if (parser_error || new_scop) { 04717 if (new_scop) { 04718 // If a new SCoP has been found, store its coordinates. 04719 if (nb_scops == CLAN_MAX_SCOPS) 04720 CLAN_error("too many SCoPs! Change CLAN_MAX_SCOPS and recompile."); 04721 coordinates[0][nb_scops] = parser_line_start; 04722 coordinates[1][nb_scops] = parser_line_end; 04723 coordinates[2][nb_scops] = parser_column_start; 04724 coordinates[3][nb_scops] = parser_column_end; 04725 coordinates[4][nb_scops] = CLAN_TRUE; 04726 if (CLAN_DEBUG) { 04727 fprintf(stderr, "[Clan] Debug: AutoSCoP [%d,%d -> %d,%d]\n", 04728 coordinates[0][nb_scops], coordinates[2][nb_scops], 04729 coordinates[1][nb_scops], coordinates[3][nb_scops] - 1); 04730 } 04731 // Let's go for the next SCoP. 04732 parser_autoscop = CLAN_FALSE; 04733 nb_scops++; 04734 } else if (scanner_scop_start != CLAN_UNDEFINED) { 04735 // If the start of a user-SCoP is detected, store its coordinate. 04736 coordinates[0][nb_scops] = scanner_scop_start; 04737 } else if (scanner_scop_end != CLAN_UNDEFINED) { 04738 // If the end of a user-SCoP is detected, store its coordinate. 04739 coordinates[1][nb_scops] = scanner_scop_end; 04740 coordinates[2][nb_scops] = 0; 04741 coordinates[3][nb_scops] = 0; 04742 coordinates[4][nb_scops] = CLAN_FALSE; 04743 if (CLAN_DEBUG) { 04744 fprintf(stderr, "[Clan] Debug: user-SCoP [%d,%d -> %d,%d]\n", 04745 coordinates[0][nb_scops], coordinates[2][nb_scops], 04746 coordinates[1][nb_scops], coordinates[3][nb_scops]); 04747 } 04748 nb_scops++; 04749 } 04750 04751 // Restart after the SCoP or after the error. 04752 rewind(yyin); 04753 line = 1; 04754 column = 1; 04755 while ((line != restart_line) || (column != restart_column)) { 04756 c = fgetc(yyin); 04757 column++; 04758 if (c == '\n') { 04759 line++; 04760 column = 1; 04761 } 04762 } 04763 } 04764 04765 // Reinitialize the scanner and the parser for a clean restart. 04766 clan_scanner_free(); 04767 clan_scanner_reinitialize(scanner_pragma, restart_line, restart_column); 04768 clan_parser_reinitialize(); 04769 yyrestart(yyin); 04770 04771 // Check whether we reached the end of file or not. 04772 position = ftell(yyin); 04773 c = fgetc(yyin); 04774 if (fgetc(yyin) == EOF) 04775 break; 04776 else 04777 fseek(yyin, position, SEEK_SET); 04778 } 04779 04780 // Write the code with the inserted SCoP pragmas in CLAN_AUTOPRAGMA_FILE. 04781 rewind(yyin); 04782 clan_scop_print_autopragma(yyin, nb_scops, coordinates); 04783 04784 // Use the temporary file for usual parsing. 04785 scanner_line = 1; 04786 scanner_column = 1; 04787 scanner_pragma = CLAN_FALSE; 04788 parser_options->autoscop = CLAN_FALSE; 04789 if ((yyin = fopen(CLAN_AUTOPRAGMA_FILE, "r")) == NULL) 04790 CLAN_error("cannot create the temporary file"); 04791 yyparse(); 04792 fclose(yyin); 04793 04794 // Update the SCoP coordinates with those of the original file. 04795 clan_scop_update_coordinates(parser_scop, coordinates); 04796 parser_options->autoscop = CLAN_TRUE; 04797 04798 if (remove(CLAN_AUTOPRAGMA_FILE)) 04799 CLAN_warning("cannot delete temporary file"); 04800 } 04801 04802 04810 osl_scop_p clan_parse(FILE* input, clan_options_p options) { 04811 osl_scop_p scop; 04812 yyin = input; 04813 04814 clan_parser_state_malloc(options->precision); 04815 clan_parser_state_initialize(options); 04816 clan_scanner_initialize(); 04817 yyrestart(yyin); //restart scanning another file 04818 parser_scop = NULL; 04819 04820 if (!options->autoscop) 04821 yyparse(); 04822 else 04823 clan_parser_autoscop(); 04824 04825 CLAN_debug("parsing done"); 04826 04827 clan_scanner_free(); 04828 04829 if (!parser_error) 04830 scop = parser_scop; 04831 else 04832 scop = NULL; 04833 04834 clan_parser_state_free(); 04835 CLAN_debug("parser state successfully freed"); 04836 04837 return scop; 04838 } 04839