y.tab.c
Description du code
y.tab.c est un fichier du projet Compilateur LSD010.Ce fichier est situé dans /var/www/bin/sniplets/lsd010/.
Projet Compilateur LSD010 :
Compilateur LSD010 développé dans le cadre du cours de syntaxe et sémantiqueref 1
Code source ou contenu du fichier
Code c (y.tab.c) (2939 lignes)
/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Using locations. */ #define YYLSP_NEEDED 1 /* Copy the first part of user declarations. */ /* Line 189 of yacc.c */ #line 1 "lsd10.y" /* * lsd10.y : lexical parsing file for Bison * Part of the compiler project for LSD10 language * Gaudry Stéphane * More information on http://www.gaudry.be/langages-yacc.html */ #include <stdio.h> #include <stdlib.h> #if(VERBOSE_LEVEL<=DEB_E) #include <errno.h> #endif #if(VERBOSE_LEVEL<=DEB_EXEC) #include <time.h> #endif #include <sys/types.h> #include <dirent.h> #include "common.h" #ifdef WIN32 #define FILE_SEPARATLEXICAL_OR "\\" #else #define FILE_SEPARATLEXICAL_OR "/" #endif extern int lexLinesCount; //extern int lexCharsLineCountBeforeToken; extern int lexTotalCharsCount; extern char* yytext; extern int *yylineno; extern FILE *yyin; /** * Position of a detected error */ DebugInfo *debugInfo; AstNode *rootNode; // to avoid 'implicit definition' int yylex(void); int yyerror(char *str); /* Line 189 of yacc.c */ #line 118 "y.tab.c" /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 1 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { LEXICAL_BOOLEAN_TYPE = 258, LEXICAL_INTEGER_TYPE = 259, LEXICAL_VOID_TYPE = 260, LEXICAL_INSTACK_TYPE = 261, NUMBER = 262, LEXICAL_TRUE_VAL = 263, LEXICAL_FALSE_VAL = 264, LEXICAL_AND = 265, LEXICAL_OR = 266, LEXICAL_ANDLAZY = 267, LEXICAL_ORLAZY = 268, LEXICAL_NOT = 269, LEXICAL_EQUALS = 270, LEXICAL_LESS_EQUALS = 271, LEXICAL_LESS = 272, LEXICAL_AFFECTATION = 273, LEXICAL_PLUS = 274, LEXICAL_MINUS = 275, LEXICAL_MULT = 276, LEXICAL_DIV = 277, LEXICAL_MOD = 278, L_PARENTHESIS = 279, LSQUI_BRACKET = 280, LSQUA_BRACKET = 281, POINT = 282, RSQUA_BRACKET = 283, R_PARENTHESIS = 284, RSQUI_BRACKET = 285, LEXICAL_GET_OPS = 286, LEXICAL_ISEMPTY_OPS = 287, LEXICAL_WRITE_OPS = 288, LEXICAL_READ_OPS = 289, LEXICAL_PUT_OPS = 290, LEXICAL_RETURN_STMT = 291, LEXICAL_IF_STMT = 292, LEXICAL_ELSE_STMT = 293, LEXICAL_WHILE_STMT = 294, LEXICAL_FLEXICAL_OR_STMT = 295, COLON = 296, SEMICOLON = 297, COMMA = 298, LEXICAL_VAR = 299, ID = 300 }; #endif /* Tokens. */ #define LEXICAL_BOOLEAN_TYPE 258 #define LEXICAL_INTEGER_TYPE 259 #define LEXICAL_VOID_TYPE 260 #define LEXICAL_INSTACK_TYPE 261 #define NUMBER 262 #define LEXICAL_TRUE_VAL 263 #define LEXICAL_FALSE_VAL 264 #define LEXICAL_AND 265 #define LEXICAL_OR 266 #define LEXICAL_ANDLAZY 267 #define LEXICAL_ORLAZY 268 #define LEXICAL_NOT 269 #define LEXICAL_EQUALS 270 #define LEXICAL_LESS_EQUALS 271 #define LEXICAL_LESS 272 #define LEXICAL_AFFECTATION 273 #define LEXICAL_PLUS 274 #define LEXICAL_MINUS 275 #define LEXICAL_MULT 276 #define LEXICAL_DIV 277 #define LEXICAL_MOD 278 #define L_PARENTHESIS 279 #define LSQUI_BRACKET 280 #define LSQUA_BRACKET 281 #define POINT 282 #define RSQUA_BRACKET 283 #define R_PARENTHESIS 284 #define RSQUI_BRACKET 285 #define LEXICAL_GET_OPS 286 #define LEXICAL_ISEMPTY_OPS 287 #define LEXICAL_WRITE_OPS 288 #define LEXICAL_READ_OPS 289 #define LEXICAL_PUT_OPS 290 #define LEXICAL_RETURN_STMT 291 #define LEXICAL_IF_STMT 292 #define LEXICAL_ELSE_STMT 293 #define LEXICAL_WHILE_STMT 294 #define LEXICAL_FLEXICAL_OR_STMT 295 #define COLON 296 #define SEMICOLON 297 #define COMMA 298 #define LEXICAL_VAR 299 #define ID 300 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 214 of yacc.c */ #line 45 "lsd10.y" int nval; char *text; struct astNode *node; /* Line 214 of yacc.c */ #line 252 "y.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; } YYLTYPE; # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 264 of yacc.c */ #line 277 "y.tab.c" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int yyi) #else static int YYID (yyi) int yyi; #endif { return yyi; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 8 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 340 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 46 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 21 /* YYNRULES -- Number of rules. */ #define YYNRULES 70 /* YYNRULES -- Number of states. */ #define YYNSTATES 175 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 300 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 5, 6, 9, 16, 23, 24, 27, 34, 38, 43, 46, 47, 50, 52, 54, 56, 60, 62, 63, 67, 70, 72, 74, 76, 81, 86, 89, 93, 97, 101, 105, 107, 109, 114, 119, 123, 127, 131, 135, 139, 143, 147, 151, 155, 157, 162, 166, 168, 171, 173, 178, 182, 184, 187, 188, 190, 193, 198, 200, 202, 204, 210, 216, 224, 230, 242, 250, 262 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 47, 0, -1, 48, -1, -1, 49, 48, -1, 55, 45, 24, 56, 29, 50, -1, 25, 25, 51, 30, 62, 30, -1, -1, 52, 51, -1, 5, 45, 24, 56, 29, 50, -1, 58, 45, 53, -1, 24, 56, 29, 50, -1, 54, 42, -1, -1, 45, 54, -1, 3, -1, 4, -1, 5, -1, 57, 43, 56, -1, 57, -1, -1, 44, 58, 45, -1, 58, 45, -1, 3, -1, 4, -1, 6, -1, 4, 26, 7, 28, -1, 3, 26, 7, 28, -1, 14, 59, -1, 59, 10, 59, -1, 59, 11, 59, -1, 59, 12, 59, -1, 59, 13, 59, -1, 8, -1, 9, -1, 32, 24, 45, 29, -1, 31, 24, 45, 29, -1, 59, 15, 59, -1, 59, 16, 59, -1, 59, 17, 59, -1, 59, 19, 59, -1, 59, 20, 59, -1, 59, 21, 59, -1, 59, 22, 59, -1, 59, 23, 59, -1, 24, 59, 29, -1, 60, -1, 45, 24, 61, 29, -1, 45, 24, 29, -1, 7, -1, 20, 7, -1, 45, -1, 45, 26, 59, 28, -1, 59, 43, 61, -1, 59, -1, 63, 62, -1, -1, 42, -1, 59, 42, -1, 60, 18, 59, 42, -1, 66, -1, 65, -1, 64, -1, 33, 24, 59, 29, 42, -1, 34, 24, 60, 29, 42, -1, 35, 24, 45, 43, 59, 29, 42, -1, 36, 24, 59, 29, 42, -1, 40, 24, 62, 41, 59, 41, 62, 29, 25, 62, 30, -1, 39, 24, 59, 29, 25, 62, 30, -1, 37, 24, 59, 29, 25, 62, 30, 38, 25, 62, 30, -1, 37, 24, 59, 29, 25, 62, 30, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 83, 83, 89, 90, 110, 119, 140, 143, 160, 165, 193, 196, 202, 203, 209, 215, 221, 230, 233, 236, 240, 247, 258, 264, 270, 276, 282, 291, 296, 300, 304, 308, 312, 316, 320, 327, 334, 341, 349, 356, 363, 370, 377, 384, 391, 397, 403, 409, 415, 418, 427, 433, 440, 443, 450, 464, 468, 474, 480, 484, 490, 496, 502, 508, 514, 525, 533, 546, 553, 570 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "LEXICAL_BOOLEAN_TYPE", "LEXICAL_INTEGER_TYPE", "LEXICAL_VOID_TYPE", "LEXICAL_INSTACK_TYPE", "NUMBER", "LEXICAL_TRUE_VAL", "LEXICAL_FALSE_VAL", "LEXICAL_AND", "LEXICAL_OR", "LEXICAL_ANDLAZY", "LEXICAL_ORLAZY", "LEXICAL_NOT", "LEXICAL_EQUALS", "LEXICAL_LESS_EQUALS", "LEXICAL_LESS", "LEXICAL_AFFECTATION", "LEXICAL_PLUS", "LEXICAL_MINUS", "LEXICAL_MULT", "LEXICAL_DIV", "LEXICAL_MOD", "L_PARENTHESIS", "LSQUI_BRACKET", "LSQUA_BRACKET", "POINT", "RSQUA_BRACKET", "R_PARENTHESIS", "RSQUI_BRACKET", "LEXICAL_GET_OPS", "LEXICAL_ISEMPTY_OPS", "LEXICAL_WRITE_OPS", "LEXICAL_READ_OPS", "LEXICAL_PUT_OPS", "LEXICAL_RETURN_STMT", "LEXICAL_IF_STMT", "LEXICAL_ELSE_STMT", "LEXICAL_WHILE_STMT", "LEXICAL_FLEXICAL_OR_STMT", "COLON", "SEMICOLON", "COMMA", "LEXICAL_VAR", "ID", "$accept", "Prg", "Functions", "Function", "PostFixeFunction", "Declarations", "Declaration", "FuncOrVar", "VarIds", "FunctionType", "ParamList", "ArgDeclaration", "VarType", "RExpr", "LExpr", "ParamList_FunctionCall", "Statements", "Statement", "iteration_for", "iteration_while", "if_instruction", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 46, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 65, 66, 66 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 0, 2, 6, 6, 0, 2, 6, 3, 4, 2, 0, 2, 1, 1, 1, 3, 1, 0, 3, 2, 1, 1, 1, 4, 4, 2, 3, 3, 3, 3, 1, 1, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 4, 3, 1, 2, 1, 4, 3, 1, 2, 0, 1, 2, 4, 1, 1, 1, 5, 5, 7, 5, 11, 7, 11, 7 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 3, 15, 16, 17, 0, 2, 3, 0, 1, 4, 0, 20, 23, 24, 25, 0, 0, 19, 0, 0, 0, 0, 0, 20, 22, 0, 0, 21, 0, 5, 18, 27, 26, 7, 0, 0, 7, 0, 0, 56, 8, 13, 20, 49, 33, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57, 51, 0, 46, 0, 56, 62, 61, 60, 20, 13, 10, 0, 0, 28, 46, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 58, 0, 6, 55, 0, 14, 12, 0, 45, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 48, 54, 0, 0, 29, 30, 31, 32, 37, 38, 39, 40, 41, 42, 43, 44, 0, 0, 9, 36, 35, 0, 0, 0, 0, 0, 0, 0, 0, 47, 52, 59, 11, 63, 64, 0, 66, 56, 56, 0, 53, 0, 0, 0, 56, 65, 70, 68, 0, 0, 0, 56, 56, 0, 0, 69, 67 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 4, 5, 6, 29, 35, 36, 69, 70, 7, 16, 17, 18, 60, 73, 120, 62, 63, 64, 65, 66 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -105 static const yytype_int16 yypact[] = { 33, -105, -105, -105, 8, -105, 33, -26, -105, -105, 5, 0, 4, 15, -105, 6, -8, -1, 24, 42, 73, 36, 57, 0, -105, 61, 64, -105, 62, -105, -105, -105, -105, 29, 50, 66, 29, 52, 74, 105, -105, -17, 0, -105, -105, -105, 144, 92, 144, 77, 78, 79, 81, 85, 91, 94, 96, 97, -105, 1, 175, 104, 98, 105, -105, -105, -105, 0, 82, -105, 84, 95, 55, -105, -105, 217, 87, 88, 144, 89, 90, 144, 144, 144, 105, 59, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -105, 144, -105, -105, 114, -105, -105, 57, -105, 117, 119, 237, 123, 125, 112, 252, 267, 282, 115, -105, 150, 128, 312, 55, 55, 55, 55, -5, -5, -5, 63, 63, -105, -105, -105, 189, 57, -105, -105, -105, 132, 135, 144, 136, 134, 154, 144, 144, -105, -105, -105, -105, -105, -105, 297, -105, 105, 105, 203, -105, 138, 151, 152, 105, -105, 145, -105, 155, 178, 182, 105, 105, 191, 205, -105, -105 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -105, -105, 235, -105, -104, 206, -105, -105, 177, -105, -3, -105, -10, -35, -39, 109, -62, -105, -105, -105, -105 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { 61, 102, 136, 12, 13, 21, 14, 67, 8, 12, 13, 72, 14, 75, 94, 95, 96, 97, 98, 10, 30, 22, 117, 37, 61, 85, 37, 86, 68, 11, 19, 150, 12, 13, 34, 14, 1, 2, 3, 71, 112, 20, 23, 110, 15, 61, 114, 115, 116, 25, 119, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 103, 134, 43, 44, 45, 24, 91, 92, 93, 46, 94, 95, 96, 97, 98, 47, 26, 27, 28, 48, 96, 97, 98, 33, 118, 31, 49, 50, 32, 160, 161, 38, 39, 41, 42, 74, 166, 76, 77, 78, 59, 79, 153, 171, 172, 80, 157, 119, 43, 44, 45, 81, 61, 61, 82, 46, 83, 84, 100, 61, 106, 47, 105, 68, 101, 48, 61, 61, 108, 109, 111, 113, 49, 50, 51, 52, 53, 54, 55, 135, 56, 57, 137, 58, 138, 86, 59, 43, 44, 45, 140, 141, 145, 147, 46, 155, 87, 88, 89, 90, 47, 91, 92, 93, 48, 94, 95, 96, 97, 98, 151, 49, 50, 152, 154, 156, 163, 164, 165, 167, 168, 87, 88, 89, 90, 59, 91, 92, 93, 146, 94, 95, 96, 97, 98, 87, 88, 89, 90, 169, 91, 92, 93, 170, 94, 95, 96, 97, 98, 87, 88, 89, 90, 99, 91, 92, 93, 173, 94, 95, 96, 97, 98, 87, 88, 89, 90, 149, 91, 92, 93, 174, 94, 95, 96, 97, 98, 9, 40, 0, 162, 104, 107, 87, 88, 89, 90, 0, 91, 92, 93, 158, 94, 95, 96, 97, 98, 0, 87, 88, 89, 90, 139, 91, 92, 93, 0, 94, 95, 96, 97, 98, 0, 87, 88, 89, 90, 142, 91, 92, 93, 0, 94, 95, 96, 97, 98, 0, 87, 88, 89, 90, 143, 91, 92, 93, 0, 94, 95, 96, 97, 98, 0, 87, 88, 89, 90, 144, 91, 92, 93, 0, 94, 95, 96, 97, 98, 0, 87, 88, 89, 90, 159, 91, 92, 93, 0, 94, 95, 96, 97, 98, 0, 0, 0, 0, 148 }; static const yytype_int16 yycheck[] = { 39, 63, 106, 3, 4, 15, 6, 24, 0, 3, 4, 46, 6, 48, 19, 20, 21, 22, 23, 45, 23, 29, 84, 33, 63, 24, 36, 26, 45, 24, 26, 135, 3, 4, 5, 6, 3, 4, 5, 42, 79, 26, 43, 78, 44, 84, 81, 82, 83, 7, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 67, 100, 7, 8, 9, 45, 15, 16, 17, 14, 19, 20, 21, 22, 23, 20, 7, 45, 25, 24, 21, 22, 23, 25, 29, 28, 31, 32, 28, 155, 156, 45, 30, 45, 24, 7, 162, 24, 24, 24, 45, 24, 141, 169, 170, 24, 145, 146, 7, 8, 9, 24, 155, 156, 24, 14, 24, 24, 18, 162, 29, 20, 42, 45, 30, 24, 169, 170, 45, 45, 45, 45, 31, 32, 33, 34, 35, 36, 37, 29, 39, 40, 29, 42, 29, 26, 45, 7, 8, 9, 29, 43, 41, 29, 14, 25, 10, 11, 12, 13, 20, 15, 16, 17, 24, 19, 20, 21, 22, 23, 42, 31, 32, 42, 42, 25, 42, 30, 30, 38, 29, 10, 11, 12, 13, 45, 15, 16, 17, 43, 19, 20, 21, 22, 23, 10, 11, 12, 13, 25, 15, 16, 17, 25, 19, 20, 21, 22, 23, 10, 11, 12, 13, 42, 15, 16, 17, 30, 19, 20, 21, 22, 23, 10, 11, 12, 13, 42, 15, 16, 17, 30, 19, 20, 21, 22, 23, 6, 36, -1, 41, 68, 29, 10, 11, 12, 13, -1, 15, 16, 17, 146, 19, 20, 21, 22, 23, -1, 10, 11, 12, 13, 29, 15, 16, 17, -1, 19, 20, 21, 22, 23, -1, 10, 11, 12, 13, 29, 15, 16, 17, -1, 19, 20, 21, 22, 23, -1, 10, 11, 12, 13, 29, 15, 16, 17, -1, 19, 20, 21, 22, 23, -1, 10, 11, 12, 13, 29, 15, 16, 17, -1, 19, 20, 21, 22, 23, -1, 10, 11, 12, 13, 29, 15, 16, 17, -1, 19, 20, 21, 22, 23, -1, -1, -1, -1, 28 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 47, 48, 49, 55, 0, 48, 45, 24, 3, 4, 6, 44, 56, 57, 58, 26, 26, 58, 29, 43, 45, 7, 7, 45, 25, 50, 56, 28, 28, 25, 5, 51, 52, 58, 45, 30, 51, 45, 24, 7, 8, 9, 14, 20, 24, 31, 32, 33, 34, 35, 36, 37, 39, 40, 42, 45, 59, 60, 62, 63, 64, 65, 66, 24, 45, 53, 54, 56, 59, 60, 7, 59, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 26, 10, 11, 12, 13, 15, 16, 17, 19, 20, 21, 22, 23, 42, 18, 30, 62, 56, 54, 42, 29, 29, 45, 45, 59, 45, 60, 45, 59, 59, 59, 62, 29, 59, 61, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 29, 50, 29, 29, 29, 29, 43, 29, 29, 29, 41, 43, 29, 28, 42, 50, 42, 42, 59, 42, 25, 25, 59, 61, 29, 62, 62, 41, 42, 30, 30, 62, 38, 29, 25, 25, 62, 62, 30, 30 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value, Location); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; YYLTYPE const * const yylocationp; #endif { if (!yyvaluep) return; YYUSE (yylocationp); # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; YYLTYPE const * const yylocationp; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); YY_LOCATION_PRINT (yyoutput, *yylocationp); YYFPRINTF (yyoutput, ": "); yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void yy_stack_print (yybottom, yytop) yytype_int16 *yybottom; yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) #else static void yy_reduce_print (yyvsp, yylsp, yyrule) YYSTYPE *yyvsp; YYLTYPE *yylsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, yylsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) #else static void yydestruct (yymsg, yytype, yyvaluep, yylocationp) const char *yymsg; int yytype; YYSTYPE *yyvaluep; YYLTYPE *yylocationp; #endif { YYUSE (yyvaluep); YYUSE (yylocationp); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Location data for the lookahead symbol. */ YYLTYPE yylloc; /* Number of syntax errors so far. */ int yynerrs; /*-------------------------. | yyparse or yypush_parse. | `-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: `yyss': related to states. `yyvs': related to semantic values. `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls; YYLTYPE *yylsp; /* The locations where the error started and ended. */ YYLTYPE yyerror_range[2]; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yytoken = 0; yyss = yyssa; yyvs = yyvsa; yyls = yylsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; yylsp = yyls; #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; YYLTYPE *yyls1 = yyls; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); yyls = yyls1; yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; yylsp = yyls + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; *++yylsp = yylloc; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; /* Default location. */ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: /* Line 1455 of yacc.c */ #line 83 "lsd10.y" { rootNode=(yyvsp[(1) - (1)].node);//createASTNode(10,createASTNodeInfo("Root", NODE_TYPE_NOTHING, NO_VAL),$1,NULL); } break; case 3: /* Line 1455 of yacc.c */ #line 89 "lsd10.y" {(yyval.node)=NULL;} break; case 4: /* Line 1455 of yacc.c */ #line 90 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Functions node", __FILE__, __LINE__); #endif // Avoid building an unneeded node if((yyvsp[(1) - (2)].node)==NULL && (yyvsp[(2) - (2)].node)!=NULL) { (yyval.node)=(yyvsp[(2) - (2)].node); } else if((yyvsp[(2) - (2)].node)==NULL && (yyvsp[(1) - (2)].node)!=NULL) { (yyval.node)=(yyvsp[(1) - (2)].node); } else { (yyval.node)=createASTNode(&(yylsp[(1) - (2)]),NODE_TYPE_FUNCTIONS, createASTNodeInfo("Functions", NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].node)); } } break; case 5: /* Line 1455 of yacc.c */ #line 110 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Function node", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&(yylsp[(2) - (6)]),NODE_TYPE_FUNCTION, createASTNodeInfo((yyvsp[(2) - (6)].text), (yyvsp[(1) - (6)].nval), NO_VAL), (yyvsp[(4) - (6)].node), (yyvsp[(6) - (6)].node)); } break; case 6: /* Line 1455 of yacc.c */ #line 119 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"PostFixeFunction node", __FILE__, __LINE__); #endif // Avoid building an unneeded node if((yyvsp[(3) - (6)].node)==NULL) { (yyval.node)=(yyvsp[(5) - (6)].node)==NULL?NULL:(yyvsp[(5) - (6)].node); } else if((yyvsp[(5) - (6)].node)==NULL) { (yyval.node)=(yyvsp[(3) - (6)].node); } else { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_CONTAINER, createASTNodeInfo("{{decl}statement}", NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].node)); } } break; case 7: /* Line 1455 of yacc.c */ #line 140 "lsd10.y" { (yyval.node)=NULL; } break; case 8: /* Line 1455 of yacc.c */ #line 143 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Declarations node", __FILE__, __LINE__); #endif // Avoid building an unneeded node if((yyvsp[(2) - (2)].node)==NULL) { (yyval.node)=(yyvsp[(1) - (2)].node); } else { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_DECLARATIONS, createASTNodeInfo("Declarations node", NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node)); } } break; case 9: /* Line 1455 of yacc.c */ #line 160 "lsd10.y" { /*void function*/ (yyval.node) = createASTNode(&(yylsp[(2) - (6)]),NODE_TYPE_FUNCTION, createASTNodeInfo((yyvsp[(2) - (6)].text), AST_VOID_VAR_TYPE, NO_VAL), (yyvsp[(4) - (6)].node), (yyvsp[(6) - (6)].node)); //setNodeSubType($$, SUBFUNCTION); } break; case 10: /* Line 1455 of yacc.c */ #line 165 "lsd10.y" { if((yyvsp[(3) - (3)].node)==NULL || (yyvsp[(3) - (3)].node)->type==NODE_DECL_LEXICAL_VAR) { // multiple variables declarations like "integer i j;" // we must set the type for each variable AstNode *tempNode = (yyvsp[(3) - (3)].node); while(tempNode!=NULL) { //printf("\nVar ids: %s (on %s %d)\n", varNode->info->name, __FILE__, __LINE__); setComputedType(tempNode,(yyvsp[(1) - (3)].nval)); tempNode=tempNode->left; } (yyval.node)=createASTNode(&yylloc,NODE_DECL_LEXICAL_VAR, createASTNodeInfo((yyvsp[(2) - (3)].text), (yyvsp[(1) - (3)].nval), NO_VAL), (yyvsp[(3) - (3)].node), NULL); setComputedType((yyval.node),(yyvsp[(1) - (3)].nval)); } else { // function declaration (yyval.node) = createASTNode(&yylloc,NODE_TYPE_FUNCTION, createASTNodeInfo((yyvsp[(2) - (3)].text), (yyvsp[(1) - (3)].nval), NO_VAL), (yyvsp[(3) - (3)].node)->right, (yyvsp[(3) - (3)].node)->left); setComputedType((yyval.node),(yyvsp[(1) - (3)].nval)); //setNodeSubType($$, SUBFUNCTION); } } break; case 11: /* Line 1455 of yacc.c */ #line 193 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_DECL_PVAL, createASTNodeInfo("function", NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(2) - (4)].node), (yyvsp[(4) - (4)].node)); } break; case 12: /* Line 1455 of yacc.c */ #line 196 "lsd10.y" { (yyval.node)=(yyvsp[(1) - (2)].node); } break; case 13: /* Line 1455 of yacc.c */ #line 202 "lsd10.y" {(yyval.node)=NULL;} break; case 14: /* Line 1455 of yacc.c */ #line 203 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_DECL_LEXICAL_VAR, createASTNodeInfo((yyvsp[(1) - (2)].text), NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(2) - (2)].node), NULL); } break; case 15: /* Line 1455 of yacc.c */ #line 209 "lsd10.y" { (yyval.nval)=AST_BOOLEAN_VAR_TYPE; #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"FunctionType node : boolean", __FILE__, __LINE__); #endif } break; case 16: /* Line 1455 of yacc.c */ #line 215 "lsd10.y" { (yyval.nval)=AST_INTEGER_VAR_TYPE; #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"FunctionType node : integer", __FILE__, __LINE__); #endif } break; case 17: /* Line 1455 of yacc.c */ #line 221 "lsd10.y" { (yyval.nval)=AST_VOID_VAR_TYPE; #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"FunctionType node : void", __FILE__, __LINE__); #endif } break; case 18: /* Line 1455 of yacc.c */ #line 230 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_PARAM_LIST, createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); } break; case 19: /* Line 1455 of yacc.c */ #line 233 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_PARAM_LIST, createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(1) - (1)].node), NULL); } break; case 20: /* Line 1455 of yacc.c */ #line 236 "lsd10.y" {(yyval.node)=NULL;} break; case 21: /* Line 1455 of yacc.c */ #line 240 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"LEXICAL_VAR VarType ID node", __FILE__, __LINE__); #endif (yyval.node) = createASTNode(&yylloc,NODE_ARG_DECL_LEXICAL_VAR, createASTNodeInfo((yyvsp[(3) - (3)].text), (yyvsp[(2) - (3)].nval), NO_VAL), NULL, NULL); setNodeSubType((yyval.node), LEXICAL_VAR); } break; case 22: /* Line 1455 of yacc.c */ #line 247 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"VarType ID node", __FILE__, __LINE__); #endif (yyval.node) = createASTNode(&yylloc,NODE_ARG_DECL_LEXICAL_VAR, createASTNodeInfo((yyvsp[(2) - (2)].text), (yyvsp[(1) - (2)].nval), NO_VAL), NULL, NULL); setNodeSubType((yyval.node), ID); } break; case 23: /* Line 1455 of yacc.c */ #line 258 "lsd10.y" { (yyval.nval)=AST_BOOLEAN_VAR_TYPE; #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"VarType node : boolean", __FILE__, __LINE__); #endif } break; case 24: /* Line 1455 of yacc.c */ #line 264 "lsd10.y" { (yyval.nval)=AST_INTEGER_VAR_TYPE; #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"VarType node : integer", __FILE__, __LINE__); #endif } break; case 25: /* Line 1455 of yacc.c */ #line 270 "lsd10.y" { (yyval.nval)=AST_INSTACK_VAR_TYPE; #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"VarType node : instack", __FILE__, __LINE__); #endif } break; case 26: /* Line 1455 of yacc.c */ #line 276 "lsd10.y" { (yyval.nval)=AST_INTEGER_ARRAY_VAR_TYPE; #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"VarType node : integer", __FILE__, __LINE__); #endif } break; case 27: /* Line 1455 of yacc.c */ #line 282 "lsd10.y" { (yyval.nval)=AST_BOOLEAN_ARRAY_VAR_TYPE; #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"VarType node : integer", __FILE__, __LINE__); #endif } break; case 28: /* Line 1455 of yacc.c */ #line 291 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),NULL, (yyvsp[(2) - (2)].node)); setNodeSubType((yyval.node), LEXICAL_NOT); } break; case 29: /* Line 1455 of yacc.c */ #line 296 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); setNodeSubType((yyval.node), LEXICAL_AND); } break; case 30: /* Line 1455 of yacc.c */ #line 300 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); setNodeSubType((yyval.node), LEXICAL_OR); } break; case 31: /* Line 1455 of yacc.c */ #line 304 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); setNodeSubType((yyval.node), LEXICAL_ANDLAZY); } break; case 32: /* Line 1455 of yacc.c */ #line 308 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); setNodeSubType((yyval.node), LEXICAL_ORLAZY); } break; case 33: /* Line 1455 of yacc.c */ #line 312 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,LEXICAL_TRUE_VAL, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),NULL, NULL); setNodeSubType((yyval.node), LEXICAL_TRUE_VAL); } break; case 34: /* Line 1455 of yacc.c */ #line 316 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,LEXICAL_FALSE_VAL, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),NULL, NULL); setNodeSubType((yyval.node), LEXICAL_FALSE_VAL); } break; case 35: /* Line 1455 of yacc.c */ #line 320 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL), NULL, createASTNode(&yylloc,NODE_TYPE_ID, createASTNodeInfo((yyvsp[(3) - (4)].text), NODE_TYPE_TODO, NO_VAL),NULL, NULL) ); setNodeSubType((yyval.node), LEXICAL_ISEMPTY_OPS); } break; case 36: /* Line 1455 of yacc.c */ #line 327 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_INTEGER_VAR_TYPE, NO_VAL), NULL, createASTNode(&yylloc,NODE_TYPE_ID, createASTNodeInfo((yyvsp[(3) - (4)].text), NODE_TYPE_TODO, NO_VAL),NULL, NULL) ); setNodeSubType((yyval.node), LEXICAL_GET_OPS); } break; case 37: /* Line 1455 of yacc.c */ #line 334 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"=", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); setNodeSubType((yyval.node), LEXICAL_EQUALS); } break; case 38: /* Line 1455 of yacc.c */ #line 341 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); setNodeSubType((yyval.node), LEXICAL_LESS_EQUALS); #if(VERBOSE_LEVEL<=DEB_Y) //printf(";\ttest subtype %d",$$->subtype); printMsg(DEB_Y,"<=", __FILE__, __LINE__); #endif } break; case 39: /* Line 1455 of yacc.c */ #line 349 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"<", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); setNodeSubType((yyval.node), LEXICAL_LESS); } break; case 40: /* Line 1455 of yacc.c */ #line 356 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"+", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_INTEGER_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); setNodeSubType((yyval.node), LEXICAL_PLUS); } break; case 41: /* Line 1455 of yacc.c */ #line 363 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"-", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_INTEGER_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); setNodeSubType((yyval.node), LEXICAL_MINUS); } break; case 42: /* Line 1455 of yacc.c */ #line 370 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"*", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_INTEGER_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); setNodeSubType((yyval.node), LEXICAL_MULT); } break; case 43: /* Line 1455 of yacc.c */ #line 377 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"LEXICAL_DIV", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_INTEGER_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); setNodeSubType((yyval.node), LEXICAL_DIV); } break; case 44: /* Line 1455 of yacc.c */ #line 384 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"LEXICAL_MOD", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_INTEGER_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); setNodeSubType((yyval.node), LEXICAL_MOD); } break; case 45: /* Line 1455 of yacc.c */ #line 391 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"(RExpr)", __FILE__, __LINE__); #endif (yyval.node)=(yyvsp[(2) - (3)].node);//createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, NODE_TYPE_TODO, NO_VAL),NULL, $2); } break; case 46: /* Line 1455 of yacc.c */ #line 397 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"LExpr", __FILE__, __LINE__); #endif (yyval.node)=(yyvsp[(1) - (1)].node);//createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, NODE_TYPE_TODO, NO_VAL),$1, NULL); } break; case 47: /* Line 1455 of yacc.c */ #line 403 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Function call with parameters", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc,NODE_TYPE_FUNCTION_CALL, createASTNodeInfo((yyvsp[(1) - (4)].text), NODE_TYPE_TODO, NO_VAL),(yyvsp[(3) - (4)].node), NULL); } break; case 48: /* Line 1455 of yacc.c */ #line 409 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Function call without parameters", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc,NODE_TYPE_FUNCTION_CALL, createASTNodeInfo((yyvsp[(1) - (3)].text), NODE_TYPE_TODO, NO_VAL),NULL, NULL); } break; case 49: /* Line 1455 of yacc.c */ #line 415 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NUMBER, createASTNodeInfo("CONSTANT, NUMBER", AST_INTEGER_VAR_TYPE, (yyvsp[(1) - (1)].nval)),NULL, NULL); } break; case 50: /* Line 1455 of yacc.c */ #line 418 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NUMBER, createASTNodeInfo("CONSTANT, NEGATIVE NUMBER", AST_INTEGER_VAR_TYPE, 0-(yyvsp[(2) - (2)].nval)),NULL, NULL); } break; case 51: /* Line 1455 of yacc.c */ #line 427 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"ID node", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc,NODE_TYPE_ID, createASTNodeInfo((yyvsp[(1) - (1)].text), NODE_TYPE_NOTHING, NO_VAL),NULL, NULL); } break; case 52: /* Line 1455 of yacc.c */ #line 433 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_ID,createASTNodeInfo((yyvsp[(1) - (4)].text), NODE_TYPE_NOTHING, NO_VAL),(yyvsp[(3) - (4)].node),NULL); setNodeSubType((yyval.node), LEXICAL_INSTACK_TYPE); } break; case 53: /* Line 1455 of yacc.c */ #line 440 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_PARAM_LIST, createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); } break; case 54: /* Line 1455 of yacc.c */ #line 443 "lsd10.y" { (yyval.node)=(yyvsp[(1) - (1)].node); setNodeType((yyval.node), NODE_TYPE_PARAM); } break; case 55: /* Line 1455 of yacc.c */ #line 450 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Statements node", __FILE__, __LINE__); #endif // Avoid building an unneeded node if((yyvsp[(2) - (2)].node)==NULL) { (yyval.node)=(yyvsp[(1) - (2)].node); } else { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_FUNCTION_BODY, createASTNodeInfo("Statements node", NODE_TYPE_TODO, NO_VAL),(yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node)); } } break; case 56: /* Line 1455 of yacc.c */ #line 464 "lsd10.y" { (yyval.node)=NULL;} break; case 57: /* Line 1455 of yacc.c */ #line 468 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Statement : ';'", __FILE__, __LINE__); #endif (yyval.node)=NULL; } break; case 58: /* Line 1455 of yacc.c */ #line 474 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Statement : 'RExpr;'", __FILE__, __LINE__); #endif (yyval.node)=(yyvsp[(1) - (2)].node); } break; case 59: /* Line 1455 of yacc.c */ #line 480 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_STATEMENT, createASTNodeInfo("Statement : 'LExpr = RExpr;'", NODE_TYPE_CHECK, NO_VAL),(yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].node)); setNodeSubType((yyval.node), LEXICAL_AFFECTATION); } break; case 60: /* Line 1455 of yacc.c */ #line 484 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Statement : 'if'", __FILE__, __LINE__); #endif (yyval.node)=(yyvsp[(1) - (1)].node);//createASTNode(&yylloc,NODE_TYPE_STATEMENT, createASTNodeInfo("Statement : 'if'", NODE_TYPE_NOTHING, NO_VAL),$1, NULL); } break; case 61: /* Line 1455 of yacc.c */ #line 490 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Statement : 'while'", __FILE__, __LINE__); #endif (yyval.node)=(yyvsp[(1) - (1)].node); } break; case 62: /* Line 1455 of yacc.c */ #line 496 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Statement : 'for'", __FILE__, __LINE__); #endif (yyval.node)=(yyvsp[(1) - (1)].node); } break; case 63: /* Line 1455 of yacc.c */ #line 502 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Statement : 'WRITE (RExpr);'", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc,LEXICAL_WRITE_OPS, createASTNodeInfo("Statement : 'WRITE (RExpr);'", AST_INTEGER_VAR_TYPE, NO_VAL),NULL, (yyvsp[(3) - (5)].node)); } break; case 64: /* Line 1455 of yacc.c */ #line 508 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Statement : 'READ (LExpr);'", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc,LEXICAL_READ_OPS, createASTNodeInfo("Statement : 'READ (LExpr);'", AST_INTEGER_VAR_TYPE, NO_VAL),NULL, (yyvsp[(3) - (5)].node)); } break; case 65: /* Line 1455 of yacc.c */ #line 514 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Statement : 'PUT (ID, RExpr);'", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc, LEXICAL_PUT_OPS, createASTNodeInfo("Statement : 'PUT;'", NODE_TYPE_NOTHING, NO_VAL), createASTNode(&yylloc,NODE_TYPE_ID, createASTNodeInfo((yyvsp[(3) - (7)].text), NODE_TYPE_NOTHING, NO_VAL),NULL, NULL), (yyvsp[(5) - (7)].node) ); } break; case 66: /* Line 1455 of yacc.c */ #line 525 "lsd10.y" { #if(VERBOSE_LEVEL<=DEB_Y) printMsg(DEB_Y,"Statement : 'LEXICAL_RETURN_STMT(RExpr);'", __FILE__, __LINE__); #endif (yyval.node)=createASTNode(&yylloc,LEXICAL_RETURN_STMT, createASTNodeInfo("Statement : 'LEXICAL_RETURN_STMT(RExpr);'", NODE_TYPE_NOTHING, NO_VAL),NULL, (yyvsp[(3) - (5)].node)); } break; case 67: /* Line 1455 of yacc.c */ #line 533 "lsd10.y" { AstNode *forBoundariesNode = createASTNode(&yylloc,NODE_TYPE_CONTAINER,createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL),(yyvsp[(3) - (11)].node),(yyvsp[(7) - (11)].node)); AstNode *forNode = createASTNode(&yylloc,NODE_TYPE_CONTAINER,createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL),forBoundariesNode, (yyvsp[(10) - (11)].node)); //AstNode *forConditionNode = createASTNode(&yylloc,NODE_TYPE_REXP,createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL),$5,NULL); (yyval.node) = createASTNode(&yylloc,NODE_TYPE_STATEMENT,createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(5) - (11)].node), forNode ); setNodeSubType((yyval.node), LEXICAL_FLEXICAL_OR_STMT); } break; case 68: /* Line 1455 of yacc.c */ #line 546 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_STATEMENT,createASTNodeInfo("while(RExpr){Statement}", NODE_TYPE_NOTHING, NO_VAL),(yyvsp[(3) - (7)].node), (yyvsp[(6) - (7)].node)); setNodeSubType((yyval.node), LEXICAL_WHILE_STMT); } break; case 69: /* Line 1455 of yacc.c */ #line 553 "lsd10.y" { AstNode *ifNode = (yyvsp[(6) - (11)].node); AstNode *elseNode = (yyvsp[(10) - (11)].node); (yyval.node)=createASTNode(&yylloc, NODE_TYPE_STATEMENT, createASTNodeInfo("if(RExpr){Statement}else{Statement}", NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(3) - (11)].node), createASTNode(&yylloc, NODE_TYPE_CONTAINER, createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL), ifNode, elseNode ) ); setNodeSubType((yyval.node), AST_IF_ELSE_STMT); } break; case 70: /* Line 1455 of yacc.c */ #line 570 "lsd10.y" { (yyval.node)=createASTNode(&yylloc,NODE_TYPE_STATEMENT,createASTNodeInfo("if(RExpr){Statement}", NODE_TYPE_NOTHING, NO_VAL),(yyvsp[(3) - (7)].node), (yyvsp[(6) - (7)].node)); setNodeSubType((yyval.node), LEXICAL_IF_STMT); } break; /* Line 1455 of yacc.c */ #line 2539 "y.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; *++yylsp = yyloc; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } yyerror_range[0] = yylloc; if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval, &yylloc); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; yyerror_range[0] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yyerror_range[0] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp, yylsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } /* Line 1675 of yacc.c */ #line 576 "lsd10.y" void finalizeYacc() { #if(SYMTABLE_PRINT_REQUESTED==1 || VERBOSE_LEVEL<=DEB_I) printSymbolsTableFooter(); #endif #if(VERBOSE_LEVEL<=DEB_EXEC) printMsg(DEB_EXEC,"Cleaning memory...", __FILE__, __LINE__); #endif // finalizeSymbolsTable MUST be called BELEXICAL_FLEXICAL_OR_STMTE finalizeAST to avoid double free or corruption finalizeSymbolsTable(); finalizeAST(); // if(psnBeforeToken!=NULL) // { // free(psnBeforeToken); // } // if(psnAfterToken!=NULL) // { // free(psnAfterToken); // } yylex_destroy(); #if(VERBOSE_LEVEL<=DEB_EXEC) printMsg(DEB_EXEC,"...OK Memory cleaned\n;\n;", __FILE__, __LINE__); #endif } int testFile(char *path) { #if(VERBOSE_LEVEL<=DEB_EXEC) printf(";****************************************************************************************"); printMsg(DEB_EXEC,"Creating Symbols Table",__FILE__, __LINE__); #endif initializeSymbolsTable(); #if(SYMTABLE_PRINT_REQUESTED==1) printSymbolsTableHeader(); #endif #if(SYMTABLE_PRINT_REQUESTED!=1 && VERBOSE_LEVEL<=DEB_EXEC) printMsg(DEB_W,"Print Symbols table not requested (use DEB_I level minimum to print it)", __FILE__, __LINE__); #endif { #if(VERBOSE_LEVEL<=DEB_EXEC) printMsg(DEB_EXEC,"Using Test file...false", __FILE__, __LINE__); printMsg(DEB_EXEC,"Calling yyparse()", __FILE__, __LINE__); #endif yyparse(); } else { #if(VERBOSE_LEVEL<=DEB_EXEC) printMsg(DEB_EXEC,"Using Test file...true", __FILE__, __LINE__); printMsg(DEB_EXEC,"Calling yyparse()", __FILE__, __LINE__); #endif yyparse();/*retourne un booleen?*/ } #if(VERBOSE_LEVEL<=DEB_EXEC) printMsg(DEB_EXEC,"End of yyparse execution;", __FILE__, __LINE__); #endif #if(AST_PRINT_REQUESTED==1) printTree(); #endif #if(AST_PRINT_REQUESTED!=1 && VERBOSE_LEVEL<=DEB_EXEC) printMsg(DEB_W,"Print tree not requested (use DEB_I level minimum to print it)", __FILE__, __LINE__); #endif checkAST(); #if(AST_IMAGE_REQUESTED!=0) printGraph(); #endif #if(VERBOSE_LEVEL<=DEB_EXEC && PCODE_GENERATION_BYPASS) printMsg(DEB_EXEC,"P-code generation not requested.", __FILE__, __LINE__); #endif #if(!PCODE_GENERATION_BYPASS) #if(VERBOSE_LEVEL<=DEB_EXEC) printMsg(DEB_EXEC,"Generating p-code...", __FILE__, __LINE__); #endif generatePCode(); #if(VERBOSE_LEVEL<=DEB_EXEC) printMsg(DEB_EXEC,"...OK P-code generated;", __FILE__, __LINE__); #endif #endif #if(VAR_USAGE_REPLEXICAL_ORT_REQUESTED) printSymbolsUsage(); #endif finalizeYacc(); #if(VERBOSE_LEVEL<=DEB_EXEC) char str[1024];//todo: minimize length str, "Parsing started at %s;\t%d lines %d chars parsed in %g seconds\n;\tVerbose set on \"%s\" level", lexLinesCount, lexTotalCharsCount, debugLevelToString(VERBOSE_LEVEL) ); printMsg(DEB_EXEC,str, __FILE__, __LINE__); #endif //fprintf(stderr,"OK\n"); return EXIT_SUCCESS; } int main() { DIR *dir = NULL; struct dirent *file = NULL; char *path="tests"; #if(VERBOSE_LEVEL<=DEB_EXEC) printMsg(DEB_EXEC,"\n;\n;\tLSD010 Compiler [SSHD09]\n;\n;", __FILE__, __LINE__); #endif if((dir = opendir(path)) == NULL) { testFile(NULL); } else { char *filePath; while((file = readdir(dir)) != NULL) { { //printf("\n; Opening %s file...", filePath); if(testFile(filePath) != EXIT_SUCCESS) { return EXIT_FAILURE; } } } closedir(dir); } #if(VERBOSE_LEVEL<=DEB_EXEC) printMsg(DEB_EXEC,"That's All Folks!", __FILE__, __LINE__); #endif return EXIT_SUCCESS; } int yyerror(char *str) { if(yytext!=NULL) { fprintf(stderr,";\n;\tError : \"%s\" On parsed code, Line %d : UNRECOGNISED '%s'\n\n", str, lexLinesCount, yytext); }else if(debugInfo!=NULL) { stderr, ";\n;\tError : \"%s\" On %s, Line %d col %d\n\n", str, debugInfo->file, debugInfo->line, debugInfo->linePsn ); } // else if(lexLinesCount>0) // { // fprintf(stderr,";\n;\tError : \"%s\" On parsed code, Line %d\n\n", str, lexLinesCount); // } else { } finalizeYacc(); //failure for the parsed code, but success for the compiler (it must stop here) }
Structure et Fichiers du projet
Afficher/masquer...Icône | Nom | Taille | Modification |
Pas de sous-répertoires. | |||
Icône | Nom | Taille | Modification |
| _ | Répertoire parent | 0 octets | 1732431927 24/11/2024 08:05:27 |
Waarschuwing
Ce code présente une manière possible d'implémenter un compilateur, et certains choix peuvent être discutés.Cependant, il peut donner des pistes pour démarrer, ou approcher certains concepts, et je tenterais par la suite de mettre à jour le code.
Utilisation de l'explorateur de code
- Navigation :
- Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
- Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
- La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
- Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
- Affichage :
- Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
- Actions :
- Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 07/03/2010 gemaakt, de laatste keer de 28/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/langages-lsd10-source-rf-project/source//y.tab.c.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
- ↑a,b LSD010 : Langage Simple et Didactique Il existe une un certain nombre d'interprétations de l'acronyme LSD (Langage Symbolique Didactique, Langage Sans Difficulté, Langage Simple et Didactique). LSD010 est la version 2010 de la suite LSD80, LSD_02, LSD03, LSD04, LSD05, LSD06, LSD07, LSD08, et LSD09.
Referenties
- IHDCB332 - Théorie des langages : Syntaxe et sémantique : PY Schobbens,
Syntaxe et sémantique
(January 2010)
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.