update isl for change in representation of isl_constraint
[ppcg.git] / clan / source / parser.c
blobef8955d76fc5c0d8975f09a745fa424847d8c0f9
1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
47 #define YYBISON 1
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
55 /* Pure parsers. */
56 #define YYPURE 0
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
63 /* Tokens. */
64 #ifndef YYTOKENTYPE
65 # define YYTOKENTYPE
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
67 know about them. */
68 enum yytokentype {
69 IGNORE = 258,
70 IF = 259,
71 ELSE = 260,
72 FOR = 261,
73 PRAGMALOCALVARS = 262,
74 PRAGMALIVEOUT = 263,
75 MIN = 264,
76 MAX = 265,
77 CEILD = 266,
78 FLOORD = 267,
79 REAL = 268,
80 ID = 269,
81 INTEGER = 270,
82 syRPARENTHESIS = 271,
83 syLPARENTHESIS = 272,
84 syRBRACKET = 273,
85 syLBRACKET = 274,
86 syRBRACE = 275,
87 syLBRACE = 276,
88 sySEMICOLON = 277,
89 syCOMMA = 278,
90 syPOINT = 279,
91 syARROW = 280,
92 opEQUAL = 281,
93 opLEQ = 282,
94 opGEQ = 283,
95 opLOWER = 284,
96 opGREATER = 285,
97 opPLUS = 286,
98 opMINUS = 287,
99 opINCREMENTATION = 288,
100 opDECREMENTATION = 289,
101 opNOT = 290,
102 opMULTIPLY = 291,
103 opDIVIDE = 292,
104 opMOD = 293,
105 opAND = 294,
106 opOR = 295,
107 opCOMP = 296,
108 opASSIGNMENT = 297,
109 opPLUSEQUAL = 298,
110 opMINUSEQUAL = 299,
111 opMULTIPLYEQUAL = 300,
112 opDIVIDEEQUAL = 301,
113 opMODEQUAL = 302,
114 opANDEQUAL = 303,
115 opOREQUAL = 304,
116 opCOMPEQUAL = 305,
117 opLAND = 306,
118 opLOR = 307,
119 opQMARK = 308,
120 opCOLON = 309,
121 MAXPRIORITY = 310
123 #endif
124 /* Tokens. */
125 #define IGNORE 258
126 #define IF 259
127 #define ELSE 260
128 #define FOR 261
129 #define PRAGMALOCALVARS 262
130 #define PRAGMALIVEOUT 263
131 #define MIN 264
132 #define MAX 265
133 #define CEILD 266
134 #define FLOORD 267
135 #define REAL 268
136 #define ID 269
137 #define INTEGER 270
138 #define syRPARENTHESIS 271
139 #define syLPARENTHESIS 272
140 #define syRBRACKET 273
141 #define syLBRACKET 274
142 #define syRBRACE 275
143 #define syLBRACE 276
144 #define sySEMICOLON 277
145 #define syCOMMA 278
146 #define syPOINT 279
147 #define syARROW 280
148 #define opEQUAL 281
149 #define opLEQ 282
150 #define opGEQ 283
151 #define opLOWER 284
152 #define opGREATER 285
153 #define opPLUS 286
154 #define opMINUS 287
155 #define opINCREMENTATION 288
156 #define opDECREMENTATION 289
157 #define opNOT 290
158 #define opMULTIPLY 291
159 #define opDIVIDE 292
160 #define opMOD 293
161 #define opAND 294
162 #define opOR 295
163 #define opCOMP 296
164 #define opASSIGNMENT 297
165 #define opPLUSEQUAL 298
166 #define opMINUSEQUAL 299
167 #define opMULTIPLYEQUAL 300
168 #define opDIVIDEEQUAL 301
169 #define opMODEQUAL 302
170 #define opANDEQUAL 303
171 #define opOREQUAL 304
172 #define opCOMPEQUAL 305
173 #define opLAND 306
174 #define opLOR 307
175 #define opQMARK 308
176 #define opCOLON 309
177 #define MAXPRIORITY 310
182 /* Copy the first part of user declarations. */
183 #line 39 "parser.y"
185 #include <stdio.h>
186 #include <stdlib.h>
187 #include <string.h>
188 #include <assert.h>
189 #include <clan/macros.h>
190 #include <clan/vector.h>
191 #include <clan/matrix.h>
192 #include <clan/scop.h>
193 #include <clan/symbol.h>
194 #include <clan/statement.h>
195 #include <clan/options.h>
197 int yylex(void);
198 void yyerror(char *);
199 int clan_parse_error = 0; /**< Set to 1 during parsing if
200 encountered an error */
201 void clan_parser_log(char *);
202 scoplib_scop_p clan_parse(FILE *, clan_options_p);
204 extern FILE * yyin; /**< File to be read by Lex */
205 extern char scanner_latest_text[]; /**< Latest text read by Lex */
207 /* This is the "parser state", a collection of variables that vary
208 * during the parsing and thanks to we can extract all SCoP informations.
210 scoplib_scop_p parser_scop; /**< SCoP in construction */
211 scoplib_statement_p parser_statement; /**< Statement in construction */
212 clan_symbol_p parser_symbol; /**< Top of the symbol table */
213 int parser_recording; /**< Boolean: do we record or not? */
214 char * parser_record; /**< What we record
215 (statement body) */
216 int parser_depth = 0; /**< Current loop depth */
217 int * parser_scheduling; /**< Current statement scheduling */
218 clan_symbol_p * parser_iterators; /**< Current iterator list */
219 scoplib_matrix_p parser_domain; /**< Current iteration domain */
220 int parser_nb_cons = 0; /**< Current number of constraints */
221 int * parser_consperdim; /**< Constraint nb for each
222 dimension */
223 int* parser_variables_localvars;/**< List of variables
224 in #pragma
225 local-vars */
226 int* parser_variables_liveout;/**< List of variables
227 in #pragma
228 live-out */
229 /* Ugly global variable to keep/read Clan options during parsing. */
230 clan_options_p parser_options = NULL;
235 /* Enabling traces. */
236 #ifndef YYDEBUG
237 # define YYDEBUG 0
238 #endif
240 /* Enabling verbose error messages. */
241 #ifdef YYERROR_VERBOSE
242 # undef YYERROR_VERBOSE
243 # define YYERROR_VERBOSE 1
244 #else
245 # define YYERROR_VERBOSE 0
246 #endif
248 /* Enabling the token table. */
249 #ifndef YYTOKEN_TABLE
250 # define YYTOKEN_TABLE 0
251 #endif
253 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
254 typedef union YYSTYPE
255 #line 90 "parser.y"
256 { int value; /**< An integer value for integers */
257 char * symbol; /**< A string for identifiers */
258 scoplib_vector_p affex; /**< An affine expression */
259 scoplib_matrix_p setex; /**< A set of affine expressions */
260 scoplib_matrix_p rw[2]; /**< Read and write array accesses */
262 /* Line 187 of yacc.c. */
263 #line 264 "parser.c"
264 YYSTYPE;
265 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
266 # define YYSTYPE_IS_DECLARED 1
267 # define YYSTYPE_IS_TRIVIAL 1
268 #endif
272 /* Copy the second part of user declarations. */
275 /* Line 216 of yacc.c. */
276 #line 277 "parser.c"
278 #ifdef short
279 # undef short
280 #endif
282 #ifdef YYTYPE_UINT8
283 typedef YYTYPE_UINT8 yytype_uint8;
284 #else
285 typedef unsigned char yytype_uint8;
286 #endif
288 #ifdef YYTYPE_INT8
289 typedef YYTYPE_INT8 yytype_int8;
290 #elif (defined __STDC__ || defined __C99__FUNC__ \
291 || defined __cplusplus || defined _MSC_VER)
292 typedef signed char yytype_int8;
293 #else
294 typedef short int yytype_int8;
295 #endif
297 #ifdef YYTYPE_UINT16
298 typedef YYTYPE_UINT16 yytype_uint16;
299 #else
300 typedef unsigned short int yytype_uint16;
301 #endif
303 #ifdef YYTYPE_INT16
304 typedef YYTYPE_INT16 yytype_int16;
305 #else
306 typedef short int yytype_int16;
307 #endif
309 #ifndef YYSIZE_T
310 # ifdef __SIZE_TYPE__
311 # define YYSIZE_T __SIZE_TYPE__
312 # elif defined size_t
313 # define YYSIZE_T size_t
314 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
315 || defined __cplusplus || defined _MSC_VER)
316 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
317 # define YYSIZE_T size_t
318 # else
319 # define YYSIZE_T unsigned int
320 # endif
321 #endif
323 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
325 #ifndef YY_
326 # if YYENABLE_NLS
327 # if ENABLE_NLS
328 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
329 # define YY_(msgid) dgettext ("bison-runtime", msgid)
330 # endif
331 # endif
332 # ifndef YY_
333 # define YY_(msgid) msgid
334 # endif
335 #endif
337 /* Suppress unused-variable warnings by "using" E. */
338 #if ! defined lint || defined __GNUC__
339 # define YYUSE(e) ((void) (e))
340 #else
341 # define YYUSE(e) /* empty */
342 #endif
344 /* Identity function, used to suppress warnings about constant conditions. */
345 #ifndef lint
346 # define YYID(n) (n)
347 #else
348 #if (defined __STDC__ || defined __C99__FUNC__ \
349 || defined __cplusplus || defined _MSC_VER)
350 static int
351 YYID (int i)
352 #else
353 static int
354 YYID (i)
355 int i;
356 #endif
358 return i;
360 #endif
362 #if ! defined yyoverflow || YYERROR_VERBOSE
364 /* The parser invokes alloca or malloc; define the necessary symbols. */
366 # ifdef YYSTACK_USE_ALLOCA
367 # if YYSTACK_USE_ALLOCA
368 # ifdef __GNUC__
369 # define YYSTACK_ALLOC __builtin_alloca
370 # elif defined __BUILTIN_VA_ARG_INCR
371 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
372 # elif defined _AIX
373 # define YYSTACK_ALLOC __alloca
374 # elif defined _MSC_VER
375 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
376 # define alloca _alloca
377 # else
378 # define YYSTACK_ALLOC alloca
379 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
380 || defined __cplusplus || defined _MSC_VER)
381 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
382 # ifndef _STDLIB_H
383 # define _STDLIB_H 1
384 # endif
385 # endif
386 # endif
387 # endif
388 # endif
390 # ifdef YYSTACK_ALLOC
391 /* Pacify GCC's `empty if-body' warning. */
392 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
393 # ifndef YYSTACK_ALLOC_MAXIMUM
394 /* The OS might guarantee only one guard page at the bottom of the stack,
395 and a page size can be as small as 4096 bytes. So we cannot safely
396 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
397 to allow for a few compiler-allocated temporary stack slots. */
398 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
399 # endif
400 # else
401 # define YYSTACK_ALLOC YYMALLOC
402 # define YYSTACK_FREE YYFREE
403 # ifndef YYSTACK_ALLOC_MAXIMUM
404 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
405 # endif
406 # if (defined __cplusplus && ! defined _STDLIB_H \
407 && ! ((defined YYMALLOC || defined malloc) \
408 && (defined YYFREE || defined free)))
409 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
410 # ifndef _STDLIB_H
411 # define _STDLIB_H 1
412 # endif
413 # endif
414 # ifndef YYMALLOC
415 # define YYMALLOC malloc
416 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
417 || defined __cplusplus || defined _MSC_VER)
418 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
419 # endif
420 # endif
421 # ifndef YYFREE
422 # define YYFREE free
423 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
424 || defined __cplusplus || defined _MSC_VER)
425 void free (void *); /* INFRINGES ON USER NAME SPACE */
426 # endif
427 # endif
428 # endif
429 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
432 #if (! defined yyoverflow \
433 && (! defined __cplusplus \
434 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
436 /* A type that is properly aligned for any stack member. */
437 union yyalloc
439 yytype_int16 yyss;
440 YYSTYPE yyvs;
443 /* The size of the maximum gap between one aligned stack and the next. */
444 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
446 /* The size of an array large to enough to hold all stacks, each with
447 N elements. */
448 # define YYSTACK_BYTES(N) \
449 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
450 + YYSTACK_GAP_MAXIMUM)
452 /* Copy COUNT objects from FROM to TO. The source and destination do
453 not overlap. */
454 # ifndef YYCOPY
455 # if defined __GNUC__ && 1 < __GNUC__
456 # define YYCOPY(To, From, Count) \
457 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
458 # else
459 # define YYCOPY(To, From, Count) \
460 do \
462 YYSIZE_T yyi; \
463 for (yyi = 0; yyi < (Count); yyi++) \
464 (To)[yyi] = (From)[yyi]; \
466 while (YYID (0))
467 # endif
468 # endif
470 /* Relocate STACK from its old location to the new one. The
471 local variables YYSIZE and YYSTACKSIZE give the old and new number of
472 elements in the stack, and YYPTR gives the new location of the
473 stack. Advance YYPTR to a properly aligned location for the next
474 stack. */
475 # define YYSTACK_RELOCATE(Stack) \
476 do \
478 YYSIZE_T yynewbytes; \
479 YYCOPY (&yyptr->Stack, Stack, yysize); \
480 Stack = &yyptr->Stack; \
481 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
482 yyptr += yynewbytes / sizeof (*yyptr); \
484 while (YYID (0))
486 #endif
488 /* YYFINAL -- State number of the termination state. */
489 #define YYFINAL 32
490 /* YYLAST -- Last index in YYTABLE. */
491 #define YYLAST 543
493 /* YYNTOKENS -- Number of terminals. */
494 #define YYNTOKENS 56
495 /* YYNNTS -- Number of nonterminals. */
496 #define YYNNTS 29
497 /* YYNRULES -- Number of rules. */
498 #define YYNRULES 116
499 /* YYNRULES -- Number of states. */
500 #define YYNSTATES 220
502 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
503 #define YYUNDEFTOK 2
504 #define YYMAXUTOK 310
506 #define YYTRANSLATE(YYX) \
507 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
509 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
510 static const yytype_uint8 yytranslate[] =
512 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
513 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
514 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
538 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
539 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
540 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
541 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
542 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
546 #if YYDEBUG
547 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
548 YYRHS. */
549 static const yytype_uint16 yyprhs[] =
551 0, 0, 3, 5, 6, 8, 11, 13, 16, 20,
552 22, 26, 27, 28, 29, 30, 46, 47, 54, 55,
553 58, 61, 64, 67, 70, 76, 80, 82, 89, 91,
554 98, 100, 104, 108, 112, 119, 126, 128, 130, 133,
555 137, 141, 145, 149, 154, 159, 162, 166, 170, 174,
556 178, 182, 186, 190, 192, 194, 196, 198, 200, 202,
557 204, 206, 208, 210, 215, 220, 224, 228, 231, 235,
558 237, 239, 241, 243, 245, 247, 249, 251, 253, 255,
559 257, 259, 261, 263, 266, 268, 272, 275, 279, 285,
560 287, 290, 295, 298, 301, 303, 307, 311, 315, 319,
561 323, 325, 329, 333, 335, 336, 340, 345, 347, 351,
562 354, 356, 358, 360, 362, 364, 366
565 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
566 static const yytype_int8 yyrhs[] =
568 57, 0, -1, 58, -1, -1, 60, -1, 58, 60,
569 -1, 3, -1, 58, 3, -1, 20, 58, 21, -1,
570 60, -1, 20, 58, 21, -1, -1, -1, -1, -1,
571 6, 16, 82, 61, 42, 69, 62, 22, 72, 63,
572 22, 67, 17, 64, 59, -1, -1, 4, 16, 72,
573 17, 65, 59, -1, -1, 66, 75, -1, 7, 80,
574 -1, 8, 80, -1, 82, 33, -1, 33, 82, -1,
575 82, 42, 82, 31, 15, -1, 82, 43, 15, -1,
576 70, -1, 9, 16, 68, 23, 68, 17, -1, 70,
577 -1, 10, 16, 69, 23, 69, 17, -1, 71, -1,
578 70, 31, 70, -1, 70, 32, 70, -1, 16, 70,
579 17, -1, 11, 16, 70, 23, 71, 17, -1, 12,
580 16, 70, 23, 71, 17, -1, 15, -1, 82, -1,
581 32, 15, -1, 15, 36, 82, -1, 82, 36, 15,
582 -1, 15, 36, 15, -1, 15, 37, 15, -1, 32,
583 15, 36, 82, -1, 32, 82, 36, 15, -1, 32,
584 82, -1, 70, 29, 68, -1, 70, 30, 69, -1,
585 70, 27, 68, -1, 70, 28, 69, -1, 70, 26,
586 70, -1, 16, 72, 17, -1, 72, 51, 72, -1,
587 43, -1, 44, -1, 45, -1, 46, -1, 47, -1,
588 48, -1, 49, -1, 50, -1, 33, -1, 34, -1,
589 78, 42, 77, 22, -1, 78, 73, 77, 22, -1,
590 78, 74, 22, -1, 74, 78, 22, -1, 78, 22,
591 -1, 20, 75, 21, -1, 31, -1, 32, -1, 36,
592 -1, 37, -1, 38, -1, 28, -1, 30, -1, 27,
593 -1, 29, -1, 26, -1, 39, -1, 40, -1, 41,
594 -1, 84, -1, 32, 84, -1, 78, -1, 77, 76,
595 77, -1, 35, 77, -1, 16, 77, 17, -1, 77,
596 53, 77, 54, 77, -1, 82, -1, 82, 81, -1,
597 82, 16, 80, 17, -1, 32, 78, -1, 31, 78,
598 -1, 84, -1, 79, 32, 79, -1, 79, 31, 79,
599 -1, 79, 36, 79, -1, 79, 37, 79, -1, 16,
600 79, 17, -1, 78, -1, 80, 23, 78, -1, 80,
601 23, 79, -1, 79, -1, -1, 18, 70, 19, -1,
602 81, 18, 70, 19, -1, 14, -1, 16, 14, 17,
603 -1, 39, 14, -1, 83, -1, 9, -1, 10, -1,
604 11, -1, 12, -1, 15, -1, 13, -1
607 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
608 static const yytype_uint16 yyrline[] =
610 0, 140, 140, 169, 177, 178, 179, 180, 181, 192,
611 196, 213, 235, 255, 263, 210, 280, 279, 298, 298,
612 366, 390, 419, 423, 427, 437, 455, 460, 474, 479,
613 493, 497, 503, 509, 513, 518, 535, 542, 551, 558,
614 567, 576, 583, 590, 599, 608, 628, 663, 700, 733,
615 768, 785, 792, 806, 807, 808, 809, 810, 811, 812,
616 813, 822, 823, 836, 849, 863, 876, 889, 897, 910,
617 911, 912, 913, 914, 915, 916, 917, 918, 919, 920,
618 921, 922, 933, 940, 947, 955, 964, 971, 978, 1000,
619 1026, 1039, 1047, 1054, 1065, 1066, 1067, 1068, 1069, 1070,
620 1082, 1089, 1096, 1103, 1111, 1126, 1134, 1155, 1162, 1169,
621 1176, 1182, 1182, 1182, 1182, 1185, 1186
623 #endif
625 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
626 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
627 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
628 static const char *const yytname[] =
630 "$end", "error", "$undefined", "IGNORE", "IF", "ELSE", "FOR",
631 "PRAGMALOCALVARS", "PRAGMALIVEOUT", "MIN", "MAX", "CEILD", "FLOORD",
632 "REAL", "ID", "INTEGER", "syRPARENTHESIS", "syLPARENTHESIS",
633 "syRBRACKET", "syLBRACKET", "syRBRACE", "syLBRACE", "sySEMICOLON",
634 "syCOMMA", "syPOINT", "syARROW", "opEQUAL", "opLEQ", "opGEQ", "opLOWER",
635 "opGREATER", "opPLUS", "opMINUS", "opINCREMENTATION", "opDECREMENTATION",
636 "opNOT", "opMULTIPLY", "opDIVIDE", "opMOD", "opAND", "opOR", "opCOMP",
637 "opASSIGNMENT", "opPLUSEQUAL", "opMINUSEQUAL", "opMULTIPLYEQUAL",
638 "opDIVIDEEQUAL", "opMODEQUAL", "opANDEQUAL", "opOREQUAL", "opCOMPEQUAL",
639 "opLAND", "opLOR", "opQMARK", "opCOLON", "MAXPRIORITY", "$accept",
640 "program", "instruction_list", "bloc", "instruction", "@1", "@2", "@3",
641 "@4", "@5", "@6", "incrementation", "min_affine_expression",
642 "max_affine_expression", "affine_expression", "term", "condition",
643 "reduction_operator", "unary_operator", "assignment", "binary_operator",
644 "expression", "variable", "arithmetic_expression", "variable_list",
645 "array_index", "id", "math_func_list", "NUMBER", 0
647 #endif
649 # ifdef YYPRINT
650 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
651 token YYLEX-NUM. */
652 static const yytype_uint16 yytoknum[] =
654 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
655 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
656 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
657 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
658 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
659 305, 306, 307, 308, 309, 310
661 # endif
663 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
664 static const yytype_uint8 yyr1[] =
666 0, 56, 57, 57, 58, 58, 58, 58, 58, 59,
667 59, 61, 62, 63, 64, 60, 65, 60, 66, 60,
668 60, 60, 67, 67, 67, 67, 68, 68, 69, 69,
669 70, 70, 70, 70, 70, 70, 71, 71, 71, 71,
670 71, 71, 71, 71, 71, 71, 72, 72, 72, 72,
671 72, 72, 72, 73, 73, 73, 73, 73, 73, 73,
672 73, 74, 74, 75, 75, 75, 75, 75, 75, 76,
673 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
674 76, 76, 77, 77, 77, 77, 77, 77, 77, 78,
675 78, 78, 78, 78, 79, 79, 79, 79, 79, 79,
676 80, 80, 80, 80, 80, 81, 81, 82, 82, 82,
677 82, 83, 83, 83, 83, 84, 84
680 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
681 static const yytype_uint8 yyr2[] =
683 0, 2, 1, 0, 1, 2, 1, 2, 3, 1,
684 3, 0, 0, 0, 0, 15, 0, 6, 0, 2,
685 2, 2, 2, 2, 5, 3, 1, 6, 1, 6,
686 1, 3, 3, 3, 6, 6, 1, 1, 2, 3,
687 3, 3, 3, 4, 4, 2, 3, 3, 3, 3,
688 3, 3, 3, 1, 1, 1, 1, 1, 1, 1,
689 1, 1, 1, 4, 4, 3, 3, 2, 3, 1,
690 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
691 1, 1, 1, 2, 1, 3, 2, 3, 5, 1,
692 2, 4, 2, 2, 1, 3, 3, 3, 3, 3,
693 1, 3, 3, 1, 0, 3, 4, 1, 3, 2,
694 1, 1, 1, 1, 1, 1, 1
697 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
698 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
699 means the default is an error. */
700 static const yytype_uint8 yydefact[] =
702 18, 6, 0, 0, 104, 104, 18, 0, 18, 4,
703 0, 0, 0, 111, 112, 113, 114, 116, 107, 115,
704 0, 0, 0, 0, 100, 103, 20, 89, 110, 94,
705 21, 18, 1, 7, 5, 0, 0, 61, 62, 0,
706 19, 0, 113, 114, 36, 0, 0, 0, 30, 0,
707 37, 11, 0, 0, 0, 93, 92, 109, 0, 0,
708 0, 0, 0, 104, 0, 90, 8, 0, 0, 67,
709 0, 53, 54, 55, 56, 57, 58, 59, 60, 0,
710 0, 0, 0, 0, 0, 107, 0, 0, 38, 45,
711 0, 0, 0, 0, 0, 0, 0, 16, 0, 0,
712 0, 108, 99, 96, 95, 97, 98, 101, 102, 0,
713 0, 0, 0, 68, 66, 0, 0, 0, 0, 84,
714 82, 0, 65, 0, 0, 41, 39, 42, 33, 51,
715 0, 0, 50, 111, 48, 26, 112, 49, 28, 46,
716 47, 31, 32, 18, 52, 40, 0, 91, 0, 105,
717 0, 0, 83, 86, 63, 78, 76, 74, 77, 75,
718 69, 70, 71, 72, 73, 79, 80, 81, 0, 0,
719 64, 0, 0, 43, 44, 0, 0, 18, 17, 9,
720 12, 106, 87, 0, 85, 0, 0, 0, 0, 18,
721 0, 0, 34, 35, 0, 0, 10, 0, 88, 0,
722 0, 13, 27, 29, 0, 0, 0, 0, 0, 23,
723 14, 22, 0, 0, 18, 0, 25, 15, 0, 24
726 /* YYDEFGOTO[NTERM-NUM]. */
727 static const yytype_int16 yydefgoto[] =
729 -1, 7, 8, 178, 9, 100, 190, 204, 214, 143,
730 10, 207, 134, 137, 138, 48, 49, 79, 39, 40,
731 169, 118, 119, 25, 26, 65, 50, 28, 29
734 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
735 STATE-NUM. */
736 #define YYPACT_NINF -80
737 static const yytype_int16 yypact[] =
739 136, -80, 3, 11, 290, 290, 375, 13, 280, -80,
740 238, 329, 464, -80, -80, -80, -80, -80, -80, -80,
741 147, 353, 353, 16, -80, 167, 55, 31, -80, -80,
742 55, 101, -80, -80, -80, 69, 238, -80, -80, 353,
743 -80, 471, 72, 77, 1, 361, 137, 455, -80, -7,
744 49, -80, 79, 41, -8, -80, -80, -80, 41, 41,
745 41, 41, 290, 290, 387, 82, -80, 85, 98, -80,
746 250, -80, -80, -80, -80, -80, -80, -80, -80, 250,
747 105, 387, 387, 440, 109, 79, 505, -3, 99, 114,
748 387, 395, 406, 395, 406, 387, 387, -80, 329, 126,
749 115, -80, -80, 34, 34, -80, -80, -80, 167, 57,
750 421, 21, 387, -80, -80, 281, 321, 250, 184, -80,
751 -80, 204, -80, 87, 102, -80, -80, -80, -80, -80,
752 464, 159, 67, 170, -80, 67, 174, -80, 67, -80,
753 -80, -80, -80, 185, -80, -80, 406, -80, 14, -80,
754 45, 141, -80, -80, -80, -80, -80, -80, -80, -80,
755 -80, -80, -80, -80, -80, -80, -80, -80, 250, 250,
756 -80, 432, 432, -80, -80, 395, 406, 375, -80, -80,
757 -80, -80, -80, 470, -80, 166, 178, 173, 177, 522,
758 175, 250, -80, -80, 395, 406, -80, 329, -80, 190,
759 200, 168, -80, -80, 196, 456, 464, 210, -21, -80,
760 -80, -80, 464, 213, 185, 198, -80, -80, 223, -80
763 /* YYPGOTO[NTERM-NUM]. */
764 static const yytype_int16 yypgoto[] =
766 -80, -80, -2, 25, -5, -80, -80, -80, -80, -80,
767 -80, -80, -73, -79, -9, -17, -38, -80, 205, 215,
768 -80, -74, 29, 70, 6, -80, -4, -80, -54
771 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
772 positive, shift that token. If negative, reduce the rule which
773 number is the opposite. If zero, do what YYDEFACT says.
774 If YYTABLE_NINF, syntax error. */
775 #define YYTABLE_NINF -4
776 static const yytype_int16 yytable[] =
778 27, 27, 47, 34, 31, 121, 27, 87, 51, 102,
779 97, 30, 211, 32, 129, 140, 120, 27, 27, 11,
780 139, 212, 213, 58, 59, 120, 34, 12, 60, 61,
781 57, 128, 27, 24, 24, 27, 86, 83, 84, 41,
782 149, 151, 89, 153, 98, 95, 96, 63, 98, 64,
783 55, 56, 95, 96, 17, 111, 19, 53, 27, 27,
784 144, 120, 152, 120, 181, 41, 27, 180, 68, 109,
785 60, 61, 123, 124, 147, 27, 95, 96, 62, 126,
786 62, 132, 135, 52, 135, 99, 141, 142, 81, 47,
787 54, 107, 24, 82, 183, 184, 101, 188, 95, 96,
788 112, 148, 187, 150, 33, 2, 113, 3, 4, 5,
789 171, 27, 27, 27, 120, 120, 200, 198, 95, 96,
790 114, 199, 66, 54, 127, 172, 173, 122, 103, 104,
791 105, 106, 108, 95, 96, 130, -3, 120, 179, 1,
792 2, 145, 3, 4, 5, 56, 13, 14, 15, 16,
793 131, 18, 88, 35, 185, 186, 6, 146, 182, 201,
794 17, 52, 19, 53, 27, 27, 135, 155, 156, 157,
795 158, 159, 160, 161, 174, 189, 23, 162, 163, 164,
796 165, 166, 167, 192, 34, 135, 175, 27, 47, 2,
797 176, 3, 4, 5, 168, 193, 194, 197, 58, 59,
798 195, 208, 209, 60, 61, 177, 154, 202, 215, 179,
799 155, 156, 157, 158, 159, 160, 161, 203, 205, 98,
800 162, 163, 164, 165, 166, 167, 170, 210, 216, 218,
801 155, 156, 157, 158, 159, 160, 161, 168, 219, 217,
802 162, 163, 164, 165, 166, 167, 80, 13, 14, 15,
803 16, 67, 18, 0, 35, 0, 0, 168, 36, 13,
804 14, 15, 16, 17, 18, 19, 115, 0, 0, 21,
805 22, 37, 38, 0, 0, 0, 0, 23, 0, 0,
806 -2, 21, 116, 33, 2, 117, 3, 4, 5, 23,
807 13, 14, 15, 16, 17, 85, 19, 115, 0, 13,
808 14, 15, 16, 17, 18, 19, 20, 0, 0, 0,
809 0, 0, 21, 116, 0, 0, 117, 0, 0, 0,
810 23, 21, 22, 0, 0, 0, 0, 0, 0, 23,
811 13, 14, 15, 16, 17, 18, 19, 35, 13, 14,
812 42, 43, 0, 18, 44, 45, 0, 0, 0, 0,
813 0, 0, 21, 22, 0, 0, 0, 0, 0, 0,
814 23, 46, 13, 14, 15, 16, 0, 18, 23, 35,
815 13, 14, 42, 43, 0, 85, 44, 45, 1, 2,
816 0, 3, 4, 5, 21, 22, 0, 0, 0, 0,
817 0, 0, 23, 46, 0, 6, 13, 14, 42, 43,
818 23, 18, 44, 110, 133, 14, 42, 43, 0, 18,
819 44, 110, 0, 0, 0, 13, 136, 42, 43, 46,
820 18, 44, 110, 0, 0, 0, 23, 46, 0, 0,
821 13, 14, 42, 43, 23, 85, 44, 110, 46, 0,
822 0, 13, 14, 15, 16, 23, 18, 44, 35, 13,
823 14, 15, 16, 46, 18, 125, 35, 0, 0, 0,
824 23, 0, 0, 0, 46, 13, 14, 15, 16, 0,
825 18, 23, 35, 13, 14, 15, 16, 0, 18, 23,
826 35, 90, 91, 92, 93, 94, 95, 96, 0, 206,
827 0, 0, 0, 69, 0, 23, 155, 156, 157, 158,
828 159, 160, 161, 23, 37, 38, 162, 163, 164, 165,
829 166, 167, 0, 70, 71, 72, 73, 74, 75, 76,
830 77, 78, 128, 168, 191, 33, 2, 0, 3, 4,
831 5, 90, 91, 92, 93, 94, 95, 96, 0, 0,
832 0, 0, 0, 196
835 static const yytype_int16 yycheck[] =
837 4, 5, 11, 8, 6, 79, 10, 45, 12, 17,
838 17, 5, 33, 0, 17, 94, 70, 21, 22, 16,
839 93, 42, 43, 31, 32, 79, 31, 16, 36, 37,
840 14, 17, 36, 4, 5, 39, 45, 36, 37, 10,
841 19, 115, 46, 117, 51, 31, 32, 16, 51, 18,
842 21, 22, 31, 32, 13, 64, 15, 16, 62, 63,
843 98, 115, 116, 117, 19, 36, 70, 146, 39, 63,
844 36, 37, 81, 82, 17, 79, 31, 32, 23, 83,
845 23, 90, 91, 14, 93, 36, 95, 96, 16, 98,
846 20, 62, 63, 16, 168, 169, 17, 176, 31, 32,
847 18, 110, 175, 112, 3, 4, 21, 6, 7, 8,
848 23, 115, 116, 117, 168, 169, 195, 191, 31, 32,
849 22, 194, 21, 53, 15, 23, 130, 22, 58, 59,
850 60, 61, 62, 31, 32, 36, 0, 191, 143, 3,
851 4, 15, 6, 7, 8, 116, 9, 10, 11, 12,
852 36, 14, 15, 16, 171, 172, 20, 42, 17, 197,
853 13, 14, 15, 16, 168, 169, 175, 26, 27, 28,
854 29, 30, 31, 32, 15, 177, 39, 36, 37, 38,
855 39, 40, 41, 17, 189, 194, 16, 191, 197, 4,
856 16, 6, 7, 8, 53, 17, 23, 22, 31, 32,
857 23, 205, 206, 36, 37, 20, 22, 17, 212, 214,
858 26, 27, 28, 29, 30, 31, 32, 17, 22, 51,
859 36, 37, 38, 39, 40, 41, 22, 17, 15, 31,
860 26, 27, 28, 29, 30, 31, 32, 53, 15, 214,
861 36, 37, 38, 39, 40, 41, 41, 9, 10, 11,
862 12, 36, 14, -1, 16, -1, -1, 53, 20, 9,
863 10, 11, 12, 13, 14, 15, 16, -1, -1, 31,
864 32, 33, 34, -1, -1, -1, -1, 39, -1, -1,
865 0, 31, 32, 3, 4, 35, 6, 7, 8, 39,
866 9, 10, 11, 12, 13, 14, 15, 16, -1, 9,
867 10, 11, 12, 13, 14, 15, 16, -1, -1, -1,
868 -1, -1, 31, 32, -1, -1, 35, -1, -1, -1,
869 39, 31, 32, -1, -1, -1, -1, -1, -1, 39,
870 9, 10, 11, 12, 13, 14, 15, 16, 9, 10,
871 11, 12, -1, 14, 15, 16, -1, -1, -1, -1,
872 -1, -1, 31, 32, -1, -1, -1, -1, -1, -1,
873 39, 32, 9, 10, 11, 12, -1, 14, 39, 16,
874 9, 10, 11, 12, -1, 14, 15, 16, 3, 4,
875 -1, 6, 7, 8, 31, 32, -1, -1, -1, -1,
876 -1, -1, 39, 32, -1, 20, 9, 10, 11, 12,
877 39, 14, 15, 16, 9, 10, 11, 12, -1, 14,
878 15, 16, -1, -1, -1, 9, 10, 11, 12, 32,
879 14, 15, 16, -1, -1, -1, 39, 32, -1, -1,
880 9, 10, 11, 12, 39, 14, 15, 16, 32, -1,
881 -1, 9, 10, 11, 12, 39, 14, 15, 16, 9,
882 10, 11, 12, 32, 14, 15, 16, -1, -1, -1,
883 39, -1, -1, -1, 32, 9, 10, 11, 12, -1,
884 14, 39, 16, 9, 10, 11, 12, -1, 14, 39,
885 16, 26, 27, 28, 29, 30, 31, 32, -1, 33,
886 -1, -1, -1, 22, -1, 39, 26, 27, 28, 29,
887 30, 31, 32, 39, 33, 34, 36, 37, 38, 39,
888 40, 41, -1, 42, 43, 44, 45, 46, 47, 48,
889 49, 50, 17, 53, 54, 3, 4, -1, 6, 7,
890 8, 26, 27, 28, 29, 30, 31, 32, -1, -1,
891 -1, -1, -1, 21
894 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
895 symbol of state STATE-NUM. */
896 static const yytype_uint8 yystos[] =
898 0, 3, 4, 6, 7, 8, 20, 57, 58, 60,
899 66, 16, 16, 9, 10, 11, 12, 13, 14, 15,
900 16, 31, 32, 39, 78, 79, 80, 82, 83, 84,
901 80, 58, 0, 3, 60, 16, 20, 33, 34, 74,
902 75, 78, 11, 12, 15, 16, 32, 70, 71, 72,
903 82, 82, 14, 16, 79, 78, 78, 14, 31, 32,
904 36, 37, 23, 16, 18, 81, 21, 75, 78, 22,
905 42, 43, 44, 45, 46, 47, 48, 49, 50, 73,
906 74, 16, 16, 36, 37, 14, 70, 72, 15, 82,
907 26, 27, 28, 29, 30, 31, 32, 17, 51, 36,
908 61, 17, 17, 79, 79, 79, 79, 78, 79, 80,
909 16, 70, 18, 21, 22, 16, 32, 35, 77, 78,
910 84, 77, 22, 70, 70, 15, 82, 15, 17, 17,
911 36, 36, 70, 9, 68, 70, 10, 69, 70, 68,
912 69, 70, 70, 65, 72, 15, 42, 17, 70, 19,
913 70, 77, 84, 77, 22, 26, 27, 28, 29, 30,
914 31, 32, 36, 37, 38, 39, 40, 41, 53, 76,
915 22, 23, 23, 82, 15, 16, 16, 20, 59, 60,
916 69, 19, 17, 77, 77, 71, 71, 68, 69, 58,
917 62, 54, 17, 17, 23, 23, 21, 22, 77, 68,
918 69, 72, 17, 17, 63, 22, 33, 67, 82, 82,
919 17, 33, 42, 43, 64, 82, 15, 59, 31, 15
922 #define yyerrok (yyerrstatus = 0)
923 #define yyclearin (yychar = YYEMPTY)
924 #define YYEMPTY (-2)
925 #define YYEOF 0
927 #define YYACCEPT goto yyacceptlab
928 #define YYABORT goto yyabortlab
929 #define YYERROR goto yyerrorlab
932 /* Like YYERROR except do call yyerror. This remains here temporarily
933 to ease the transition to the new meaning of YYERROR, for GCC.
934 Once GCC version 2 has supplanted version 1, this can go. */
936 #define YYFAIL goto yyerrlab
938 #define YYRECOVERING() (!!yyerrstatus)
940 #define YYBACKUP(Token, Value) \
941 do \
942 if (yychar == YYEMPTY && yylen == 1) \
944 yychar = (Token); \
945 yylval = (Value); \
946 yytoken = YYTRANSLATE (yychar); \
947 YYPOPSTACK (1); \
948 goto yybackup; \
950 else \
952 yyerror (YY_("syntax error: cannot back up")); \
953 YYERROR; \
955 while (YYID (0))
958 #define YYTERROR 1
959 #define YYERRCODE 256
962 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
963 If N is 0, then set CURRENT to the empty location which ends
964 the previous symbol: RHS[0] (always defined). */
966 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
967 #ifndef YYLLOC_DEFAULT
968 # define YYLLOC_DEFAULT(Current, Rhs, N) \
969 do \
970 if (YYID (N)) \
972 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
973 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
974 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
975 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
977 else \
979 (Current).first_line = (Current).last_line = \
980 YYRHSLOC (Rhs, 0).last_line; \
981 (Current).first_column = (Current).last_column = \
982 YYRHSLOC (Rhs, 0).last_column; \
984 while (YYID (0))
985 #endif
988 /* YY_LOCATION_PRINT -- Print the location on the stream.
989 This macro was not mandated originally: define only if we know
990 we won't break user code: when these are the locations we know. */
992 #ifndef YY_LOCATION_PRINT
993 # if YYLTYPE_IS_TRIVIAL
994 # define YY_LOCATION_PRINT(File, Loc) \
995 fprintf (File, "%d.%d-%d.%d", \
996 (Loc).first_line, (Loc).first_column, \
997 (Loc).last_line, (Loc).last_column)
998 # else
999 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1000 # endif
1001 #endif
1004 /* YYLEX -- calling `yylex' with the right arguments. */
1006 #ifdef YYLEX_PARAM
1007 # define YYLEX yylex (YYLEX_PARAM)
1008 #else
1009 # define YYLEX yylex ()
1010 #endif
1012 /* Enable debugging if requested. */
1013 #if YYDEBUG
1015 # ifndef YYFPRINTF
1016 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1017 # define YYFPRINTF fprintf
1018 # endif
1020 # define YYDPRINTF(Args) \
1021 do { \
1022 if (yydebug) \
1023 YYFPRINTF Args; \
1024 } while (YYID (0))
1026 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1027 do { \
1028 if (yydebug) \
1030 YYFPRINTF (stderr, "%s ", Title); \
1031 yy_symbol_print (stderr, \
1032 Type, Value); \
1033 YYFPRINTF (stderr, "\n"); \
1035 } while (YYID (0))
1038 /*--------------------------------.
1039 | Print this symbol on YYOUTPUT. |
1040 `--------------------------------*/
1042 /*ARGSUSED*/
1043 #if (defined __STDC__ || defined __C99__FUNC__ \
1044 || defined __cplusplus || defined _MSC_VER)
1045 static void
1046 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1047 #else
1048 static void
1049 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
1050 FILE *yyoutput;
1051 int yytype;
1052 YYSTYPE const * const yyvaluep;
1053 #endif
1055 if (!yyvaluep)
1056 return;
1057 # ifdef YYPRINT
1058 if (yytype < YYNTOKENS)
1059 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1060 # else
1061 YYUSE (yyoutput);
1062 # endif
1063 switch (yytype)
1065 default:
1066 break;
1071 /*--------------------------------.
1072 | Print this symbol on YYOUTPUT. |
1073 `--------------------------------*/
1075 #if (defined __STDC__ || defined __C99__FUNC__ \
1076 || defined __cplusplus || defined _MSC_VER)
1077 static void
1078 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1079 #else
1080 static void
1081 yy_symbol_print (yyoutput, yytype, yyvaluep)
1082 FILE *yyoutput;
1083 int yytype;
1084 YYSTYPE const * const yyvaluep;
1085 #endif
1087 if (yytype < YYNTOKENS)
1088 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1089 else
1090 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1092 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1093 YYFPRINTF (yyoutput, ")");
1096 /*------------------------------------------------------------------.
1097 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1098 | TOP (included). |
1099 `------------------------------------------------------------------*/
1101 #if (defined __STDC__ || defined __C99__FUNC__ \
1102 || defined __cplusplus || defined _MSC_VER)
1103 static void
1104 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1105 #else
1106 static void
1107 yy_stack_print (bottom, top)
1108 yytype_int16 *bottom;
1109 yytype_int16 *top;
1110 #endif
1112 YYFPRINTF (stderr, "Stack now");
1113 for (; bottom <= top; ++bottom)
1114 YYFPRINTF (stderr, " %d", *bottom);
1115 YYFPRINTF (stderr, "\n");
1118 # define YY_STACK_PRINT(Bottom, Top) \
1119 do { \
1120 if (yydebug) \
1121 yy_stack_print ((Bottom), (Top)); \
1122 } while (YYID (0))
1125 /*------------------------------------------------.
1126 | Report that the YYRULE is going to be reduced. |
1127 `------------------------------------------------*/
1129 #if (defined __STDC__ || defined __C99__FUNC__ \
1130 || defined __cplusplus || defined _MSC_VER)
1131 static void
1132 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1133 #else
1134 static void
1135 yy_reduce_print (yyvsp, yyrule)
1136 YYSTYPE *yyvsp;
1137 int yyrule;
1138 #endif
1140 int yynrhs = yyr2[yyrule];
1141 int yyi;
1142 unsigned long int yylno = yyrline[yyrule];
1143 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1144 yyrule - 1, yylno);
1145 /* The symbols being reduced. */
1146 for (yyi = 0; yyi < yynrhs; yyi++)
1148 fprintf (stderr, " $%d = ", yyi + 1);
1149 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1150 &(yyvsp[(yyi + 1) - (yynrhs)])
1152 fprintf (stderr, "\n");
1156 # define YY_REDUCE_PRINT(Rule) \
1157 do { \
1158 if (yydebug) \
1159 yy_reduce_print (yyvsp, Rule); \
1160 } while (YYID (0))
1162 /* Nonzero means print parse trace. It is left uninitialized so that
1163 multiple parsers can coexist. */
1164 int yydebug;
1165 #else /* !YYDEBUG */
1166 # define YYDPRINTF(Args)
1167 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1168 # define YY_STACK_PRINT(Bottom, Top)
1169 # define YY_REDUCE_PRINT(Rule)
1170 #endif /* !YYDEBUG */
1173 /* YYINITDEPTH -- initial size of the parser's stacks. */
1174 #ifndef YYINITDEPTH
1175 # define YYINITDEPTH 200
1176 #endif
1178 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1179 if the built-in stack extension method is used).
1181 Do not make this value too large; the results are undefined if
1182 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1183 evaluated with infinite-precision integer arithmetic. */
1185 #ifndef YYMAXDEPTH
1186 # define YYMAXDEPTH 10000
1187 #endif
1191 #if YYERROR_VERBOSE
1193 # ifndef yystrlen
1194 # if defined __GLIBC__ && defined _STRING_H
1195 # define yystrlen strlen
1196 # else
1197 /* Return the length of YYSTR. */
1198 #if (defined __STDC__ || defined __C99__FUNC__ \
1199 || defined __cplusplus || defined _MSC_VER)
1200 static YYSIZE_T
1201 yystrlen (const char *yystr)
1202 #else
1203 static YYSIZE_T
1204 yystrlen (yystr)
1205 const char *yystr;
1206 #endif
1208 YYSIZE_T yylen;
1209 for (yylen = 0; yystr[yylen]; yylen++)
1210 continue;
1211 return yylen;
1213 # endif
1214 # endif
1216 # ifndef yystpcpy
1217 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1218 # define yystpcpy stpcpy
1219 # else
1220 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1221 YYDEST. */
1222 #if (defined __STDC__ || defined __C99__FUNC__ \
1223 || defined __cplusplus || defined _MSC_VER)
1224 static char *
1225 yystpcpy (char *yydest, const char *yysrc)
1226 #else
1227 static char *
1228 yystpcpy (yydest, yysrc)
1229 char *yydest;
1230 const char *yysrc;
1231 #endif
1233 char *yyd = yydest;
1234 const char *yys = yysrc;
1236 while ((*yyd++ = *yys++) != '\0')
1237 continue;
1239 return yyd - 1;
1241 # endif
1242 # endif
1244 # ifndef yytnamerr
1245 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1246 quotes and backslashes, so that it's suitable for yyerror. The
1247 heuristic is that double-quoting is unnecessary unless the string
1248 contains an apostrophe, a comma, or backslash (other than
1249 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1250 null, do not copy; instead, return the length of what the result
1251 would have been. */
1252 static YYSIZE_T
1253 yytnamerr (char *yyres, const char *yystr)
1255 if (*yystr == '"')
1257 YYSIZE_T yyn = 0;
1258 char const *yyp = yystr;
1260 for (;;)
1261 switch (*++yyp)
1263 case '\'':
1264 case ',':
1265 goto do_not_strip_quotes;
1267 case '\\':
1268 if (*++yyp != '\\')
1269 goto do_not_strip_quotes;
1270 /* Fall through. */
1271 default:
1272 if (yyres)
1273 yyres[yyn] = *yyp;
1274 yyn++;
1275 break;
1277 case '"':
1278 if (yyres)
1279 yyres[yyn] = '\0';
1280 return yyn;
1282 do_not_strip_quotes: ;
1285 if (! yyres)
1286 return yystrlen (yystr);
1288 return yystpcpy (yyres, yystr) - yyres;
1290 # endif
1292 /* Copy into YYRESULT an error message about the unexpected token
1293 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1294 including the terminating null byte. If YYRESULT is null, do not
1295 copy anything; just return the number of bytes that would be
1296 copied. As a special case, return 0 if an ordinary "syntax error"
1297 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1298 size calculation. */
1299 static YYSIZE_T
1300 yysyntax_error (char *yyresult, int yystate, int yychar)
1302 int yyn = yypact[yystate];
1304 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1305 return 0;
1306 else
1308 int yytype = YYTRANSLATE (yychar);
1309 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1310 YYSIZE_T yysize = yysize0;
1311 YYSIZE_T yysize1;
1312 int yysize_overflow = 0;
1313 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1314 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1315 int yyx;
1317 # if 0
1318 /* This is so xgettext sees the translatable formats that are
1319 constructed on the fly. */
1320 YY_("syntax error, unexpected %s");
1321 YY_("syntax error, unexpected %s, expecting %s");
1322 YY_("syntax error, unexpected %s, expecting %s or %s");
1323 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1324 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1325 # endif
1326 char *yyfmt;
1327 char const *yyf;
1328 static char const yyunexpected[] = "syntax error, unexpected %s";
1329 static char const yyexpecting[] = ", expecting %s";
1330 static char const yyor[] = " or %s";
1331 char yyformat[sizeof yyunexpected
1332 + sizeof yyexpecting - 1
1333 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1334 * (sizeof yyor - 1))];
1335 char const *yyprefix = yyexpecting;
1337 /* Start YYX at -YYN if negative to avoid negative indexes in
1338 YYCHECK. */
1339 int yyxbegin = yyn < 0 ? -yyn : 0;
1341 /* Stay within bounds of both yycheck and yytname. */
1342 int yychecklim = YYLAST - yyn + 1;
1343 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1344 int yycount = 1;
1346 yyarg[0] = yytname[yytype];
1347 yyfmt = yystpcpy (yyformat, yyunexpected);
1349 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1350 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1352 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1354 yycount = 1;
1355 yysize = yysize0;
1356 yyformat[sizeof yyunexpected - 1] = '\0';
1357 break;
1359 yyarg[yycount++] = yytname[yyx];
1360 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1361 yysize_overflow |= (yysize1 < yysize);
1362 yysize = yysize1;
1363 yyfmt = yystpcpy (yyfmt, yyprefix);
1364 yyprefix = yyor;
1367 yyf = YY_(yyformat);
1368 yysize1 = yysize + yystrlen (yyf);
1369 yysize_overflow |= (yysize1 < yysize);
1370 yysize = yysize1;
1372 if (yysize_overflow)
1373 return YYSIZE_MAXIMUM;
1375 if (yyresult)
1377 /* Avoid sprintf, as that infringes on the user's name space.
1378 Don't have undefined behavior even if the translation
1379 produced a string with the wrong number of "%s"s. */
1380 char *yyp = yyresult;
1381 int yyi = 0;
1382 while ((*yyp = *yyf) != '\0')
1384 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1386 yyp += yytnamerr (yyp, yyarg[yyi++]);
1387 yyf += 2;
1389 else
1391 yyp++;
1392 yyf++;
1396 return yysize;
1399 #endif /* YYERROR_VERBOSE */
1402 /*-----------------------------------------------.
1403 | Release the memory associated to this symbol. |
1404 `-----------------------------------------------*/
1406 /*ARGSUSED*/
1407 #if (defined __STDC__ || defined __C99__FUNC__ \
1408 || defined __cplusplus || defined _MSC_VER)
1409 static void
1410 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1411 #else
1412 static void
1413 yydestruct (yymsg, yytype, yyvaluep)
1414 const char *yymsg;
1415 int yytype;
1416 YYSTYPE *yyvaluep;
1417 #endif
1419 YYUSE (yyvaluep);
1421 if (!yymsg)
1422 yymsg = "Deleting";
1423 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1425 switch (yytype)
1428 default:
1429 break;
1434 /* Prevent warnings from -Wmissing-prototypes. */
1436 #ifdef YYPARSE_PARAM
1437 #if defined __STDC__ || defined __cplusplus
1438 int yyparse (void *YYPARSE_PARAM);
1439 #else
1440 int yyparse ();
1441 #endif
1442 #else /* ! YYPARSE_PARAM */
1443 #if defined __STDC__ || defined __cplusplus
1444 int yyparse (void);
1445 #else
1446 int yyparse ();
1447 #endif
1448 #endif /* ! YYPARSE_PARAM */
1452 /* The look-ahead symbol. */
1453 int yychar;
1455 /* The semantic value of the look-ahead symbol. */
1456 YYSTYPE yylval;
1458 /* Number of syntax errors so far. */
1459 int yynerrs;
1463 /*----------.
1464 | yyparse. |
1465 `----------*/
1467 #ifdef YYPARSE_PARAM
1468 #if (defined __STDC__ || defined __C99__FUNC__ \
1469 || defined __cplusplus || defined _MSC_VER)
1471 yyparse (void *YYPARSE_PARAM)
1472 #else
1474 yyparse (YYPARSE_PARAM)
1475 void *YYPARSE_PARAM;
1476 #endif
1477 #else /* ! YYPARSE_PARAM */
1478 #if (defined __STDC__ || defined __C99__FUNC__ \
1479 || defined __cplusplus || defined _MSC_VER)
1481 yyparse (void)
1482 #else
1484 yyparse ()
1486 #endif
1487 #endif
1490 int yystate;
1491 int yyn;
1492 int yyresult;
1493 /* Number of tokens to shift before error messages enabled. */
1494 int yyerrstatus;
1495 /* Look-ahead token as an internal (translated) token number. */
1496 int yytoken = 0;
1497 #if YYERROR_VERBOSE
1498 /* Buffer for error messages, and its allocated size. */
1499 char yymsgbuf[128];
1500 char *yymsg = yymsgbuf;
1501 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1502 #endif
1504 /* Three stacks and their tools:
1505 `yyss': related to states,
1506 `yyvs': related to semantic values,
1507 `yyls': related to locations.
1509 Refer to the stacks thru separate pointers, to allow yyoverflow
1510 to reallocate them elsewhere. */
1512 /* The state stack. */
1513 yytype_int16 yyssa[YYINITDEPTH];
1514 yytype_int16 *yyss = yyssa;
1515 yytype_int16 *yyssp;
1517 /* The semantic value stack. */
1518 YYSTYPE yyvsa[YYINITDEPTH];
1519 YYSTYPE *yyvs = yyvsa;
1520 YYSTYPE *yyvsp;
1524 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1526 YYSIZE_T yystacksize = YYINITDEPTH;
1528 /* The variables used to return semantic value and location from the
1529 action routines. */
1530 YYSTYPE yyval;
1533 /* The number of symbols on the RHS of the reduced rule.
1534 Keep to zero when no symbol should be popped. */
1535 int yylen = 0;
1537 YYDPRINTF ((stderr, "Starting parse\n"));
1539 yystate = 0;
1540 yyerrstatus = 0;
1541 yynerrs = 0;
1542 yychar = YYEMPTY; /* Cause a token to be read. */
1544 /* Initialize stack pointers.
1545 Waste one element of value and location stack
1546 so that they stay on the same level as the state stack.
1547 The wasted elements are never initialized. */
1549 yyssp = yyss;
1550 yyvsp = yyvs;
1552 goto yysetstate;
1554 /*------------------------------------------------------------.
1555 | yynewstate -- Push a new state, which is found in yystate. |
1556 `------------------------------------------------------------*/
1557 yynewstate:
1558 /* In all cases, when you get here, the value and location stacks
1559 have just been pushed. So pushing a state here evens the stacks. */
1560 yyssp++;
1562 yysetstate:
1563 *yyssp = yystate;
1565 if (yyss + yystacksize - 1 <= yyssp)
1567 /* Get the current used size of the three stacks, in elements. */
1568 YYSIZE_T yysize = yyssp - yyss + 1;
1570 #ifdef yyoverflow
1572 /* Give user a chance to reallocate the stack. Use copies of
1573 these so that the &'s don't force the real ones into
1574 memory. */
1575 YYSTYPE *yyvs1 = yyvs;
1576 yytype_int16 *yyss1 = yyss;
1579 /* Each stack pointer address is followed by the size of the
1580 data in use in that stack, in bytes. This used to be a
1581 conditional around just the two extra args, but that might
1582 be undefined if yyoverflow is a macro. */
1583 yyoverflow (YY_("memory exhausted"),
1584 &yyss1, yysize * sizeof (*yyssp),
1585 &yyvs1, yysize * sizeof (*yyvsp),
1587 &yystacksize);
1589 yyss = yyss1;
1590 yyvs = yyvs1;
1592 #else /* no yyoverflow */
1593 # ifndef YYSTACK_RELOCATE
1594 goto yyexhaustedlab;
1595 # else
1596 /* Extend the stack our own way. */
1597 if (YYMAXDEPTH <= yystacksize)
1598 goto yyexhaustedlab;
1599 yystacksize *= 2;
1600 if (YYMAXDEPTH < yystacksize)
1601 yystacksize = YYMAXDEPTH;
1604 yytype_int16 *yyss1 = yyss;
1605 union yyalloc *yyptr =
1606 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1607 if (! yyptr)
1608 goto yyexhaustedlab;
1609 YYSTACK_RELOCATE (yyss);
1610 YYSTACK_RELOCATE (yyvs);
1612 # undef YYSTACK_RELOCATE
1613 if (yyss1 != yyssa)
1614 YYSTACK_FREE (yyss1);
1616 # endif
1617 #endif /* no yyoverflow */
1619 yyssp = yyss + yysize - 1;
1620 yyvsp = yyvs + yysize - 1;
1623 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1624 (unsigned long int) yystacksize));
1626 if (yyss + yystacksize - 1 <= yyssp)
1627 YYABORT;
1630 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1632 goto yybackup;
1634 /*-----------.
1635 | yybackup. |
1636 `-----------*/
1637 yybackup:
1639 /* Do appropriate processing given the current state. Read a
1640 look-ahead token if we need one and don't already have one. */
1642 /* First try to decide what to do without reference to look-ahead token. */
1643 yyn = yypact[yystate];
1644 if (yyn == YYPACT_NINF)
1645 goto yydefault;
1647 /* Not known => get a look-ahead token if don't already have one. */
1649 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1650 if (yychar == YYEMPTY)
1652 YYDPRINTF ((stderr, "Reading a token: "));
1653 yychar = YYLEX;
1656 if (yychar <= YYEOF)
1658 yychar = yytoken = YYEOF;
1659 YYDPRINTF ((stderr, "Now at end of input.\n"));
1661 else
1663 yytoken = YYTRANSLATE (yychar);
1664 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1667 /* If the proper action on seeing token YYTOKEN is to reduce or to
1668 detect an error, take that action. */
1669 yyn += yytoken;
1670 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1671 goto yydefault;
1672 yyn = yytable[yyn];
1673 if (yyn <= 0)
1675 if (yyn == 0 || yyn == YYTABLE_NINF)
1676 goto yyerrlab;
1677 yyn = -yyn;
1678 goto yyreduce;
1681 if (yyn == YYFINAL)
1682 YYACCEPT;
1684 /* Count tokens shifted since error; after three, turn off error
1685 status. */
1686 if (yyerrstatus)
1687 yyerrstatus--;
1689 /* Shift the look-ahead token. */
1690 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1692 /* Discard the shifted token unless it is eof. */
1693 if (yychar != YYEOF)
1694 yychar = YYEMPTY;
1696 yystate = yyn;
1697 *++yyvsp = yylval;
1699 goto yynewstate;
1702 /*-----------------------------------------------------------.
1703 | yydefault -- do the default action for the current state. |
1704 `-----------------------------------------------------------*/
1705 yydefault:
1706 yyn = yydefact[yystate];
1707 if (yyn == 0)
1708 goto yyerrlab;
1709 goto yyreduce;
1712 /*-----------------------------.
1713 | yyreduce -- Do a reduction. |
1714 `-----------------------------*/
1715 yyreduce:
1716 /* yyn is the number of a rule to reduce with. */
1717 yylen = yyr2[yyn];
1719 /* If YYLEN is nonzero, implement the default value of the action:
1720 `$$ = $1'.
1722 Otherwise, the following line sets YYVAL to garbage.
1723 This behavior is undocumented and Bison
1724 users should not rely upon it. Assigning to YYVAL
1725 unconditionally makes the parser a bit smaller, and it avoids a
1726 GCC warning that YYVAL may be used uninitialized. */
1727 yyval = yyvsp[1-yylen];
1730 YY_REDUCE_PRINT (yyn);
1731 switch (yyn)
1733 case 2:
1734 #line 141 "parser.y"
1736 /* The full program was parsed. Allocate and fill the final
1737 .scop structures. */
1738 int nb_parameters, nb_arrays;
1740 parser_scop->parameters = clan_symbol_id_array(parser_symbol,
1741 SCOPLIB_TYPE_PARAMETER,
1742 &nb_parameters);
1743 parser_scop->nb_parameters = nb_parameters;
1744 parser_scop->arrays = clan_symbol_id_array(parser_symbol,
1745 SCOPLIB_TYPE_ARRAY,
1746 &nb_arrays);
1747 parser_scop->nb_arrays = nb_arrays;
1748 if (parser_options->bounded_context)
1750 parser_scop->context = scoplib_matrix_malloc(nb_parameters,
1751 nb_parameters+2);
1752 int i;
1753 for (i = 0; i < nb_parameters; ++i)
1755 SCOPVAL_set_si(parser_scop->context->p[i][0], 1);
1756 SCOPVAL_set_si(parser_scop->context->p[i][i+1], 1);
1757 SCOPVAL_set_si(parser_scop->context->p[i][nb_parameters +1], 1);
1760 else
1761 parser_scop->context = scoplib_matrix_malloc(0,nb_parameters+2);
1763 break;
1765 case 11:
1766 #line 213 "parser.y"
1768 clan_symbol_p symbol;
1769 symbol = clan_symbol_add(&parser_symbol,(yyvsp[(3) - (3)].symbol),
1770 SCOPLIB_TYPE_ITERATOR,parser_depth+1);
1771 /* Ensure that the returned symbol was either a new one,
1772 either from the same type. */
1773 if (symbol->type != SCOPLIB_TYPE_ITERATOR)
1775 yyerror("[Clan] Error: the input file is not a SCoP\n"
1776 "\t> A loop iterator was previously used as a parameter"
1777 "\n");
1778 return 0;
1780 /* Update the rank, in case a symbol with the same name was
1781 already existing. */
1782 if (symbol->rank != parser_depth + 1)
1783 symbol->rank = parser_depth + 1;
1784 parser_iterators[parser_depth] = symbol;
1785 /* Memorize the current iterator as a negative constraint prefix */
1787 break;
1789 case 12:
1790 #line 235 "parser.y"
1792 scoplib_vector_p parser_i_term = clan_vector_term(parser_symbol,1,(yyvsp[(3) - (6)].symbol));
1793 scoplib_vector_tag_inequality(parser_i_term);
1794 int i, j;
1795 for (i = 0; i < (yyvsp[(6) - (6)].setex)->NbRows; ++i)
1797 for (j = 1; j < (yyvsp[(6) - (6)].setex)->NbColumns; ++j)
1798 SCOPVAL_oppose((yyvsp[(6) - (6)].setex)->p[i][j],(yyvsp[(6) - (6)].setex)->p[i][j]);
1799 scoplib_matrix_add_vector((yyvsp[(6) - (6)].setex),parser_i_term,i);
1801 scoplib_matrix_insert_matrix(parser_domain,(yyvsp[(6) - (6)].setex),parser_nb_cons);
1803 parser_nb_cons += (yyvsp[(6) - (6)].setex)->NbRows;
1804 parser_consperdim[parser_depth] += (yyvsp[(6) - (6)].setex)->NbRows;
1805 scoplib_vector_free(parser_i_term);
1806 free((yyvsp[(3) - (6)].symbol));
1807 scoplib_matrix_free((yyvsp[(6) - (6)].setex));
1809 break;
1811 case 13:
1812 #line 255 "parser.y"
1814 scoplib_matrix_insert_matrix(parser_domain,(yyvsp[(9) - (9)].setex),parser_nb_cons);
1815 parser_nb_cons += (yyvsp[(9) - (9)].setex)->NbRows;
1816 parser_consperdim[parser_depth] += (yyvsp[(9) - (9)].setex)->NbRows;
1818 break;
1820 case 14:
1821 #line 263 "parser.y"
1823 parser_depth++;
1824 parser_scheduling[parser_depth] = 0;
1826 break;
1828 case 15:
1829 #line 268 "parser.y"
1831 parser_depth--;
1832 parser_scheduling[parser_depth]++;
1833 parser_nb_cons -= parser_consperdim[parser_depth];
1834 parser_consperdim[parser_depth] = 0;
1835 clan_symbol_remove(&parser_symbol, parser_iterators[parser_depth]);
1837 break;
1839 case 16:
1840 #line 280 "parser.y"
1842 /* Insert the condition constraint in the current parser domain. */
1843 scoplib_matrix_insert_matrix(parser_domain,(yyvsp[(3) - (4)].setex),parser_nb_cons);
1844 parser_nb_cons += (yyvsp[(3) - (4)].setex)->NbRows;
1846 break;
1848 case 17:
1849 #line 286 "parser.y"
1851 parser_nb_cons -= (yyvsp[(3) - (6)].setex)->NbRows;
1852 /* Remove the condition constraint from the current parser domain. */
1853 int i, j;
1854 for (i = parser_nb_cons; i < parser_domain->NbRows - 1; ++i)
1855 for (j = 0; j < parser_domain->NbColumns; ++j)
1856 SCOPVAL_assign(parser_domain->p[i][j],parser_domain->p[i+1][j]);
1858 break;
1860 case 18:
1861 #line 298 "parser.y"
1863 parser_statement = scoplib_statement_malloc();
1864 parser_record = (char *)malloc(SCOPLIB_MAX_STRING * sizeof(char));
1865 parser_recording = CLAN_TRUE;
1866 /* Yacc needs Lex to read the next token to ensure we are starting
1867 * an assignment. So we keep track of the latest text Lex read
1868 * and we start the statement body with it.
1870 strcpy(parser_record,scanner_latest_text);
1872 break;
1874 case 19:
1875 #line 309 "parser.y"
1877 /* Deal with statements without surrounding loop by adding a
1878 fake iterator */
1879 int old_parser_depth = parser_depth;
1880 if (parser_depth == 0)
1882 char* fakeiter = strdup("fakeiter");
1883 clan_symbol_p symbol = clan_symbol_lookup(parser_symbol, fakeiter);
1884 if (symbol)
1885 free(fakeiter);
1886 else
1887 symbol = clan_symbol_add(&parser_symbol,fakeiter,
1888 SCOPLIB_TYPE_ITERATOR,parser_depth+1);
1889 parser_iterators[parser_depth] = symbol;
1890 scoplib_vector_p constraint =
1891 scoplib_vector_malloc(parser_domain->NbColumns);
1892 SCOPVAL_set_si(constraint->p[1],1);
1893 parser_depth++;
1894 scoplib_matrix_replace_vector(parser_domain,constraint,parser_nb_cons);
1895 parser_nb_cons++;
1896 scoplib_vector_free(constraint);
1898 /* Construct the statement structure from the parser state */
1899 parser_statement->domain = scoplib_matrix_list_malloc();
1900 parser_statement->domain->elt = scoplib_matrix_ncopy(parser_domain,
1901 parser_nb_cons);
1902 parser_statement->schedule = clan_matrix_scheduling(parser_scheduling,
1903 parser_depth);
1904 parser_statement->read = (yyvsp[(2) - (2)].rw)[0];
1905 parser_statement->write = (yyvsp[(2) - (2)].rw)[1];
1906 parser_statement->body = parser_record;
1907 parser_statement->nb_iterators = parser_depth;
1908 parser_statement->iterators = clan_symbol_iterators(parser_iterators,
1909 parser_depth);
1910 if (parser_statement->write == NULL)
1911 parser_statement->write =
1912 scoplib_matrix_malloc(0, parser_domain->NbColumns);
1913 if (parser_statement->read == NULL)
1914 parser_statement->read =
1915 scoplib_matrix_malloc(0, parser_domain->NbColumns);
1916 parser_recording = CLAN_FALSE;
1917 scoplib_statement_add(&(parser_scop->statement),parser_statement);
1918 /* We were parsing a statement without iterator. Restore the
1919 original state */
1920 if (old_parser_depth == 0)
1922 --parser_depth;
1923 --parser_nb_cons;
1924 parser_consperdim[parser_depth] = 0;
1926 parser_scheduling[parser_depth]++;
1928 break;
1930 case 20:
1931 #line 367 "parser.y"
1933 int i, j;
1934 scoplib_matrix_p m = (yyvsp[(2) - (2)].setex);
1935 for (i = 0; i < m->NbRows; ++i)
1937 int id = SCOPVAL_get_si(m->p[i][0]);
1938 for (j = 0; parser_variables_localvars[j] != -1 &&
1939 parser_variables_localvars[j] != id; ++j)
1941 if (j == CLAN_MAX_LOCAL_VARIABLES)
1943 yyerror("[Clan] Error: maximum number of local variables reached\n");
1944 return 0;
1946 if (parser_variables_localvars[j] == -1)
1947 parser_variables_localvars[j] = id;
1950 break;
1952 case 21:
1953 #line 391 "parser.y"
1955 int i, j;
1956 scoplib_matrix_p m = (yyvsp[(2) - (2)].setex);
1957 for (i = 0; i < m->NbRows; ++i)
1959 int id = SCOPVAL_get_si(m->p[i][0]);
1960 for (j = 0; parser_variables_liveout[j] != -1 &&
1961 parser_variables_liveout[j] != id; ++j)
1963 if (j == CLAN_MAX_LOCAL_VARIABLES)
1965 yyerror("[Clan] Error: maximum number of live-out variables reached\n");
1966 return 0;
1968 if (parser_variables_liveout[j] == -1)
1969 parser_variables_liveout[j] = id;
1972 break;
1974 case 22:
1975 #line 420 "parser.y"
1977 free((yyvsp[(1) - (2)].symbol));
1979 break;
1981 case 23:
1982 #line 424 "parser.y"
1984 free((yyvsp[(2) - (2)].symbol));
1986 break;
1988 case 24:
1989 #line 428 "parser.y"
1991 if ((yyvsp[(5) - (5)].value) != 1)
1993 yyerror("[Clan] Error: loop increment is not 1\n");
1994 return 0;
1996 free ((yyvsp[(1) - (5)].symbol));
1997 free ((yyvsp[(3) - (5)].symbol));
1999 break;
2001 case 25:
2002 #line 438 "parser.y"
2004 if ((yyvsp[(3) - (3)].value) != 1)
2006 yyerror("[Clan] Error: loop increment is not 1\n");
2007 return 0;
2009 free ((yyvsp[(1) - (3)].symbol));
2011 break;
2013 case 26:
2014 #line 456 "parser.y"
2016 (yyval.setex) = scoplib_matrix_from_vector((yyvsp[(1) - (1)].affex));
2017 scoplib_vector_free((yyvsp[(1) - (1)].affex));
2019 break;
2021 case 27:
2022 #line 462 "parser.y"
2024 (yyval.setex) = scoplib_matrix_concat((yyvsp[(3) - (6)].setex), (yyvsp[(5) - (6)].setex));
2026 break;
2028 case 28:
2029 #line 475 "parser.y"
2031 (yyval.setex) = scoplib_matrix_from_vector((yyvsp[(1) - (1)].affex));
2032 scoplib_vector_free((yyvsp[(1) - (1)].affex));
2034 break;
2036 case 29:
2037 #line 481 "parser.y"
2039 (yyval.setex) = scoplib_matrix_concat((yyvsp[(3) - (6)].setex), (yyvsp[(5) - (6)].setex));
2041 break;
2043 case 30:
2044 #line 494 "parser.y"
2046 (yyval.affex) = (yyvsp[(1) - (1)].affex);
2048 break;
2050 case 31:
2051 #line 498 "parser.y"
2053 (yyval.affex) = scoplib_vector_add((yyvsp[(1) - (3)].affex),(yyvsp[(3) - (3)].affex));
2054 scoplib_vector_free((yyvsp[(1) - (3)].affex));
2055 scoplib_vector_free((yyvsp[(3) - (3)].affex));
2057 break;
2059 case 32:
2060 #line 504 "parser.y"
2062 (yyval.affex) = scoplib_vector_sub((yyvsp[(1) - (3)].affex),(yyvsp[(3) - (3)].affex));
2063 scoplib_vector_free((yyvsp[(1) - (3)].affex));
2064 scoplib_vector_free((yyvsp[(3) - (3)].affex));
2066 break;
2068 case 33:
2069 #line 510 "parser.y"
2071 (yyval.affex) = (yyvsp[(2) - (3)].affex);
2073 break;
2075 case 34:
2076 #line 514 "parser.y"
2078 SCOPVAL_assign((yyvsp[(3) - (6)].affex)->p[0], (yyvsp[(5) - (6)].affex)->p[(yyvsp[(5) - (6)].affex)->Size - 1]);
2079 (yyval.affex) = (yyvsp[(3) - (6)].affex);
2081 break;
2083 case 35:
2084 #line 519 "parser.y"
2086 SCOPVAL_assign((yyvsp[(3) - (6)].affex)->p[0], (yyvsp[(5) - (6)].affex)->p[(yyvsp[(5) - (6)].affex)->Size - 1]);
2087 (yyval.affex) = (yyvsp[(3) - (6)].affex);
2089 break;
2091 case 36:
2092 #line 536 "parser.y"
2094 (yyval.affex) = clan_vector_term(parser_symbol,(yyvsp[(1) - (1)].value),NULL);
2096 break;
2098 case 37:
2099 #line 543 "parser.y"
2101 clan_symbol_add(&parser_symbol,(yyvsp[(1) - (1)].symbol),SCOPLIB_TYPE_UNKNOWN,parser_depth);
2102 (yyval.affex) = clan_vector_term(parser_symbol,1,(yyvsp[(1) - (1)].symbol));
2103 free((yyvsp[(1) - (1)].symbol));
2105 break;
2107 case 38:
2108 #line 552 "parser.y"
2110 (yyval.affex) = clan_vector_term(parser_symbol,-((yyvsp[(2) - (2)].value)),NULL);
2112 break;
2114 case 39:
2115 #line 559 "parser.y"
2117 clan_symbol_add(&parser_symbol,(yyvsp[(3) - (3)].symbol),SCOPLIB_TYPE_UNKNOWN,parser_depth);
2118 (yyval.affex) = clan_vector_term(parser_symbol,(yyvsp[(1) - (3)].value),(yyvsp[(3) - (3)].symbol));
2119 free((yyvsp[(3) - (3)].symbol));
2121 break;
2123 case 40:
2124 #line 568 "parser.y"
2126 clan_symbol_add(&parser_symbol,(yyvsp[(1) - (3)].symbol),SCOPLIB_TYPE_UNKNOWN,parser_depth);
2127 (yyval.affex) = clan_vector_term(parser_symbol,(yyvsp[(3) - (3)].value),(yyvsp[(1) - (3)].symbol));
2128 free((yyvsp[(1) - (3)].symbol));
2130 break;
2132 case 41:
2133 #line 577 "parser.y"
2135 (yyval.affex) = clan_vector_term(parser_symbol, ((yyvsp[(1) - (3)].value)) * ((yyvsp[(3) - (3)].value)), NULL);
2137 break;
2139 case 42:
2140 #line 584 "parser.y"
2142 (yyval.affex) = clan_vector_term(parser_symbol, ((yyvsp[(1) - (3)].value)) / ((yyvsp[(3) - (3)].value)), NULL);
2144 break;
2146 case 43:
2147 #line 591 "parser.y"
2149 clan_symbol_add(&parser_symbol,(yyvsp[(4) - (4)].symbol),SCOPLIB_TYPE_UNKNOWN,parser_depth);
2150 (yyval.affex) = clan_vector_term(parser_symbol,-((yyvsp[(2) - (4)].value)),(yyvsp[(4) - (4)].symbol));
2151 free((yyvsp[(4) - (4)].symbol));
2153 break;
2155 case 44:
2156 #line 600 "parser.y"
2158 clan_symbol_add(&parser_symbol,(yyvsp[(2) - (4)].symbol),SCOPLIB_TYPE_UNKNOWN,parser_depth);
2159 (yyval.affex) = clan_vector_term(parser_symbol,-((yyvsp[(4) - (4)].value)),(yyvsp[(2) - (4)].symbol));
2160 free((yyvsp[(2) - (4)].symbol));
2162 break;
2164 case 45:
2165 #line 609 "parser.y"
2167 clan_symbol_add(&parser_symbol,(yyvsp[(2) - (2)].symbol),SCOPLIB_TYPE_UNKNOWN,parser_depth);
2168 (yyval.affex) = clan_vector_term(parser_symbol,-1,(yyvsp[(2) - (2)].symbol));
2169 free((yyvsp[(2) - (2)].symbol));
2171 break;
2173 case 46:
2174 #line 629 "parser.y"
2176 /* a<b translates to -a+b-1>=0 */
2177 int i;
2178 scoplib_vector_p tmp = scoplib_vector_add_scalar((yyvsp[(1) - (3)].affex),1);
2179 scoplib_vector_tag_inequality(tmp);
2180 for (i = 0; i < (yyvsp[(3) - (3)].setex)->NbRows; ++i)
2182 /* We have parsed a ceild/floord at an earlier stage. */
2183 if (SCOPVAL_notzero_p((yyvsp[(3) - (3)].setex)->p[i][0]) && !SCOPVAL_one_p((yyvsp[(3) - (3)].setex)->p[i][0]))
2185 scoplib_int_t val; SCOPVAL_init(val);
2186 SCOPVAL_assign(val, (yyvsp[(3) - (3)].setex)->p[i][0]);
2187 SCOPVAL_set_si((yyvsp[(3) - (3)].setex)->p[i][0], 0);
2188 scoplib_vector_p tmp2 = scoplib_vector_add_scalar((yyvsp[(1) - (3)].affex),0);
2189 int j;
2190 for (j = 1; j < (yyvsp[(1) - (3)].affex)->Size; ++j)
2191 SCOPVAL_multo(tmp2->p[j], (yyvsp[(1) - (3)].affex)->p[j], val);
2192 scoplib_vector_p tmp3 = scoplib_vector_add_scalar(tmp2,1);
2193 scoplib_vector_tag_inequality(tmp3);
2194 scoplib_matrix_sub_vector((yyvsp[(3) - (3)].setex), tmp3, i);
2195 scoplib_vector_free(tmp2);
2196 scoplib_vector_free(tmp3);
2197 SCOPVAL_clear(val);
2199 else
2200 scoplib_matrix_sub_vector((yyvsp[(3) - (3)].setex), tmp, i);
2202 scoplib_vector_free((yyvsp[(1) - (3)].affex));
2203 scoplib_vector_free(tmp);
2204 (yyval.setex) = (yyvsp[(3) - (3)].setex);
2206 break;
2208 case 47:
2209 #line 664 "parser.y"
2211 /* a>b translates to a-b-1>=0 */
2212 int i, j;
2213 scoplib_vector_p tmp = scoplib_vector_add_scalar((yyvsp[(1) - (3)].affex),-1);
2214 scoplib_vector_tag_inequality(tmp);
2215 for (i = 0; i < (yyvsp[(3) - (3)].setex)->NbRows; ++i)
2217 for (j = 1; j < (yyvsp[(3) - (3)].setex)->NbColumns; ++j)
2218 SCOPVAL_oppose((yyvsp[(3) - (3)].setex)->p[i][j],(yyvsp[(3) - (3)].setex)->p[i][j]);
2219 /* We have parsed a ceild/floord at an earlier stage. */
2220 if (SCOPVAL_notzero_p((yyvsp[(3) - (3)].setex)->p[i][0]) && !SCOPVAL_one_p((yyvsp[(3) - (3)].setex)->p[i][0]))
2222 scoplib_int_t val; SCOPVAL_init(val);
2223 SCOPVAL_assign(val, (yyvsp[(3) - (3)].setex)->p[i][0]);
2224 SCOPVAL_set_si((yyvsp[(3) - (3)].setex)->p[i][0], 0);
2225 scoplib_vector_p tmp2 = scoplib_vector_add_scalar((yyvsp[(1) - (3)].affex),0);
2226 int j;
2227 for (j = 1; j < (yyvsp[(1) - (3)].affex)->Size; ++j)
2228 SCOPVAL_multo(tmp2->p[j], (yyvsp[(1) - (3)].affex)->p[j], val);
2229 scoplib_vector_p tmp3 = scoplib_vector_add_scalar(tmp2,-1);
2230 scoplib_vector_tag_inequality(tmp3);
2231 scoplib_matrix_add_vector((yyvsp[(3) - (3)].setex), tmp3, i);
2232 scoplib_vector_free(tmp2);
2233 scoplib_vector_free(tmp3);
2234 SCOPVAL_clear(val);
2236 else
2237 scoplib_matrix_add_vector((yyvsp[(3) - (3)].setex),tmp,i);
2239 scoplib_vector_free((yyvsp[(1) - (3)].affex));
2240 scoplib_vector_free(tmp);
2241 (yyval.setex) = (yyvsp[(3) - (3)].setex);
2243 break;
2245 case 48:
2246 #line 701 "parser.y"
2248 /* a<=b translates to -a+b>=0 */
2249 int i;
2250 scoplib_vector_p tmp = scoplib_vector_add_scalar((yyvsp[(1) - (3)].affex),0);
2251 scoplib_vector_tag_inequality(tmp);
2252 for (i = 0; i < (yyvsp[(3) - (3)].setex)->NbRows; ++i)
2254 /* We have parsed a ceild/floord at an earlier stage. */
2255 if (SCOPVAL_notzero_p((yyvsp[(3) - (3)].setex)->p[i][0]) && !SCOPVAL_one_p((yyvsp[(3) - (3)].setex)->p[i][0]))
2257 scoplib_int_t val; SCOPVAL_init(val);
2258 SCOPVAL_assign(val, (yyvsp[(3) - (3)].setex)->p[i][0]);
2259 SCOPVAL_set_si((yyvsp[(3) - (3)].setex)->p[i][0], 0);
2260 scoplib_vector_p tmp2 = scoplib_vector_add_scalar((yyvsp[(1) - (3)].affex),0);
2261 int j;
2262 for (j = 1; j < (yyvsp[(1) - (3)].affex)->Size; ++j)
2263 SCOPVAL_multo(tmp2->p[j], (yyvsp[(1) - (3)].affex)->p[j], val);
2264 scoplib_vector_tag_inequality(tmp2);
2265 scoplib_matrix_sub_vector((yyvsp[(3) - (3)].setex), tmp2, i);
2266 scoplib_vector_free(tmp2);
2267 SCOPVAL_clear(val);
2269 else
2270 scoplib_matrix_sub_vector((yyvsp[(3) - (3)].setex),tmp,i);
2272 scoplib_vector_free((yyvsp[(1) - (3)].affex));
2273 scoplib_vector_free(tmp);
2274 (yyval.setex) = (yyvsp[(3) - (3)].setex);
2276 break;
2278 case 49:
2279 #line 734 "parser.y"
2281 /* a>=b translates to a-b>=0 */
2282 int i, j;
2283 scoplib_vector_p tmp = scoplib_vector_add_scalar((yyvsp[(1) - (3)].affex),0);
2284 scoplib_vector_tag_inequality(tmp);
2285 for (i = 0; i < (yyvsp[(3) - (3)].setex)->NbRows; ++i)
2287 for (j = 1; j < (yyvsp[(3) - (3)].setex)->NbColumns; ++j)
2288 SCOPVAL_oppose((yyvsp[(3) - (3)].setex)->p[i][j],(yyvsp[(3) - (3)].setex)->p[i][j]);
2289 /* We have parsed a ceild/floord at an earlier stage. */
2290 if (SCOPVAL_notzero_p((yyvsp[(3) - (3)].setex)->p[i][0]) && !SCOPVAL_one_p((yyvsp[(3) - (3)].setex)->p[i][0]))
2292 scoplib_int_t val; SCOPVAL_init(val);
2293 SCOPVAL_assign(val, (yyvsp[(3) - (3)].setex)->p[i][0]);
2294 SCOPVAL_set_si((yyvsp[(3) - (3)].setex)->p[i][0], 0);
2295 scoplib_vector_p tmp2 = scoplib_vector_add_scalar((yyvsp[(1) - (3)].affex),0);
2296 int j;
2297 for (j = 1; j < (yyvsp[(1) - (3)].affex)->Size; ++j)
2298 SCOPVAL_multo(tmp2->p[j], (yyvsp[(1) - (3)].affex)->p[j], val);
2299 scoplib_vector_tag_inequality(tmp2);
2300 scoplib_matrix_add_vector((yyvsp[(3) - (3)].setex), tmp2, i);
2301 scoplib_vector_free(tmp2);
2302 SCOPVAL_clear(val);
2304 else
2305 scoplib_matrix_add_vector((yyvsp[(3) - (3)].setex),tmp,i);
2307 scoplib_vector_free((yyvsp[(1) - (3)].affex));
2308 scoplib_vector_free(tmp);
2309 (yyval.setex) = (yyvsp[(3) - (3)].setex);
2311 break;
2313 case 50:
2314 #line 769 "parser.y"
2316 /* a==b translates to a-b==0 */
2317 /* Warning: cases like ceild(M,32) == ceild(N,32) are not handled.
2318 Assert if we encounter such a case. */
2319 assert ((SCOPVAL_zero_p((yyvsp[(1) - (3)].affex)->p[0]) || SCOPVAL_one_p((yyvsp[(1) - (3)].affex)->p[0]))
2320 && (SCOPVAL_zero_p((yyvsp[(3) - (3)].affex)->p[0]) || SCOPVAL_one_p((yyvsp[(3) - (3)].affex)->p[0])));
2321 scoplib_vector_p res = scoplib_vector_sub((yyvsp[(1) - (3)].affex),(yyvsp[(3) - (3)].affex));
2322 scoplib_vector_tag_equality(res);
2323 (yyval.setex) = scoplib_matrix_from_vector(res);
2324 scoplib_vector_free(res);
2325 scoplib_vector_free((yyvsp[(1) - (3)].affex));
2326 scoplib_vector_free((yyvsp[(3) - (3)].affex));
2328 break;
2330 case 51:
2331 #line 786 "parser.y"
2333 (yyval.setex) = (yyvsp[(2) - (3)].setex);
2335 break;
2337 case 52:
2338 #line 793 "parser.y"
2340 (yyval.setex) = scoplib_matrix_concat((yyvsp[(1) - (3)].setex),(yyvsp[(3) - (3)].setex));
2341 scoplib_matrix_free((yyvsp[(1) - (3)].setex));
2342 scoplib_matrix_free((yyvsp[(3) - (3)].setex));
2344 break;
2346 case 63:
2347 #line 837 "parser.y"
2349 if ((yyvsp[(1) - (4)].setex) == NULL)
2351 yyerror ("[Clan] Error: changing value of iterator/parameter");
2352 return 0;
2354 (yyval.rw)[0] = (yyvsp[(3) - (4)].setex);
2355 (yyval.rw)[1] = (yyvsp[(1) - (4)].setex);
2357 break;
2359 case 64:
2360 #line 850 "parser.y"
2362 if ((yyvsp[(1) - (4)].setex) == NULL)
2364 yyerror ("[Clan] Error: changing value of iterator/parameter");
2365 return 0;
2367 (yyval.rw)[0] = scoplib_matrix_concat((yyvsp[(1) - (4)].setex),(yyvsp[(3) - (4)].setex));
2368 scoplib_matrix_free((yyvsp[(3) - (4)].setex));
2369 (yyval.rw)[1] = (yyvsp[(1) - (4)].setex);
2371 break;
2373 case 65:
2374 #line 864 "parser.y"
2376 if ((yyvsp[(1) - (3)].setex) == NULL)
2378 yyerror ("[Clan] Error: changing value of iterator/parameter");
2379 return 0;
2381 (yyval.rw)[0] = (yyvsp[(1) - (3)].setex);
2382 (yyval.rw)[1] = scoplib_matrix_copy((yyvsp[(1) - (3)].setex));
2384 break;
2386 case 66:
2387 #line 877 "parser.y"
2389 if ((yyvsp[(2) - (3)].setex) == NULL)
2391 yyerror ("[Clan] Error: changing value of iterator/parameter");
2392 return 0;
2394 (yyval.rw)[0] = (yyvsp[(2) - (3)].setex);
2395 (yyval.rw)[1] = scoplib_matrix_copy((yyvsp[(2) - (3)].setex));
2397 break;
2399 case 67:
2400 #line 890 "parser.y"
2402 (yyval.rw)[0] = (yyvsp[(1) - (2)].setex);
2403 (yyval.rw)[1] = NULL;
2405 break;
2407 case 68:
2408 #line 898 "parser.y"
2410 (yyval.rw)[0] = (yyvsp[(2) - (3)].rw)[0];
2411 (yyval.rw)[1] = (yyvsp[(2) - (3)].rw)[1];
2413 break;
2415 case 82:
2416 #line 934 "parser.y"
2418 (yyval.setex) = NULL;
2420 break;
2422 case 83:
2423 #line 941 "parser.y"
2425 (yyval.setex) = NULL;
2427 break;
2429 case 84:
2430 #line 948 "parser.y"
2432 (yyval.setex) = (yyvsp[(1) - (1)].setex);
2434 break;
2436 case 85:
2437 #line 956 "parser.y"
2439 (yyval.setex) = scoplib_matrix_concat((yyvsp[(1) - (3)].setex),(yyvsp[(3) - (3)].setex));
2440 scoplib_matrix_free((yyvsp[(1) - (3)].setex));
2441 scoplib_matrix_free((yyvsp[(3) - (3)].setex));
2443 break;
2445 case 86:
2446 #line 965 "parser.y"
2448 (yyval.setex) = (yyvsp[(2) - (2)].setex);
2450 break;
2452 case 87:
2453 #line 972 "parser.y"
2455 (yyval.setex) = (yyvsp[(2) - (3)].setex);
2457 break;
2459 case 88:
2460 #line 979 "parser.y"
2462 scoplib_matrix_p tmp = scoplib_matrix_concat((yyvsp[(1) - (5)].setex),(yyvsp[(3) - (5)].setex));
2463 (yyval.setex) = scoplib_matrix_concat(tmp,(yyvsp[(5) - (5)].setex));
2464 scoplib_matrix_free(tmp);
2465 scoplib_matrix_free((yyvsp[(1) - (5)].setex));
2466 scoplib_matrix_free((yyvsp[(3) - (5)].setex));
2467 scoplib_matrix_free((yyvsp[(5) - (5)].setex));
2469 break;
2471 case 89:
2472 #line 1001 "parser.y"
2474 int rank;
2475 scoplib_matrix_p matrix;
2476 char* s = (char*) (yyvsp[(1) - (1)].symbol);
2477 clan_symbol_p symbol = clan_symbol_lookup(parser_symbol, s);
2478 // If the variable is an iterator or a parameter, discard it
2479 // from the read/write clause.
2480 if ((symbol && symbol->type == SCOPLIB_TYPE_ITERATOR) ||
2481 (symbol && symbol->type == SCOPLIB_TYPE_PARAMETER))
2482 (yyval.setex) = NULL;
2483 else
2485 clan_symbol_add(&parser_symbol, s, SCOPLIB_TYPE_ARRAY,parser_depth);
2486 rank = clan_symbol_get_rank(parser_symbol, s);
2487 matrix = scoplib_matrix_malloc
2488 (1, CLAN_MAX_DEPTH + CLAN_MAX_PARAMETERS + 2);
2489 clan_matrix_tag_array(matrix, rank);
2490 (yyval.setex) = matrix;
2492 free((yyvsp[(1) - (1)].symbol));
2494 break;
2496 case 90:
2497 #line 1027 "parser.y"
2499 int rank;
2500 clan_symbol_add(&parser_symbol,(yyvsp[(1) - (2)].symbol),SCOPLIB_TYPE_ARRAY,parser_depth);
2501 rank = clan_symbol_get_rank(parser_symbol,(yyvsp[(1) - (2)].symbol));
2502 clan_matrix_tag_array((yyvsp[(2) - (2)].setex),rank);
2503 (yyval.setex) = (yyvsp[(2) - (2)].setex);
2504 free((yyvsp[(1) - (2)].symbol));
2506 break;
2508 case 91:
2509 #line 1040 "parser.y"
2511 (yyval.setex) = (yyvsp[(3) - (4)].setex);
2512 free((yyvsp[(1) - (4)].symbol));
2514 break;
2516 case 92:
2517 #line 1048 "parser.y"
2519 (yyval.setex) = (yyvsp[(2) - (2)].setex);
2521 break;
2523 case 93:
2524 #line 1055 "parser.y"
2526 (yyval.setex) = (yyvsp[(2) - (2)].setex);
2528 break;
2530 case 100:
2531 #line 1083 "parser.y"
2533 (yyval.setex) = (yyvsp[(1) - (1)].setex);
2535 break;
2537 case 101:
2538 #line 1090 "parser.y"
2540 (yyval.setex) = scoplib_matrix_concat((yyvsp[(1) - (3)].setex),(yyvsp[(3) - (3)].setex));
2542 break;
2544 case 102:
2545 #line 1097 "parser.y"
2547 (yyval.setex) = (yyvsp[(1) - (3)].setex);
2549 break;
2551 case 103:
2552 #line 1104 "parser.y"
2554 (yyval.setex) = NULL;
2556 break;
2558 case 104:
2559 #line 1111 "parser.y"
2561 (yyval.setex) = NULL;
2563 break;
2565 case 105:
2566 #line 1127 "parser.y"
2568 (yyval.setex) = scoplib_matrix_from_vector((yyvsp[(2) - (3)].affex));
2569 scoplib_vector_free((yyvsp[(2) - (3)].affex));
2571 break;
2573 case 106:
2574 #line 1135 "parser.y"
2576 if ((yyvsp[(1) - (4)].setex) != NULL)
2577 scoplib_matrix_insert_vector((yyvsp[(1) - (4)].setex),(yyvsp[(3) - (4)].affex),(yyvsp[(1) - (4)].setex)->NbRows);
2578 scoplib_vector_free((yyvsp[(3) - (4)].affex));
2579 (yyval.setex) = (yyvsp[(1) - (4)].setex);
2581 break;
2583 case 107:
2584 #line 1156 "parser.y"
2586 (yyval.symbol) = (yyvsp[(1) - (1)].symbol);
2588 break;
2590 case 108:
2591 #line 1163 "parser.y"
2593 (yyval.symbol) = (yyvsp[(2) - (3)].symbol);
2595 break;
2597 case 109:
2598 #line 1170 "parser.y"
2600 (yyval.symbol) = (yyvsp[(2) - (2)].symbol);
2602 break;
2604 case 110:
2605 #line 1177 "parser.y"
2607 (yyval.symbol) = NULL;
2609 break;
2612 /* Line 1267 of yacc.c. */
2613 #line 2614 "parser.c"
2614 default: break;
2616 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2618 YYPOPSTACK (yylen);
2619 yylen = 0;
2620 YY_STACK_PRINT (yyss, yyssp);
2622 *++yyvsp = yyval;
2625 /* Now `shift' the result of the reduction. Determine what state
2626 that goes to, based on the state we popped back to and the rule
2627 number reduced by. */
2629 yyn = yyr1[yyn];
2631 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2632 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2633 yystate = yytable[yystate];
2634 else
2635 yystate = yydefgoto[yyn - YYNTOKENS];
2637 goto yynewstate;
2640 /*------------------------------------.
2641 | yyerrlab -- here on detecting error |
2642 `------------------------------------*/
2643 yyerrlab:
2644 /* If not already recovering from an error, report this error. */
2645 if (!yyerrstatus)
2647 ++yynerrs;
2648 #if ! YYERROR_VERBOSE
2649 yyerror (YY_("syntax error"));
2650 #else
2652 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2653 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2655 YYSIZE_T yyalloc = 2 * yysize;
2656 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2657 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2658 if (yymsg != yymsgbuf)
2659 YYSTACK_FREE (yymsg);
2660 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2661 if (yymsg)
2662 yymsg_alloc = yyalloc;
2663 else
2665 yymsg = yymsgbuf;
2666 yymsg_alloc = sizeof yymsgbuf;
2670 if (0 < yysize && yysize <= yymsg_alloc)
2672 (void) yysyntax_error (yymsg, yystate, yychar);
2673 yyerror (yymsg);
2675 else
2677 yyerror (YY_("syntax error"));
2678 if (yysize != 0)
2679 goto yyexhaustedlab;
2682 #endif
2687 if (yyerrstatus == 3)
2689 /* If just tried and failed to reuse look-ahead token after an
2690 error, discard it. */
2692 if (yychar <= YYEOF)
2694 /* Return failure if at end of input. */
2695 if (yychar == YYEOF)
2696 YYABORT;
2698 else
2700 yydestruct ("Error: discarding",
2701 yytoken, &yylval);
2702 yychar = YYEMPTY;
2706 /* Else will try to reuse look-ahead token after shifting the error
2707 token. */
2708 goto yyerrlab1;
2711 /*---------------------------------------------------.
2712 | yyerrorlab -- error raised explicitly by YYERROR. |
2713 `---------------------------------------------------*/
2714 yyerrorlab:
2716 /* Pacify compilers like GCC when the user code never invokes
2717 YYERROR and the label yyerrorlab therefore never appears in user
2718 code. */
2719 if (/*CONSTCOND*/ 0)
2720 goto yyerrorlab;
2722 /* Do not reclaim the symbols of the rule which action triggered
2723 this YYERROR. */
2724 YYPOPSTACK (yylen);
2725 yylen = 0;
2726 YY_STACK_PRINT (yyss, yyssp);
2727 yystate = *yyssp;
2728 goto yyerrlab1;
2731 /*-------------------------------------------------------------.
2732 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2733 `-------------------------------------------------------------*/
2734 yyerrlab1:
2735 yyerrstatus = 3; /* Each real token shifted decrements this. */
2737 for (;;)
2739 yyn = yypact[yystate];
2740 if (yyn != YYPACT_NINF)
2742 yyn += YYTERROR;
2743 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2745 yyn = yytable[yyn];
2746 if (0 < yyn)
2747 break;
2751 /* Pop the current state because it cannot handle the error token. */
2752 if (yyssp == yyss)
2753 YYABORT;
2756 yydestruct ("Error: popping",
2757 yystos[yystate], yyvsp);
2758 YYPOPSTACK (1);
2759 yystate = *yyssp;
2760 YY_STACK_PRINT (yyss, yyssp);
2763 if (yyn == YYFINAL)
2764 YYACCEPT;
2766 *++yyvsp = yylval;
2769 /* Shift the error token. */
2770 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2772 yystate = yyn;
2773 goto yynewstate;
2776 /*-------------------------------------.
2777 | yyacceptlab -- YYACCEPT comes here. |
2778 `-------------------------------------*/
2779 yyacceptlab:
2780 yyresult = 0;
2781 goto yyreturn;
2783 /*-----------------------------------.
2784 | yyabortlab -- YYABORT comes here. |
2785 `-----------------------------------*/
2786 yyabortlab:
2787 yyresult = 1;
2788 goto yyreturn;
2790 #ifndef yyoverflow
2791 /*-------------------------------------------------.
2792 | yyexhaustedlab -- memory exhaustion comes here. |
2793 `-------------------------------------------------*/
2794 yyexhaustedlab:
2795 yyerror (YY_("memory exhausted"));
2796 yyresult = 2;
2797 /* Fall through. */
2798 #endif
2800 yyreturn:
2801 if (yychar != YYEOF && yychar != YYEMPTY)
2802 yydestruct ("Cleanup: discarding lookahead",
2803 yytoken, &yylval);
2804 /* Do not reclaim the symbols of the rule which action triggered
2805 this YYABORT or YYACCEPT. */
2806 YYPOPSTACK (yylen);
2807 YY_STACK_PRINT (yyss, yyssp);
2808 while (yyssp != yyss)
2810 yydestruct ("Cleanup: popping",
2811 yystos[*yyssp], yyvsp);
2812 YYPOPSTACK (1);
2814 #ifndef yyoverflow
2815 if (yyss != yyssa)
2816 YYSTACK_FREE (yyss);
2817 #endif
2818 #if YYERROR_VERBOSE
2819 if (yymsg != yymsgbuf)
2820 YYSTACK_FREE (yymsg);
2821 #endif
2822 /* Make sure YYID is used. */
2823 return YYID (yyresult);
2827 #line 1189 "parser.y"
2831 void
2832 yyerror(char *s)
2834 fprintf(stderr, "%s\n", s);
2835 clan_parse_error = 1;
2840 * clan_parser_initialize_state function:
2841 * this function achieves the initialization of the "parser state": a
2842 * collection of variables that vary during the parsing and thanks to we
2843 * can extract all SCoP informations.
2845 * - 02/05/2008: First version.
2847 void
2848 clan_parser_initialize_state(clan_options_p options)
2850 int i, nb_rows, nb_columns, depth;
2852 nb_rows = CLAN_MAX_CONSTRAINTS;
2853 nb_columns = CLAN_MAX_DEPTH + CLAN_MAX_PARAMETERS + 2;
2854 depth = CLAN_MAX_DEPTH;
2856 parser_scop = scoplib_scop_malloc();
2857 parser_domain = scoplib_matrix_malloc(nb_rows,nb_columns);
2858 parser_symbol = NULL;
2860 parser_scheduling = (int *)malloc(depth * sizeof(int));
2861 parser_consperdim = (int *)malloc(depth * sizeof(int));
2862 for (i = 0; i < depth; i++)
2864 parser_scheduling[i] = 0;
2865 parser_consperdim[i] = 0;
2867 parser_iterators = (clan_symbol_p *)malloc(depth * sizeof(clan_symbol_p));
2868 parser_variables_localvars =
2869 (int*)malloc((CLAN_MAX_LOCAL_VARIABLES + 1) * sizeof(int));
2870 parser_variables_liveout =
2871 (int*)malloc((CLAN_MAX_LOCAL_VARIABLES + 1) * sizeof(int));
2872 parser_depth = 0;
2873 parser_nb_cons = 0;
2874 /* Reset also the Symbol global variables. */
2875 extern int symbol_nb_iterators;
2876 symbol_nb_iterators = 0;
2877 extern int symbol_nb_parameters;
2878 symbol_nb_parameters = 0;
2879 extern int symbol_nb_arrays;
2880 symbol_nb_arrays = 0;
2881 extern int symbol_nb_functions;
2882 symbol_nb_functions = 0;
2884 for (i = 0; i <= CLAN_MAX_LOCAL_VARIABLES; ++i)
2885 parser_variables_localvars[i] = -1;
2886 for (i = 0; i <= CLAN_MAX_LOCAL_VARIABLES; ++i)
2887 parser_variables_liveout[i] = -1;
2889 parser_options = options;
2893 * clan_parser_free_state function:
2894 * this function frees the memory allocated for the "parser state", except
2895 * for parser_scop, obviously.
2897 * - 02/05/2008: First version.
2899 void
2900 clan_parser_free_state()
2902 scoplib_matrix_free(parser_domain);
2903 clan_symbol_free(parser_symbol);
2904 free(parser_scheduling);
2905 free(parser_consperdim);
2906 free(parser_iterators);
2907 free(parser_variables_localvars);
2908 free(parser_variables_liveout);
2912 * clan_parse function:
2913 * this function parses a file to extract a SCoP and returns, if successful,
2914 * a pointer to the scoplib_scop_t structure.
2915 * \param input The file to parse (already open).
2916 * \param options Options for file parsing.
2918 * - 01/05/2008: First version.
2920 scoplib_scop_p
2921 clan_parse(FILE * input, clan_options_p options)
2923 yyin = input;
2925 clan_parser_initialize_state(options);
2927 yyparse();
2929 fclose(yyin);
2930 if (! clan_parse_error)
2932 if (parser_variables_localvars[0] != -1 ||
2933 parser_variables_liveout[0] != -1)
2934 clan_scop_fill_options(parser_scop, parser_variables_localvars,
2935 parser_variables_liveout);
2936 clan_scop_compact(parser_scop);
2938 else
2939 parser_scop = NULL;
2940 clan_parser_free_state();
2942 return parser_scop;