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

  1. /* A Bison parser, made by GNU Bison 2.4.1. */
  2.  
  3. /* Skeleton implementation for Bison's Yacc-like parsers in C
  4.  
  5.   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
  6.   Free Software Foundation, Inc.
  7.  
  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 3 of the License, or
  11.   (at your option) any later version.
  12.  
  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.
  17.  
  18.   You should have received a copy of the GNU General Public License
  19.   along with this program. If not, see <http://www.gnu.org/licenses/>. */
  20.  
  21. /* As a special exception, you may create a larger work that contains
  22.   part or all of the Bison parser skeleton and distribute that work
  23.   under terms of your choice, so long as that work isn't itself a
  24.   parser generator using the skeleton or a modified version thereof
  25.   as a parser skeleton. Alternatively, if you modify or redistribute
  26.   the parser skeleton itself, you may (at your option) remove this
  27.   special exception, which will cause the skeleton and the resulting
  28.   Bison output files to be licensed under the GNU General Public
  29.   License without this special exception.
  30.  
  31.   This special exception was added by the Free Software Foundation in
  32.   version 2.2 of Bison. */
  33.  
  34. /* C LALR(1) parser skeleton written by Richard Stallman, by
  35.   simplifying the original so-called "semantic" parser. */
  36.  
  37. /* All symbols defined below should begin with yy or YY, to avoid
  38.   infringing on user name space. This should be done even for local
  39.   variables, as they might otherwise be expanded by user macros.
  40.   There are some unavoidable exceptions within include files to
  41.   define necessary library symbols; they are noted "INFRINGES ON
  42.   USER NAME SPACE" below. */
  43.  
  44. /* Identify Bison output. */
  45. #define YYBISON 1
  46.  
  47. /* Bison version. */
  48. #define YYBISON_VERSION "2.4.1"
  49.  
  50. /* Skeleton name. */
  51. #define YYSKELETON_NAME "yacc.c"
  52.  
  53. /* Pure parsers. */
  54. #define YYPURE 0
  55.  
  56. /* Push parsers. */
  57. #define YYPUSH 0
  58.  
  59. /* Pull parsers. */
  60. #define YYPULL 1
  61.  
  62. /* Using locations. */
  63. #define YYLSP_NEEDED 1
  64.  
  65.  
  66.  
  67. /* Copy the first part of user declarations. */
  68.  
  69. /* Line 189 of yacc.c */
  70. #line 1 "lsd10.y"
  71.  
  72. /*
  73.  * lsd10.y : lexical parsing file for Bison
  74.  * Part of the compiler project for LSD10 language
  75.  * Gaudry Stéphane
  76.  * More information on http://www.gaudry.be/langages-yacc.html
  77.  */
  78. #include <stdio.h>
  79. #include <stdlib.h>
  80. #if(VERBOSE_LEVEL<=DEB_E)
  81. #include <errno.h>
  82. #endif
  83. #if(VERBOSE_LEVEL<=DEB_EXEC)
  84. #include <time.h>
  85. #endif
  86. #include <sys/types.h>
  87. #include <dirent.h>
  88. #include "common.h"
  89. #ifdef WIN32
  90. #define FILE_SEPARATLEXICAL_OR "\\"
  91. #else
  92. #define FILE_SEPARATLEXICAL_OR "/"
  93. #endif
  94.  
  95. extern int lexLinesCount;
  96. //extern int lexCharsLineCountBeforeToken;
  97. extern int lexTotalCharsCount;
  98. extern char* yytext;
  99. extern int *yylineno;
  100. extern FILE *yyin;
  101. /**
  102.  * Position of a detected error
  103.  */
  104. DebugInfo *debugInfo;
  105.  
  106.  
  107. AstNode *rootNode;
  108.  
  109. // to avoid 'implicit definition'
  110. int yylex(void);
  111. int yyerror(char *str);
  112.  
  113.  
  114.  
  115. /* Line 189 of yacc.c */
  116. #line 118 "y.tab.c"
  117.  
  118. /* Enabling traces. */
  119. #ifndef YYDEBUG
  120. # define YYDEBUG 1
  121. #endif
  122.  
  123. /* Enabling verbose error messages. */
  124. #ifdef YYERROR_VERBOSE
  125. # undef YYERROR_VERBOSE
  126. # define YYERROR_VERBOSE 1
  127. #else
  128. # define YYERROR_VERBOSE 1
  129. #endif
  130.  
  131. /* Enabling the token table. */
  132. #ifndef YYTOKEN_TABLE
  133. # define YYTOKEN_TABLE 0
  134. #endif
  135.  
  136.  
  137. /* Tokens. */
  138. #ifndef YYTOKENTYPE
  139. # define YYTOKENTYPE
  140. /* Put the tokens into the symbol table, so that GDB and other debuggers
  141.   know about them. */
  142. enum yytokentype {
  143. LEXICAL_BOOLEAN_TYPE = 258,
  144. LEXICAL_INTEGER_TYPE = 259,
  145. LEXICAL_VOID_TYPE = 260,
  146. LEXICAL_INSTACK_TYPE = 261,
  147. NUMBER = 262,
  148. LEXICAL_TRUE_VAL = 263,
  149. LEXICAL_FALSE_VAL = 264,
  150. LEXICAL_AND = 265,
  151. LEXICAL_OR = 266,
  152. LEXICAL_ANDLAZY = 267,
  153. LEXICAL_ORLAZY = 268,
  154. LEXICAL_NOT = 269,
  155. LEXICAL_EQUALS = 270,
  156. LEXICAL_LESS_EQUALS = 271,
  157. LEXICAL_LESS = 272,
  158. LEXICAL_AFFECTATION = 273,
  159. LEXICAL_PLUS = 274,
  160. LEXICAL_MINUS = 275,
  161. LEXICAL_MULT = 276,
  162. LEXICAL_DIV = 277,
  163. LEXICAL_MOD = 278,
  164. L_PARENTHESIS = 279,
  165. LSQUI_BRACKET = 280,
  166. LSQUA_BRACKET = 281,
  167. POINT = 282,
  168. RSQUA_BRACKET = 283,
  169. R_PARENTHESIS = 284,
  170. RSQUI_BRACKET = 285,
  171. LEXICAL_GET_OPS = 286,
  172. LEXICAL_ISEMPTY_OPS = 287,
  173. LEXICAL_WRITE_OPS = 288,
  174. LEXICAL_READ_OPS = 289,
  175. LEXICAL_PUT_OPS = 290,
  176. LEXICAL_RETURN_STMT = 291,
  177. LEXICAL_IF_STMT = 292,
  178. LEXICAL_ELSE_STMT = 293,
  179. LEXICAL_WHILE_STMT = 294,
  180. LEXICAL_FLEXICAL_OR_STMT = 295,
  181. COLON = 296,
  182. SEMICOLON = 297,
  183. COMMA = 298,
  184. LEXICAL_VAR = 299,
  185. ID = 300
  186. };
  187. #endif
  188. /* Tokens. */
  189. #define LEXICAL_BOOLEAN_TYPE 258
  190. #define LEXICAL_INTEGER_TYPE 259
  191. #define LEXICAL_VOID_TYPE 260
  192. #define LEXICAL_INSTACK_TYPE 261
  193. #define NUMBER 262
  194. #define LEXICAL_TRUE_VAL 263
  195. #define LEXICAL_FALSE_VAL 264
  196. #define LEXICAL_AND 265
  197. #define LEXICAL_OR 266
  198. #define LEXICAL_ANDLAZY 267
  199. #define LEXICAL_ORLAZY 268
  200. #define LEXICAL_NOT 269
  201. #define LEXICAL_EQUALS 270
  202. #define LEXICAL_LESS_EQUALS 271
  203. #define LEXICAL_LESS 272
  204. #define LEXICAL_AFFECTATION 273
  205. #define LEXICAL_PLUS 274
  206. #define LEXICAL_MINUS 275
  207. #define LEXICAL_MULT 276
  208. #define LEXICAL_DIV 277
  209. #define LEXICAL_MOD 278
  210. #define L_PARENTHESIS 279
  211. #define LSQUI_BRACKET 280
  212. #define LSQUA_BRACKET 281
  213. #define POINT 282
  214. #define RSQUA_BRACKET 283
  215. #define R_PARENTHESIS 284
  216. #define RSQUI_BRACKET 285
  217. #define LEXICAL_GET_OPS 286
  218. #define LEXICAL_ISEMPTY_OPS 287
  219. #define LEXICAL_WRITE_OPS 288
  220. #define LEXICAL_READ_OPS 289
  221. #define LEXICAL_PUT_OPS 290
  222. #define LEXICAL_RETURN_STMT 291
  223. #define LEXICAL_IF_STMT 292
  224. #define LEXICAL_ELSE_STMT 293
  225. #define LEXICAL_WHILE_STMT 294
  226. #define LEXICAL_FLEXICAL_OR_STMT 295
  227. #define COLON 296
  228. #define SEMICOLON 297
  229. #define COMMA 298
  230. #define LEXICAL_VAR 299
  231. #define ID 300
  232.  
  233.  
  234.  
  235.  
  236. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  237. typedef union YYSTYPE
  238. {
  239.  
  240. /* Line 214 of yacc.c */
  241. #line 45 "lsd10.y"
  242.  
  243. int nval;
  244. char *text;
  245. struct astNode *node;
  246.  
  247.  
  248.  
  249. /* Line 214 of yacc.c */
  250. #line 252 "y.tab.c"
  251. } YYSTYPE;
  252. # define YYSTYPE_IS_TRIVIAL 1
  253. # define yystype YYSTYPE /* obsolescent; will be withdrawn */
  254. # define YYSTYPE_IS_DECLARED 1
  255. #endif
  256.  
  257. #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
  258. typedef struct YYLTYPE
  259. {
  260. int first_line;
  261. int first_column;
  262. int last_line;
  263. int last_column;
  264. } YYLTYPE;
  265. # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
  266. # define YYLTYPE_IS_DECLARED 1
  267. # define YYLTYPE_IS_TRIVIAL 1
  268. #endif
  269.  
  270.  
  271. /* Copy the second part of user declarations. */
  272.  
  273.  
  274. /* Line 264 of yacc.c */
  275. #line 277 "y.tab.c"
  276.  
  277. #ifdef short
  278. # undef short
  279. #endif
  280.  
  281. #ifdef YYTYPE_UINT8
  282. typedef YYTYPE_UINT8 yytype_uint8;
  283. #else
  284. typedef unsigned char yytype_uint8;
  285. #endif
  286.  
  287. #ifdef YYTYPE_INT8
  288. typedef YYTYPE_INT8 yytype_int8;
  289. #elif (defined __STDC__ || defined __C99__FUNC__ \
  290.   || defined __cplusplus || defined _MSC_VER)
  291. typedef signed char yytype_int8;
  292. #else
  293. typedef short int yytype_int8;
  294. #endif
  295.  
  296. #ifdef YYTYPE_UINT16
  297. typedef YYTYPE_UINT16 yytype_uint16;
  298. #else
  299. typedef unsigned short int yytype_uint16;
  300. #endif
  301.  
  302. #ifdef YYTYPE_INT16
  303. typedef YYTYPE_INT16 yytype_int16;
  304. #else
  305. typedef short int yytype_int16;
  306. #endif
  307.  
  308. #ifndef YYSIZE_T
  309. # ifdef __SIZE_TYPE__
  310. # define YYSIZE_T __SIZE_TYPE__
  311. # elif defined size_t
  312. # define YYSIZE_T size_t
  313. # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
  314.   || defined __cplusplus || defined _MSC_VER)
  315. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  316. # define YYSIZE_T size_t
  317. # else
  318. # define YYSIZE_T unsigned int
  319. # endif
  320. #endif
  321.  
  322. #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
  323.  
  324. #ifndef YY_
  325. # if YYENABLE_NLS
  326. # if ENABLE_NLS
  327. # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  328. # define YY_(msgid) dgettext ("bison-runtime", msgid)
  329. # endif
  330. # endif
  331. # ifndef YY_
  332. # define YY_(msgid) msgid
  333. # endif
  334. #endif
  335.  
  336. /* Suppress unused-variable warnings by "using" E. */
  337. #if ! defined lint || defined __GNUC__
  338. # define YYUSE(e) ((void) (e))
  339. #else
  340. # define YYUSE(e) /* empty */
  341. #endif
  342.  
  343. /* Identity function, used to suppress warnings about constant conditions. */
  344. #ifndef lint
  345. # define YYID(n) (n)
  346. #else
  347. #if (defined __STDC__ || defined __C99__FUNC__ \
  348.   || defined __cplusplus || defined _MSC_VER)
  349. static int
  350. YYID (int yyi)
  351. #else
  352. static int
  353. YYID (yyi)
  354. int yyi;
  355. #endif
  356. {
  357. return yyi;
  358. }
  359. #endif
  360.  
  361. #if ! defined yyoverflow || YYERROR_VERBOSE
  362.  
  363. /* The parser invokes alloca or malloc; define the necessary symbols. */
  364.  
  365. # ifdef YYSTACK_USE_ALLOCA
  366. # if YYSTACK_USE_ALLOCA
  367. # ifdef __GNUC__
  368. # define YYSTACK_ALLOC __builtin_alloca
  369. # elif defined __BUILTIN_VA_ARG_INCR
  370. # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  371. # elif defined _AIX
  372. # define YYSTACK_ALLOC __alloca
  373. # elif defined _MSC_VER
  374. # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  375. # define alloca _alloca
  376. # else
  377. # define YYSTACK_ALLOC alloca
  378. # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  379.   || defined __cplusplus || defined _MSC_VER)
  380. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  381. # ifndef _STDLIB_H
  382. # define _STDLIB_H 1
  383. # endif
  384. # endif
  385. # endif
  386. # endif
  387. # endif
  388.  
  389. # ifdef YYSTACK_ALLOC
  390. /* Pacify GCC's `empty if-body' warning. */
  391. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
  392. # ifndef YYSTACK_ALLOC_MAXIMUM
  393. /* The OS might guarantee only one guard page at the bottom of the stack,
  394.   and a page size can be as small as 4096 bytes. So we cannot safely
  395.   invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
  396.   to allow for a few compiler-allocated temporary stack slots. */
  397. # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  398. # endif
  399. # else
  400. # define YYSTACK_ALLOC YYMALLOC
  401. # define YYSTACK_FREE YYFREE
  402. # ifndef YYSTACK_ALLOC_MAXIMUM
  403. # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  404. # endif
  405. # if (defined __cplusplus && ! defined _STDLIB_H \
  406.   && ! ((defined YYMALLOC || defined malloc) \
  407. && (defined YYFREE || defined free)))
  408. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  409. # ifndef _STDLIB_H
  410. # define _STDLIB_H 1
  411. # endif
  412. # endif
  413. # ifndef YYMALLOC
  414. # define YYMALLOC malloc
  415. # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  416.   || defined __cplusplus || defined _MSC_VER)
  417. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  418. # endif
  419. # endif
  420. # ifndef YYFREE
  421. # define YYFREE free
  422. # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  423.   || defined __cplusplus || defined _MSC_VER)
  424. void free (void *); /* INFRINGES ON USER NAME SPACE */
  425. # endif
  426. # endif
  427. # endif
  428. #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  429.  
  430.  
  431. #if (! defined yyoverflow \
  432.   && (! defined __cplusplus \
  433. || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
  434. && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  435.  
  436. /* A type that is properly aligned for any stack member. */
  437. union yyalloc
  438. {
  439. yytype_int16 yyss_alloc;
  440. YYSTYPE yyvs_alloc;
  441. YYLTYPE yyls_alloc;
  442. };
  443.  
  444. /* The size of the maximum gap between one aligned stack and the next. */
  445. # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
  446.  
  447. /* The size of an array large to enough to hold all stacks, each with
  448.   N elements. */
  449. # define YYSTACK_BYTES(N) \
  450.   ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
  451.   + 2 * YYSTACK_GAP_MAXIMUM)
  452.  
  453. /* Copy COUNT objects from FROM to TO. The source and destination do
  454.   not overlap. */
  455. # ifndef YYCOPY
  456. # if defined __GNUC__ && 1 < __GNUC__
  457. # define YYCOPY(To, From, Count) \
  458.   __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
  459. # else
  460. # define YYCOPY(To, From, Count) \
  461.   do \
  462. { \
  463. YYSIZE_T yyi; \
  464. for (yyi = 0; yyi < (Count); yyi++) \
  465. (To)[yyi] = (From)[yyi]; \
  466. } \
  467.   while (YYID (0))
  468. # endif
  469. # endif
  470.  
  471. /* Relocate STACK from its old location to the new one. The
  472.   local variables YYSIZE and YYSTACKSIZE give the old and new number of
  473.   elements in the stack, and YYPTR gives the new location of the
  474.   stack. Advance YYPTR to a properly aligned location for the next
  475.   stack. */
  476. # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
  477.   do \
  478.   { \
  479. YYSIZE_T yynewbytes; \
  480. YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
  481. Stack = &yyptr->Stack_alloc; \
  482. yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  483. yyptr += yynewbytes / sizeof (*yyptr); \
  484.   } \
  485.   while (YYID (0))
  486.  
  487. #endif
  488.  
  489. /* YYFINAL -- State number of the termination state. */
  490. #define YYFINAL 8
  491. /* YYLAST -- Last index in YYTABLE. */
  492. #define YYLAST 340
  493.  
  494. /* YYNTOKENS -- Number of terminals. */
  495. #define YYNTOKENS 46
  496. /* YYNNTS -- Number of nonterminals. */
  497. #define YYNNTS 21
  498. /* YYNRULES -- Number of rules. */
  499. #define YYNRULES 70
  500. /* YYNRULES -- Number of states. */
  501. #define YYNSTATES 175
  502.  
  503. /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
  504. #define YYUNDEFTOK 2
  505. #define YYMAXUTOK 300
  506.  
  507. #define YYTRANSLATE(YYX) \
  508.   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  509.  
  510. /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
  511. static const yytype_uint8 yytranslate[] =
  512. {
  513. 0, 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, 2, 2, 2, 2,
  538. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  539. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
  540. 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
  541. 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
  542. 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
  543. 45
  544. };
  545.  
  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[] =
  550. {
  551. 0, 0, 3, 5, 6, 9, 16, 23, 24, 27,
  552. 34, 38, 43, 46, 47, 50, 52, 54, 56, 60,
  553. 62, 63, 67, 70, 72, 74, 76, 81, 86, 89,
  554. 93, 97, 101, 105, 107, 109, 114, 119, 123, 127,
  555. 131, 135, 139, 143, 147, 151, 155, 157, 162, 166,
  556. 168, 171, 173, 178, 182, 184, 187, 188, 190, 193,
  557. 198, 200, 202, 204, 210, 216, 224, 230, 242, 250,
  558. 262
  559. };
  560.  
  561. /* YYRHS -- A `-1'-separated list of the rules' RHS. */
  562. static const yytype_int8 yyrhs[] =
  563. {
  564. 47, 0, -1, 48, -1, -1, 49, 48, -1, 55,
  565. 45, 24, 56, 29, 50, -1, 25, 25, 51, 30,
  566. 62, 30, -1, -1, 52, 51, -1, 5, 45, 24,
  567. 56, 29, 50, -1, 58, 45, 53, -1, 24, 56,
  568. 29, 50, -1, 54, 42, -1, -1, 45, 54, -1,
  569. 3, -1, 4, -1, 5, -1, 57, 43, 56, -1,
  570. 57, -1, -1, 44, 58, 45, -1, 58, 45, -1,
  571. 3, -1, 4, -1, 6, -1, 4, 26, 7, 28,
  572. -1, 3, 26, 7, 28, -1, 14, 59, -1, 59,
  573. 10, 59, -1, 59, 11, 59, -1, 59, 12, 59,
  574. -1, 59, 13, 59, -1, 8, -1, 9, -1, 32,
  575. 24, 45, 29, -1, 31, 24, 45, 29, -1, 59,
  576. 15, 59, -1, 59, 16, 59, -1, 59, 17, 59,
  577. -1, 59, 19, 59, -1, 59, 20, 59, -1, 59,
  578. 21, 59, -1, 59, 22, 59, -1, 59, 23, 59,
  579. -1, 24, 59, 29, -1, 60, -1, 45, 24, 61,
  580. 29, -1, 45, 24, 29, -1, 7, -1, 20, 7,
  581. -1, 45, -1, 45, 26, 59, 28, -1, 59, 43,
  582. 61, -1, 59, -1, 63, 62, -1, -1, 42, -1,
  583. 59, 42, -1, 60, 18, 59, 42, -1, 66, -1,
  584. 65, -1, 64, -1, 33, 24, 59, 29, 42, -1,
  585. 34, 24, 60, 29, 42, -1, 35, 24, 45, 43,
  586. 59, 29, 42, -1, 36, 24, 59, 29, 42, -1,
  587. 40, 24, 62, 41, 59, 41, 62, 29, 25, 62,
  588. 30, -1, 39, 24, 59, 29, 25, 62, 30, -1,
  589. 37, 24, 59, 29, 25, 62, 30, 38, 25, 62,
  590. 30, -1, 37, 24, 59, 29, 25, 62, 30, -1
  591. };
  592.  
  593. /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
  594. static const yytype_uint16 yyrline[] =
  595. {
  596. 0, 83, 83, 89, 90, 110, 119, 140, 143, 160,
  597. 165, 193, 196, 202, 203, 209, 215, 221, 230, 233,
  598. 236, 240, 247, 258, 264, 270, 276, 282, 291, 296,
  599. 300, 304, 308, 312, 316, 320, 327, 334, 341, 349,
  600. 356, 363, 370, 377, 384, 391, 397, 403, 409, 415,
  601. 418, 427, 433, 440, 443, 450, 464, 468, 474, 480,
  602. 484, 490, 496, 502, 508, 514, 525, 533, 546, 553,
  603. 570
  604. };
  605. #endif
  606.  
  607. #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
  608. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  609.   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  610. static const char *const yytname[] =
  611. {
  612. "$end", "error", "$undefined", "LEXICAL_BOOLEAN_TYPE",
  613. "LEXICAL_INTEGER_TYPE", "LEXICAL_VOID_TYPE", "LEXICAL_INSTACK_TYPE",
  614. "NUMBER", "LEXICAL_TRUE_VAL", "LEXICAL_FALSE_VAL", "LEXICAL_AND",
  615. "LEXICAL_OR", "LEXICAL_ANDLAZY", "LEXICAL_ORLAZY", "LEXICAL_NOT",
  616. "LEXICAL_EQUALS", "LEXICAL_LESS_EQUALS", "LEXICAL_LESS",
  617. "LEXICAL_AFFECTATION", "LEXICAL_PLUS", "LEXICAL_MINUS", "LEXICAL_MULT",
  618. "LEXICAL_DIV", "LEXICAL_MOD", "L_PARENTHESIS", "LSQUI_BRACKET",
  619. "LSQUA_BRACKET", "POINT", "RSQUA_BRACKET", "R_PARENTHESIS",
  620. "RSQUI_BRACKET", "LEXICAL_GET_OPS", "LEXICAL_ISEMPTY_OPS",
  621. "LEXICAL_WRITE_OPS", "LEXICAL_READ_OPS", "LEXICAL_PUT_OPS",
  622. "LEXICAL_RETURN_STMT", "LEXICAL_IF_STMT", "LEXICAL_ELSE_STMT",
  623. "LEXICAL_WHILE_STMT", "LEXICAL_FLEXICAL_OR_STMT", "COLON", "SEMICOLON",
  624. "COMMA", "LEXICAL_VAR", "ID", "$accept", "Prg", "Functions", "Function",
  625. "PostFixeFunction", "Declarations", "Declaration", "FuncOrVar", "VarIds",
  626. "FunctionType", "ParamList", "ArgDeclaration", "VarType", "RExpr",
  627. "LExpr", "ParamList_FunctionCall", "Statements", "Statement",
  628. "iteration_for", "iteration_while", "if_instruction", 0
  629. };
  630. #endif
  631.  
  632. # ifdef YYPRINT
  633. /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
  634.   token YYLEX-NUM. */
  635. static const yytype_uint16 yytoknum[] =
  636. {
  637. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  638. 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
  639. 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
  640. 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
  641. 295, 296, 297, 298, 299, 300
  642. };
  643. # endif
  644.  
  645. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  646. static const yytype_uint8 yyr1[] =
  647. {
  648. 0, 46, 47, 48, 48, 49, 50, 51, 51, 52,
  649. 52, 53, 53, 54, 54, 55, 55, 55, 56, 56,
  650. 56, 57, 57, 58, 58, 58, 58, 58, 59, 59,
  651. 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
  652. 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
  653. 59, 60, 60, 61, 61, 62, 62, 63, 63, 63,
  654. 63, 63, 63, 63, 63, 63, 63, 64, 65, 66,
  655. 66
  656. };
  657.  
  658. /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
  659. static const yytype_uint8 yyr2[] =
  660. {
  661. 0, 2, 1, 0, 2, 6, 6, 0, 2, 6,
  662. 3, 4, 2, 0, 2, 1, 1, 1, 3, 1,
  663. 0, 3, 2, 1, 1, 1, 4, 4, 2, 3,
  664. 3, 3, 3, 1, 1, 4, 4, 3, 3, 3,
  665. 3, 3, 3, 3, 3, 3, 1, 4, 3, 1,
  666. 2, 1, 4, 3, 1, 2, 0, 1, 2, 4,
  667. 1, 1, 1, 5, 5, 7, 5, 11, 7, 11,
  668. 7
  669. };
  670.  
  671. /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
  672.   STATE-NUM when YYTABLE doesn't specify something else to do. Zero
  673.   means the default is an error. */
  674. static const yytype_uint8 yydefact[] =
  675. {
  676. 3, 15, 16, 17, 0, 2, 3, 0, 1, 4,
  677. 0, 20, 23, 24, 25, 0, 0, 19, 0, 0,
  678. 0, 0, 0, 20, 22, 0, 0, 21, 0, 5,
  679. 18, 27, 26, 7, 0, 0, 7, 0, 0, 56,
  680. 8, 13, 20, 49, 33, 34, 0, 0, 0, 0,
  681. 0, 0, 0, 0, 0, 0, 0, 0, 57, 51,
  682. 0, 46, 0, 56, 62, 61, 60, 20, 13, 10,
  683. 0, 0, 28, 46, 50, 0, 0, 0, 0, 0,
  684. 0, 0, 0, 0, 56, 0, 0, 0, 0, 0,
  685. 0, 0, 0, 0, 0, 0, 0, 0, 0, 58,
  686. 0, 6, 55, 0, 14, 12, 0, 45, 0, 0,
  687. 0, 51, 0, 0, 0, 0, 0, 0, 48, 54,
  688. 0, 0, 29, 30, 31, 32, 37, 38, 39, 40,
  689. 41, 42, 43, 44, 0, 0, 9, 36, 35, 0,
  690. 0, 0, 0, 0, 0, 0, 0, 47, 52, 59,
  691. 11, 63, 64, 0, 66, 56, 56, 0, 53, 0,
  692. 0, 0, 56, 65, 70, 68, 0, 0, 0, 56,
  693. 56, 0, 0, 69, 67
  694. };
  695.  
  696. /* YYDEFGOTO[NTERM-NUM]. */
  697. static const yytype_int8 yydefgoto[] =
  698. {
  699. -1, 4, 5, 6, 29, 35, 36, 69, 70, 7,
  700. 16, 17, 18, 60, 73, 120, 62, 63, 64, 65,
  701. 66
  702. };
  703.  
  704. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  705.   STATE-NUM. */
  706. #define YYPACT_NINF -105
  707. static const yytype_int16 yypact[] =
  708. {
  709. 33, -105, -105, -105, 8, -105, 33, -26, -105, -105,
  710. 5, 0, 4, 15, -105, 6, -8, -1, 24, 42,
  711. 73, 36, 57, 0, -105, 61, 64, -105, 62, -105,
  712. -105, -105, -105, 29, 50, 66, 29, 52, 74, 105,
  713. -105, -17, 0, -105, -105, -105, 144, 92, 144, 77,
  714. 78, 79, 81, 85, 91, 94, 96, 97, -105, 1,
  715. 175, 104, 98, 105, -105, -105, -105, 0, 82, -105,
  716. 84, 95, 55, -105, -105, 217, 87, 88, 144, 89,
  717. 90, 144, 144, 144, 105, 59, 144, 144, 144, 144,
  718. 144, 144, 144, 144, 144, 144, 144, 144, 144, -105,
  719. 144, -105, -105, 114, -105, -105, 57, -105, 117, 119,
  720. 237, 123, 125, 112, 252, 267, 282, 115, -105, 150,
  721. 128, 312, 55, 55, 55, 55, -5, -5, -5, 63,
  722. 63, -105, -105, -105, 189, 57, -105, -105, -105, 132,
  723. 135, 144, 136, 134, 154, 144, 144, -105, -105, -105,
  724. -105, -105, -105, 297, -105, 105, 105, 203, -105, 138,
  725. 151, 152, 105, -105, 145, -105, 155, 178, 182, 105,
  726. 105, 191, 205, -105, -105
  727. };
  728.  
  729. /* YYPGOTO[NTERM-NUM]. */
  730. static const yytype_int16 yypgoto[] =
  731. {
  732. -105, -105, 235, -105, -104, 206, -105, -105, 177, -105,
  733. -3, -105, -10, -35, -39, 109, -62, -105, -105, -105,
  734. -105
  735. };
  736.  
  737. /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
  738.   positive, shift that token. If negative, reduce the rule which
  739.   number is the opposite. If zero, do what YYDEFACT says.
  740.   If YYTABLE_NINF, syntax error. */
  741. #define YYTABLE_NINF -1
  742. static const yytype_uint8 yytable[] =
  743. {
  744. 61, 102, 136, 12, 13, 21, 14, 67, 8, 12,
  745. 13, 72, 14, 75, 94, 95, 96, 97, 98, 10,
  746. 30, 22, 117, 37, 61, 85, 37, 86, 68, 11,
  747. 19, 150, 12, 13, 34, 14, 1, 2, 3, 71,
  748. 112, 20, 23, 110, 15, 61, 114, 115, 116, 25,
  749. 119, 121, 122, 123, 124, 125, 126, 127, 128, 129,
  750. 130, 131, 132, 133, 103, 134, 43, 44, 45, 24,
  751. 91, 92, 93, 46, 94, 95, 96, 97, 98, 47,
  752. 26, 27, 28, 48, 96, 97, 98, 33, 118, 31,
  753. 49, 50, 32, 160, 161, 38, 39, 41, 42, 74,
  754. 166, 76, 77, 78, 59, 79, 153, 171, 172, 80,
  755. 157, 119, 43, 44, 45, 81, 61, 61, 82, 46,
  756. 83, 84, 100, 61, 106, 47, 105, 68, 101, 48,
  757. 61, 61, 108, 109, 111, 113, 49, 50, 51, 52,
  758. 53, 54, 55, 135, 56, 57, 137, 58, 138, 86,
  759. 59, 43, 44, 45, 140, 141, 145, 147, 46, 155,
  760. 87, 88, 89, 90, 47, 91, 92, 93, 48, 94,
  761. 95, 96, 97, 98, 151, 49, 50, 152, 154, 156,
  762. 163, 164, 165, 167, 168, 87, 88, 89, 90, 59,
  763. 91, 92, 93, 146, 94, 95, 96, 97, 98, 87,
  764. 88, 89, 90, 169, 91, 92, 93, 170, 94, 95,
  765. 96, 97, 98, 87, 88, 89, 90, 99, 91, 92,
  766. 93, 173, 94, 95, 96, 97, 98, 87, 88, 89,
  767. 90, 149, 91, 92, 93, 174, 94, 95, 96, 97,
  768. 98, 9, 40, 0, 162, 104, 107, 87, 88, 89,
  769. 90, 0, 91, 92, 93, 158, 94, 95, 96, 97,
  770. 98, 0, 87, 88, 89, 90, 139, 91, 92, 93,
  771. 0, 94, 95, 96, 97, 98, 0, 87, 88, 89,
  772. 90, 142, 91, 92, 93, 0, 94, 95, 96, 97,
  773. 98, 0, 87, 88, 89, 90, 143, 91, 92, 93,
  774. 0, 94, 95, 96, 97, 98, 0, 87, 88, 89,
  775. 90, 144, 91, 92, 93, 0, 94, 95, 96, 97,
  776. 98, 0, 87, 88, 89, 90, 159, 91, 92, 93,
  777. 0, 94, 95, 96, 97, 98, 0, 0, 0, 0,
  778. 148
  779. };
  780.  
  781. static const yytype_int16 yycheck[] =
  782. {
  783. 39, 63, 106, 3, 4, 15, 6, 24, 0, 3,
  784. 4, 46, 6, 48, 19, 20, 21, 22, 23, 45,
  785. 23, 29, 84, 33, 63, 24, 36, 26, 45, 24,
  786. 26, 135, 3, 4, 5, 6, 3, 4, 5, 42,
  787. 79, 26, 43, 78, 44, 84, 81, 82, 83, 7,
  788. 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
  789. 95, 96, 97, 98, 67, 100, 7, 8, 9, 45,
  790. 15, 16, 17, 14, 19, 20, 21, 22, 23, 20,
  791. 7, 45, 25, 24, 21, 22, 23, 25, 29, 28,
  792. 31, 32, 28, 155, 156, 45, 30, 45, 24, 7,
  793. 162, 24, 24, 24, 45, 24, 141, 169, 170, 24,
  794. 145, 146, 7, 8, 9, 24, 155, 156, 24, 14,
  795. 24, 24, 18, 162, 29, 20, 42, 45, 30, 24,
  796. 169, 170, 45, 45, 45, 45, 31, 32, 33, 34,
  797. 35, 36, 37, 29, 39, 40, 29, 42, 29, 26,
  798. 45, 7, 8, 9, 29, 43, 41, 29, 14, 25,
  799. 10, 11, 12, 13, 20, 15, 16, 17, 24, 19,
  800. 20, 21, 22, 23, 42, 31, 32, 42, 42, 25,
  801. 42, 30, 30, 38, 29, 10, 11, 12, 13, 45,
  802. 15, 16, 17, 43, 19, 20, 21, 22, 23, 10,
  803. 11, 12, 13, 25, 15, 16, 17, 25, 19, 20,
  804. 21, 22, 23, 10, 11, 12, 13, 42, 15, 16,
  805. 17, 30, 19, 20, 21, 22, 23, 10, 11, 12,
  806. 13, 42, 15, 16, 17, 30, 19, 20, 21, 22,
  807. 23, 6, 36, -1, 41, 68, 29, 10, 11, 12,
  808. 13, -1, 15, 16, 17, 146, 19, 20, 21, 22,
  809. 23, -1, 10, 11, 12, 13, 29, 15, 16, 17,
  810. -1, 19, 20, 21, 22, 23, -1, 10, 11, 12,
  811. 13, 29, 15, 16, 17, -1, 19, 20, 21, 22,
  812. 23, -1, 10, 11, 12, 13, 29, 15, 16, 17,
  813. -1, 19, 20, 21, 22, 23, -1, 10, 11, 12,
  814. 13, 29, 15, 16, 17, -1, 19, 20, 21, 22,
  815. 23, -1, 10, 11, 12, 13, 29, 15, 16, 17,
  816. -1, 19, 20, 21, 22, 23, -1, -1, -1, -1,
  817. 28
  818. };
  819.  
  820. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  821.   symbol of state STATE-NUM. */
  822. static const yytype_uint8 yystos[] =
  823. {
  824. 0, 3, 4, 5, 47, 48, 49, 55, 0, 48,
  825. 45, 24, 3, 4, 6, 44, 56, 57, 58, 26,
  826. 26, 58, 29, 43, 45, 7, 7, 45, 25, 50,
  827. 56, 28, 28, 25, 5, 51, 52, 58, 45, 30,
  828. 51, 45, 24, 7, 8, 9, 14, 20, 24, 31,
  829. 32, 33, 34, 35, 36, 37, 39, 40, 42, 45,
  830. 59, 60, 62, 63, 64, 65, 66, 24, 45, 53,
  831. 54, 56, 59, 60, 7, 59, 24, 24, 24, 24,
  832. 24, 24, 24, 24, 24, 24, 26, 10, 11, 12,
  833. 13, 15, 16, 17, 19, 20, 21, 22, 23, 42,
  834. 18, 30, 62, 56, 54, 42, 29, 29, 45, 45,
  835. 59, 45, 60, 45, 59, 59, 59, 62, 29, 59,
  836. 61, 59, 59, 59, 59, 59, 59, 59, 59, 59,
  837. 59, 59, 59, 59, 59, 29, 50, 29, 29, 29,
  838. 29, 43, 29, 29, 29, 41, 43, 29, 28, 42,
  839. 50, 42, 42, 59, 42, 25, 25, 59, 61, 29,
  840. 62, 62, 41, 42, 30, 30, 62, 38, 29, 25,
  841. 25, 62, 62, 30, 30
  842. };
  843.  
  844. #define yyerrok (yyerrstatus = 0)
  845. #define yyclearin (yychar = YYEMPTY)
  846. #define YYEMPTY (-2)
  847. #define YYEOF 0
  848.  
  849. #define YYACCEPT goto yyacceptlab
  850. #define YYABORT goto yyabortlab
  851. #define YYERROR goto yyerrorlab
  852.  
  853.  
  854. /* Like YYERROR except do call yyerror. This remains here temporarily
  855.   to ease the transition to the new meaning of YYERROR, for GCC.
  856.   Once GCC version 2 has supplanted version 1, this can go. */
  857.  
  858. #define YYFAIL goto yyerrlab
  859.  
  860. #define YYRECOVERING() (!!yyerrstatus)
  861.  
  862. #define YYBACKUP(Token, Value) \
  863. do \
  864.   if (yychar == YYEMPTY && yylen == 1) \
  865.   { \
  866.   yychar = (Token); \
  867.   yylval = (Value); \
  868.   yytoken = YYTRANSLATE (yychar); \
  869.   YYPOPSTACK (1); \
  870.   goto yybackup; \
  871.   } \
  872.   else \
  873.   { \
  874.   yyerror (YY_("syntax error: cannot back up")); \
  875.   YYERROR; \
  876.   } \
  877. while (YYID (0))
  878.  
  879.  
  880. #define YYTERROR 1
  881. #define YYERRCODE 256
  882.  
  883.  
  884. /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
  885.   If N is 0, then set CURRENT to the empty location which ends
  886.   the previous symbol: RHS[0] (always defined). */
  887.  
  888. #define YYRHSLOC(Rhs, K) ((Rhs)[K])
  889. #ifndef YYLLOC_DEFAULT
  890. # define YYLLOC_DEFAULT(Current, Rhs, N) \
  891.   do \
  892.   if (YYID (N)) \
  893. { \
  894. (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
  895. (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
  896. (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
  897. (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
  898. } \
  899.   else \
  900. { \
  901. (Current).first_line = (Current).last_line = \
  902. YYRHSLOC (Rhs, 0).last_line; \
  903. (Current).first_column = (Current).last_column = \
  904. YYRHSLOC (Rhs, 0).last_column; \
  905. } \
  906.   while (YYID (0))
  907. #endif
  908.  
  909.  
  910. /* YY_LOCATION_PRINT -- Print the location on the stream.
  911.   This macro was not mandated originally: define only if we know
  912.   we won't break user code: when these are the locations we know. */
  913.  
  914. #ifndef YY_LOCATION_PRINT
  915. # if YYLTYPE_IS_TRIVIAL
  916. # define YY_LOCATION_PRINT(File, Loc) \
  917.   fprintf (File, "%d.%d-%d.%d", \
  918. (Loc).first_line, (Loc).first_column, \
  919. (Loc).last_line, (Loc).last_column)
  920. # else
  921. # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  922. # endif
  923. #endif
  924.  
  925.  
  926. /* YYLEX -- calling `yylex' with the right arguments. */
  927.  
  928. #ifdef YYLEX_PARAM
  929. # define YYLEX yylex (YYLEX_PARAM)
  930. #else
  931. # define YYLEX yylex ()
  932. #endif
  933.  
  934. /* Enable debugging if requested. */
  935. #if YYDEBUG
  936.  
  937. # ifndef YYFPRINTF
  938. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  939. # define YYFPRINTF fprintf
  940. # endif
  941.  
  942. # define YYDPRINTF(Args) \
  943. do { \
  944.   if (yydebug) \
  945.   YYFPRINTF Args; \
  946. } while (YYID (0))
  947.  
  948. # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
  949. do { \
  950.   if (yydebug) \
  951.   { \
  952.   YYFPRINTF (stderr, "%s ", Title); \
  953.   yy_symbol_print (stderr, \
  954. Type, Value, Location); \
  955.   YYFPRINTF (stderr, "\n"); \
  956.   } \
  957. } while (YYID (0))
  958.  
  959.  
  960. /*--------------------------------.
  961. | Print this symbol on YYOUTPUT. |
  962. `--------------------------------*/
  963.  
  964. /*ARGSUSED*/
  965. #if (defined __STDC__ || defined __C99__FUNC__ \
  966.   || defined __cplusplus || defined _MSC_VER)
  967. static void
  968. yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
  969. #else
  970. static void
  971. yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
  972. FILE *yyoutput;
  973. int yytype;
  974. YYSTYPE const * const yyvaluep;
  975. YYLTYPE const * const yylocationp;
  976. #endif
  977. {
  978. if (!yyvaluep)
  979. return;
  980. YYUSE (yylocationp);
  981. # ifdef YYPRINT
  982. if (yytype < YYNTOKENS)
  983. YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  984. # else
  985. YYUSE (yyoutput);
  986. # endif
  987. switch (yytype)
  988. {
  989. default:
  990. break;
  991. }
  992. }
  993.  
  994.  
  995. /*--------------------------------.
  996. | Print this symbol on YYOUTPUT. |
  997. `--------------------------------*/
  998.  
  999. #if (defined __STDC__ || defined __C99__FUNC__ \
  1000.   || defined __cplusplus || defined _MSC_VER)
  1001. static void
  1002. yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
  1003. #else
  1004. static void
  1005. yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
  1006. FILE *yyoutput;
  1007. int yytype;
  1008. YYSTYPE const * const yyvaluep;
  1009. YYLTYPE const * const yylocationp;
  1010. #endif
  1011. {
  1012. if (yytype < YYNTOKENS)
  1013. YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
  1014. else
  1015. YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
  1016.  
  1017. YY_LOCATION_PRINT (yyoutput, *yylocationp);
  1018. YYFPRINTF (yyoutput, ": ");
  1019. yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
  1020. YYFPRINTF (yyoutput, ")");
  1021. }
  1022.  
  1023. /*------------------------------------------------------------------.
  1024. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  1025. | TOP (included). |
  1026. `------------------------------------------------------------------*/
  1027.  
  1028. #if (defined __STDC__ || defined __C99__FUNC__ \
  1029.   || defined __cplusplus || defined _MSC_VER)
  1030. static void
  1031. yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
  1032. #else
  1033. static void
  1034. yy_stack_print (yybottom, yytop)
  1035. yytype_int16 *yybottom;
  1036. yytype_int16 *yytop;
  1037. #endif
  1038. {
  1039. YYFPRINTF (stderr, "Stack now");
  1040. for (; yybottom <= yytop; yybottom++)
  1041. {
  1042. int yybot = *yybottom;
  1043. YYFPRINTF (stderr, " %d", yybot);
  1044. }
  1045. YYFPRINTF (stderr, "\n");
  1046. }
  1047.  
  1048. # define YY_STACK_PRINT(Bottom, Top) \
  1049. do { \
  1050.   if (yydebug) \
  1051.   yy_stack_print ((Bottom), (Top)); \
  1052. } while (YYID (0))
  1053.  
  1054.  
  1055. /*------------------------------------------------.
  1056. | Report that the YYRULE is going to be reduced. |
  1057. `------------------------------------------------*/
  1058.  
  1059. #if (defined __STDC__ || defined __C99__FUNC__ \
  1060.   || defined __cplusplus || defined _MSC_VER)
  1061. static void
  1062. yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
  1063. #else
  1064. static void
  1065. yy_reduce_print (yyvsp, yylsp, yyrule)
  1066. YYSTYPE *yyvsp;
  1067. YYLTYPE *yylsp;
  1068. int yyrule;
  1069. #endif
  1070. {
  1071. int yynrhs = yyr2[yyrule];
  1072. int yyi;
  1073. unsigned long int yylno = yyrline[yyrule];
  1074. YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  1075. yyrule - 1, yylno);
  1076. /* The symbols being reduced. */
  1077. for (yyi = 0; yyi < yynrhs; yyi++)
  1078. {
  1079. YYFPRINTF (stderr, " $%d = ", yyi + 1);
  1080. yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
  1081. &(yyvsp[(yyi + 1) - (yynrhs)])
  1082. , &(yylsp[(yyi + 1) - (yynrhs)]) );
  1083. YYFPRINTF (stderr, "\n");
  1084. }
  1085. }
  1086.  
  1087. # define YY_REDUCE_PRINT(Rule) \
  1088. do { \
  1089.   if (yydebug) \
  1090.   yy_reduce_print (yyvsp, yylsp, Rule); \
  1091. } while (YYID (0))
  1092.  
  1093. /* Nonzero means print parse trace. It is left uninitialized so that
  1094.   multiple parsers can coexist. */
  1095. int yydebug;
  1096. #else /* !YYDEBUG */
  1097. # define YYDPRINTF(Args)
  1098. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  1099. # define YY_STACK_PRINT(Bottom, Top)
  1100. # define YY_REDUCE_PRINT(Rule)
  1101. #endif /* !YYDEBUG */
  1102.  
  1103.  
  1104. /* YYINITDEPTH -- initial size of the parser's stacks. */
  1105. #ifndef YYINITDEPTH
  1106. # define YYINITDEPTH 200
  1107. #endif
  1108.  
  1109. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  1110.   if the built-in stack extension method is used).
  1111.  
  1112.   Do not make this value too large; the results are undefined if
  1113.   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  1114.   evaluated with infinite-precision integer arithmetic. */
  1115.  
  1116. #ifndef YYMAXDEPTH
  1117. # define YYMAXDEPTH 10000
  1118. #endif
  1119.  
  1120.  
  1121. #if YYERROR_VERBOSE
  1122.  
  1123. # ifndef yystrlen
  1124. # if defined __GLIBC__ && defined _STRING_H
  1125. # define yystrlen strlen
  1126. # else
  1127. /* Return the length of YYSTR. */
  1128. #if (defined __STDC__ || defined __C99__FUNC__ \
  1129.   || defined __cplusplus || defined _MSC_VER)
  1130. static YYSIZE_T
  1131. yystrlen (const char *yystr)
  1132. #else
  1133. static YYSIZE_T
  1134. yystrlen (yystr)
  1135. const char *yystr;
  1136. #endif
  1137. {
  1138. YYSIZE_T yylen;
  1139. for (yylen = 0; yystr[yylen]; yylen++)
  1140. continue;
  1141. return yylen;
  1142. }
  1143. # endif
  1144. # endif
  1145.  
  1146. # ifndef yystpcpy
  1147. # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  1148. # define yystpcpy stpcpy
  1149. # else
  1150. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  1151.   YYDEST. */
  1152. #if (defined __STDC__ || defined __C99__FUNC__ \
  1153.   || defined __cplusplus || defined _MSC_VER)
  1154. static char *
  1155. yystpcpy (char *yydest, const char *yysrc)
  1156. #else
  1157. static char *
  1158. yystpcpy (yydest, yysrc)
  1159. char *yydest;
  1160. const char *yysrc;
  1161. #endif
  1162. {
  1163. char *yyd = yydest;
  1164. const char *yys = yysrc;
  1165.  
  1166. while ((*yyd++ = *yys++) != '\0')
  1167. continue;
  1168.  
  1169. return yyd - 1;
  1170. }
  1171. # endif
  1172. # endif
  1173.  
  1174. # ifndef yytnamerr
  1175. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  1176.   quotes and backslashes, so that it's suitable for yyerror. The
  1177.   heuristic is that double-quoting is unnecessary unless the string
  1178.   contains an apostrophe, a comma, or backslash (other than
  1179.   backslash-backslash). YYSTR is taken from yytname. If YYRES is
  1180.   null, do not copy; instead, return the length of what the result
  1181.   would have been. */
  1182. static YYSIZE_T
  1183. yytnamerr (char *yyres, const char *yystr)
  1184. {
  1185. if (*yystr == '"')
  1186. {
  1187. YYSIZE_T yyn = 0;
  1188. char const *yyp = yystr;
  1189.  
  1190. for (;;)
  1191. switch (*++yyp)
  1192. {
  1193. case '\'':
  1194. case ',':
  1195. goto do_not_strip_quotes;
  1196.  
  1197. case '\\':
  1198. if (*++yyp != '\\')
  1199. goto do_not_strip_quotes;
  1200. /* Fall through. */
  1201. default:
  1202. if (yyres)
  1203. yyres[yyn] = *yyp;
  1204. yyn++;
  1205. break;
  1206.  
  1207. case '"':
  1208. if (yyres)
  1209. yyres[yyn] = '\0';
  1210. return yyn;
  1211. }
  1212. do_not_strip_quotes: ;
  1213. }
  1214.  
  1215. if (! yyres)
  1216. return yystrlen (yystr);
  1217.  
  1218. return yystpcpy (yyres, yystr) - yyres;
  1219. }
  1220. # endif
  1221.  
  1222. /* Copy into YYRESULT an error message about the unexpected token
  1223.   YYCHAR while in state YYSTATE. Return the number of bytes copied,
  1224.   including the terminating null byte. If YYRESULT is null, do not
  1225.   copy anything; just return the number of bytes that would be
  1226.   copied. As a special case, return 0 if an ordinary "syntax error"
  1227.   message will do. Return YYSIZE_MAXIMUM if overflow occurs during
  1228.   size calculation. */
  1229. static YYSIZE_T
  1230. yysyntax_error (char *yyresult, int yystate, int yychar)
  1231. {
  1232. int yyn = yypact[yystate];
  1233.  
  1234. if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
  1235. return 0;
  1236. else
  1237. {
  1238. int yytype = YYTRANSLATE (yychar);
  1239. YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
  1240. YYSIZE_T yysize = yysize0;
  1241. YYSIZE_T yysize1;
  1242. int yysize_overflow = 0;
  1243. enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  1244. char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  1245. int yyx;
  1246.  
  1247. # if 0
  1248. /* This is so xgettext sees the translatable formats that are
  1249. constructed on the fly. */
  1250. YY_("syntax error, unexpected %s");
  1251. YY_("syntax error, unexpected %s, expecting %s");
  1252. YY_("syntax error, unexpected %s, expecting %s or %s");
  1253. YY_("syntax error, unexpected %s, expecting %s or %s or %s");
  1254. YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
  1255. # endif
  1256. char *yyfmt;
  1257. char const *yyf;
  1258. static char const yyunexpected[] = "syntax error, unexpected %s";
  1259. static char const yyexpecting[] = ", expecting %s";
  1260. static char const yyor[] = " or %s";
  1261. char yyformat[sizeof yyunexpected
  1262. + sizeof yyexpecting - 1
  1263. + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
  1264. * (sizeof yyor - 1))];
  1265. char const *yyprefix = yyexpecting;
  1266.  
  1267. /* Start YYX at -YYN if negative to avoid negative indexes in
  1268. YYCHECK. */
  1269. int yyxbegin = yyn < 0 ? -yyn : 0;
  1270.  
  1271. /* Stay within bounds of both yycheck and yytname. */
  1272. int yychecklim = YYLAST - yyn + 1;
  1273. int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  1274. int yycount = 1;
  1275.  
  1276. yyarg[0] = yytname[yytype];
  1277. yyfmt = yystpcpy (yyformat, yyunexpected);
  1278.  
  1279. for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  1280. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
  1281. {
  1282. if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
  1283. {
  1284. yycount = 1;
  1285. yysize = yysize0;
  1286. yyformat[sizeof yyunexpected - 1] = '\0';
  1287. break;
  1288. }
  1289. yyarg[yycount++] = yytname[yyx];
  1290. yysize1 = yysize + yytnamerr (0, yytname[yyx]);
  1291. yysize_overflow |= (yysize1 < yysize);
  1292. yysize = yysize1;
  1293. yyfmt = yystpcpy (yyfmt, yyprefix);
  1294. yyprefix = yyor;
  1295. }
  1296.  
  1297. yyf = YY_(yyformat);
  1298. yysize1 = yysize + yystrlen (yyf);
  1299. yysize_overflow |= (yysize1 < yysize);
  1300. yysize = yysize1;
  1301.  
  1302. if (yysize_overflow)
  1303. return YYSIZE_MAXIMUM;
  1304.  
  1305. if (yyresult)
  1306. {
  1307. /* Avoid sprintf, as that infringes on the user's name space.
  1308. Don't have undefined behavior even if the translation
  1309. produced a string with the wrong number of "%s"s. */
  1310. char *yyp = yyresult;
  1311. int yyi = 0;
  1312. while ((*yyp = *yyf) != '\0')
  1313. {
  1314. if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
  1315. {
  1316. yyp += yytnamerr (yyp, yyarg[yyi++]);
  1317. yyf += 2;
  1318. }
  1319. else
  1320. {
  1321. yyp++;
  1322. yyf++;
  1323. }
  1324. }
  1325. }
  1326. return yysize;
  1327. }
  1328. }
  1329. #endif /* YYERROR_VERBOSE */
  1330.  
  1331. /*-----------------------------------------------.
  1332. | Release the memory associated to this symbol. |
  1333. `-----------------------------------------------*/
  1334.  
  1335. /*ARGSUSED*/
  1336. #if (defined __STDC__ || defined __C99__FUNC__ \
  1337.   || defined __cplusplus || defined _MSC_VER)
  1338. static void
  1339. yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
  1340. #else
  1341. static void
  1342. yydestruct (yymsg, yytype, yyvaluep, yylocationp)
  1343. const char *yymsg;
  1344. int yytype;
  1345. YYSTYPE *yyvaluep;
  1346. YYLTYPE *yylocationp;
  1347. #endif
  1348. {
  1349. YYUSE (yyvaluep);
  1350. YYUSE (yylocationp);
  1351.  
  1352. if (!yymsg)
  1353. yymsg = "Deleting";
  1354. YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  1355.  
  1356. switch (yytype)
  1357. {
  1358.  
  1359. default:
  1360. break;
  1361. }
  1362. }
  1363.  
  1364. /* Prevent warnings from -Wmissing-prototypes. */
  1365. #ifdef YYPARSE_PARAM
  1366. #if defined __STDC__ || defined __cplusplus
  1367. int yyparse (void *YYPARSE_PARAM);
  1368. #else
  1369. int yyparse ();
  1370. #endif
  1371. #else /* ! YYPARSE_PARAM */
  1372. #if defined __STDC__ || defined __cplusplus
  1373. int yyparse (void);
  1374. #else
  1375. int yyparse ();
  1376. #endif
  1377. #endif /* ! YYPARSE_PARAM */
  1378.  
  1379.  
  1380. /* The lookahead symbol. */
  1381. int yychar;
  1382.  
  1383. /* The semantic value of the lookahead symbol. */
  1384. YYSTYPE yylval;
  1385.  
  1386. /* Location data for the lookahead symbol. */
  1387. YYLTYPE yylloc;
  1388.  
  1389. /* Number of syntax errors so far. */
  1390. int yynerrs;
  1391.  
  1392.  
  1393.  
  1394. /*-------------------------.
  1395. | yyparse or yypush_parse. |
  1396. `-------------------------*/
  1397.  
  1398. #ifdef YYPARSE_PARAM
  1399. #if (defined __STDC__ || defined __C99__FUNC__ \
  1400.   || defined __cplusplus || defined _MSC_VER)
  1401. int
  1402. yyparse (void *YYPARSE_PARAM)
  1403. #else
  1404. int
  1405. yyparse (YYPARSE_PARAM)
  1406. void *YYPARSE_PARAM;
  1407. #endif
  1408. #else /* ! YYPARSE_PARAM */
  1409. #if (defined __STDC__ || defined __C99__FUNC__ \
  1410.   || defined __cplusplus || defined _MSC_VER)
  1411. int
  1412. yyparse (void)
  1413. #else
  1414. int
  1415. yyparse ()
  1416.  
  1417. #endif
  1418. #endif
  1419. {
  1420.  
  1421.  
  1422. int yystate;
  1423. /* Number of tokens to shift before error messages enabled. */
  1424. int yyerrstatus;
  1425.  
  1426. /* The stacks and their tools:
  1427.   `yyss': related to states.
  1428.   `yyvs': related to semantic values.
  1429.   `yyls': related to locations.
  1430.  
  1431.   Refer to the stacks thru separate pointers, to allow yyoverflow
  1432.   to reallocate them elsewhere. */
  1433.  
  1434. /* The state stack. */
  1435. yytype_int16 yyssa[YYINITDEPTH];
  1436. yytype_int16 *yyss;
  1437. yytype_int16 *yyssp;
  1438.  
  1439. /* The semantic value stack. */
  1440. YYSTYPE yyvsa[YYINITDEPTH];
  1441. YYSTYPE *yyvs;
  1442. YYSTYPE *yyvsp;
  1443.  
  1444. /* The location stack. */
  1445. YYLTYPE yylsa[YYINITDEPTH];
  1446. YYLTYPE *yyls;
  1447. YYLTYPE *yylsp;
  1448.  
  1449. /* The locations where the error started and ended. */
  1450. YYLTYPE yyerror_range[2];
  1451.  
  1452. YYSIZE_T yystacksize;
  1453.  
  1454. int yyn;
  1455. int yyresult;
  1456. /* Lookahead token as an internal (translated) token number. */
  1457. int yytoken;
  1458. /* The variables used to return semantic value and location from the
  1459.   action routines. */
  1460. YYSTYPE yyval;
  1461. YYLTYPE yyloc;
  1462.  
  1463. #if YYERROR_VERBOSE
  1464. /* Buffer for error messages, and its allocated size. */
  1465. char yymsgbuf[128];
  1466. char *yymsg = yymsgbuf;
  1467. YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
  1468. #endif
  1469.  
  1470. #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
  1471.  
  1472. /* The number of symbols on the RHS of the reduced rule.
  1473.   Keep to zero when no symbol should be popped. */
  1474. int yylen = 0;
  1475.  
  1476. yytoken = 0;
  1477. yyss = yyssa;
  1478. yyvs = yyvsa;
  1479. yyls = yylsa;
  1480. yystacksize = YYINITDEPTH;
  1481.  
  1482. YYDPRINTF ((stderr, "Starting parse\n"));
  1483.  
  1484. yystate = 0;
  1485. yyerrstatus = 0;
  1486. yynerrs = 0;
  1487. yychar = YYEMPTY; /* Cause a token to be read. */
  1488.  
  1489. /* Initialize stack pointers.
  1490.   Waste one element of value and location stack
  1491.   so that they stay on the same level as the state stack.
  1492.   The wasted elements are never initialized. */
  1493. yyssp = yyss;
  1494. yyvsp = yyvs;
  1495. yylsp = yyls;
  1496.  
  1497. #if YYLTYPE_IS_TRIVIAL
  1498. /* Initialize the default location before parsing starts. */
  1499. yylloc.first_line = yylloc.last_line = 1;
  1500. yylloc.first_column = yylloc.last_column = 1;
  1501. #endif
  1502.  
  1503. goto yysetstate;
  1504.  
  1505. /*------------------------------------------------------------.
  1506. | yynewstate -- Push a new state, which is found in yystate. |
  1507. `------------------------------------------------------------*/
  1508. yynewstate:
  1509. /* In all cases, when you get here, the value and location stacks
  1510.   have just been pushed. So pushing a state here evens the stacks. */
  1511. yyssp++;
  1512.  
  1513. yysetstate:
  1514. *yyssp = yystate;
  1515.  
  1516. if (yyss + yystacksize - 1 <= yyssp)
  1517. {
  1518. /* Get the current used size of the three stacks, in elements. */
  1519. YYSIZE_T yysize = yyssp - yyss + 1;
  1520.  
  1521. #ifdef yyoverflow
  1522. {
  1523. /* Give user a chance to reallocate the stack. Use copies of
  1524. these so that the &'s don't force the real ones into
  1525. memory. */
  1526. YYSTYPE *yyvs1 = yyvs;
  1527. yytype_int16 *yyss1 = yyss;
  1528. YYLTYPE *yyls1 = yyls;
  1529.  
  1530. /* Each stack pointer address is followed by the size of the
  1531. data in use in that stack, in bytes. This used to be a
  1532. conditional around just the two extra args, but that might
  1533. be undefined if yyoverflow is a macro. */
  1534. yyoverflow (YY_("memory exhausted"),
  1535. &yyss1, yysize * sizeof (*yyssp),
  1536. &yyvs1, yysize * sizeof (*yyvsp),
  1537. &yyls1, yysize * sizeof (*yylsp),
  1538. &yystacksize);
  1539.  
  1540. yyls = yyls1;
  1541. yyss = yyss1;
  1542. yyvs = yyvs1;
  1543. }
  1544. #else /* no yyoverflow */
  1545. # ifndef YYSTACK_RELOCATE
  1546. goto yyexhaustedlab;
  1547. # else
  1548. /* Extend the stack our own way. */
  1549. if (YYMAXDEPTH <= yystacksize)
  1550. goto yyexhaustedlab;
  1551. yystacksize *= 2;
  1552. if (YYMAXDEPTH < yystacksize)
  1553. yystacksize = YYMAXDEPTH;
  1554.  
  1555. {
  1556. yytype_int16 *yyss1 = yyss;
  1557. union yyalloc *yyptr =
  1558. (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  1559. if (! yyptr)
  1560. goto yyexhaustedlab;
  1561. YYSTACK_RELOCATE (yyss_alloc, yyss);
  1562. YYSTACK_RELOCATE (yyvs_alloc, yyvs);
  1563. YYSTACK_RELOCATE (yyls_alloc, yyls);
  1564. # undef YYSTACK_RELOCATE
  1565. if (yyss1 != yyssa)
  1566. YYSTACK_FREE (yyss1);
  1567. }
  1568. # endif
  1569. #endif /* no yyoverflow */
  1570.  
  1571. yyssp = yyss + yysize - 1;
  1572. yyvsp = yyvs + yysize - 1;
  1573. yylsp = yyls + yysize - 1;
  1574.  
  1575. YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  1576. (unsigned long int) yystacksize));
  1577.  
  1578. if (yyss + yystacksize - 1 <= yyssp)
  1579. YYABORT;
  1580. }
  1581.  
  1582. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  1583.  
  1584. if (yystate == YYFINAL)
  1585. YYACCEPT;
  1586.  
  1587. goto yybackup;
  1588.  
  1589. /*-----------.
  1590. | yybackup. |
  1591. `-----------*/
  1592. yybackup:
  1593.  
  1594. /* Do appropriate processing given the current state. Read a
  1595.   lookahead token if we need one and don't already have one. */
  1596.  
  1597. /* First try to decide what to do without reference to lookahead token. */
  1598. yyn = yypact[yystate];
  1599. if (yyn == YYPACT_NINF)
  1600. goto yydefault;
  1601.  
  1602. /* Not known => get a lookahead token if don't already have one. */
  1603.  
  1604. /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
  1605. if (yychar == YYEMPTY)
  1606. {
  1607. YYDPRINTF ((stderr, "Reading a token: "));
  1608. yychar = YYLEX;
  1609. }
  1610.  
  1611. if (yychar <= YYEOF)
  1612. {
  1613. yychar = yytoken = YYEOF;
  1614. YYDPRINTF ((stderr, "Now at end of input.\n"));
  1615. }
  1616. else
  1617. {
  1618. yytoken = YYTRANSLATE (yychar);
  1619. YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  1620. }
  1621.  
  1622. /* If the proper action on seeing token YYTOKEN is to reduce or to
  1623.   detect an error, take that action. */
  1624. yyn += yytoken;
  1625. if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  1626. goto yydefault;
  1627. yyn = yytable[yyn];
  1628. if (yyn <= 0)
  1629. {
  1630. if (yyn == 0 || yyn == YYTABLE_NINF)
  1631. goto yyerrlab;
  1632. yyn = -yyn;
  1633. goto yyreduce;
  1634. }
  1635.  
  1636. /* Count tokens shifted since error; after three, turn off error
  1637.   status. */
  1638. if (yyerrstatus)
  1639. yyerrstatus--;
  1640.  
  1641. /* Shift the lookahead token. */
  1642. YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  1643.  
  1644. /* Discard the shifted token. */
  1645. yychar = YYEMPTY;
  1646.  
  1647. yystate = yyn;
  1648. *++yyvsp = yylval;
  1649. *++yylsp = yylloc;
  1650. goto yynewstate;
  1651.  
  1652.  
  1653. /*-----------------------------------------------------------.
  1654. | yydefault -- do the default action for the current state. |
  1655. `-----------------------------------------------------------*/
  1656. yydefault:
  1657. yyn = yydefact[yystate];
  1658. if (yyn == 0)
  1659. goto yyerrlab;
  1660. goto yyreduce;
  1661.  
  1662.  
  1663. /*-----------------------------.
  1664. | yyreduce -- Do a reduction. |
  1665. `-----------------------------*/
  1666. yyreduce:
  1667. /* yyn is the number of a rule to reduce with. */
  1668. yylen = yyr2[yyn];
  1669.  
  1670. /* If YYLEN is nonzero, implement the default value of the action:
  1671.   `$$ = $1'.
  1672.  
  1673.   Otherwise, the following line sets YYVAL to garbage.
  1674.   This behavior is undocumented and Bison
  1675.   users should not rely upon it. Assigning to YYVAL
  1676.   unconditionally makes the parser a bit smaller, and it avoids a
  1677.   GCC warning that YYVAL may be used uninitialized. */
  1678. yyval = yyvsp[1-yylen];
  1679.  
  1680. /* Default location. */
  1681. YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
  1682. YY_REDUCE_PRINT (yyn);
  1683. switch (yyn)
  1684. {
  1685. case 2:
  1686.  
  1687. /* Line 1455 of yacc.c */
  1688. #line 83 "lsd10.y"
  1689. {
  1690. rootNode=(yyvsp[(1) - (1)].node);//createASTNode(10,createASTNodeInfo("Root", NODE_TYPE_NOTHING, NO_VAL),$1,NULL);
  1691. }
  1692. break;
  1693.  
  1694. case 3:
  1695.  
  1696. /* Line 1455 of yacc.c */
  1697. #line 89 "lsd10.y"
  1698. {(yyval.node)=NULL;}
  1699. break;
  1700.  
  1701. case 4:
  1702.  
  1703. /* Line 1455 of yacc.c */
  1704. #line 90 "lsd10.y"
  1705. {
  1706. #if(VERBOSE_LEVEL<=DEB_Y)
  1707. printMsg(DEB_Y,"Functions node", __FILE__, __LINE__);
  1708. #endif
  1709. // Avoid building an unneeded node
  1710. if((yyvsp[(1) - (2)].node)==NULL && (yyvsp[(2) - (2)].node)!=NULL)
  1711. {
  1712. (yyval.node)=(yyvsp[(2) - (2)].node);
  1713. }
  1714. else if((yyvsp[(2) - (2)].node)==NULL && (yyvsp[(1) - (2)].node)!=NULL)
  1715. {
  1716. (yyval.node)=(yyvsp[(1) - (2)].node);
  1717. }
  1718. else
  1719. {
  1720. (yyval.node)=createASTNode(&(yylsp[(1) - (2)]),NODE_TYPE_FUNCTIONS, createASTNodeInfo("Functions", NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].node));
  1721. }
  1722. }
  1723. break;
  1724.  
  1725. case 5:
  1726.  
  1727. /* Line 1455 of yacc.c */
  1728. #line 110 "lsd10.y"
  1729. {
  1730. #if(VERBOSE_LEVEL<=DEB_Y)
  1731. printMsg(DEB_Y,"Function node", __FILE__, __LINE__);
  1732. #endif
  1733. (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));
  1734. }
  1735. break;
  1736.  
  1737. case 6:
  1738.  
  1739. /* Line 1455 of yacc.c */
  1740. #line 119 "lsd10.y"
  1741. {
  1742. #if(VERBOSE_LEVEL<=DEB_Y)
  1743. printMsg(DEB_Y,"PostFixeFunction node", __FILE__, __LINE__);
  1744. #endif
  1745.  
  1746. // Avoid building an unneeded node
  1747. if((yyvsp[(3) - (6)].node)==NULL)
  1748. {
  1749. (yyval.node)=(yyvsp[(5) - (6)].node)==NULL?NULL:(yyvsp[(5) - (6)].node);
  1750. }
  1751. else if((yyvsp[(5) - (6)].node)==NULL)
  1752. {
  1753. (yyval.node)=(yyvsp[(3) - (6)].node);
  1754. }
  1755. else
  1756. {
  1757. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_CONTAINER, createASTNodeInfo("{{decl}statement}", NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].node));
  1758. }
  1759. }
  1760. break;
  1761.  
  1762. case 7:
  1763.  
  1764. /* Line 1455 of yacc.c */
  1765. #line 140 "lsd10.y"
  1766. {
  1767. (yyval.node)=NULL;
  1768. }
  1769. break;
  1770.  
  1771. case 8:
  1772.  
  1773. /* Line 1455 of yacc.c */
  1774. #line 143 "lsd10.y"
  1775. {
  1776. #if(VERBOSE_LEVEL<=DEB_Y)
  1777. printMsg(DEB_Y,"Declarations node", __FILE__, __LINE__);
  1778. #endif
  1779. // Avoid building an unneeded node
  1780. if((yyvsp[(2) - (2)].node)==NULL)
  1781. {
  1782. (yyval.node)=(yyvsp[(1) - (2)].node);
  1783. }
  1784. else
  1785. {
  1786. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_DECLARATIONS, createASTNodeInfo("Declarations node", NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node));
  1787. }
  1788. }
  1789. break;
  1790.  
  1791. case 9:
  1792.  
  1793. /* Line 1455 of yacc.c */
  1794. #line 160 "lsd10.y"
  1795. {
  1796. /*void function*/
  1797. (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));
  1798. //setNodeSubType($$, SUBFUNCTION);
  1799. }
  1800. break;
  1801.  
  1802. case 10:
  1803.  
  1804. /* Line 1455 of yacc.c */
  1805. #line 165 "lsd10.y"
  1806. {
  1807. if((yyvsp[(3) - (3)].node)==NULL || (yyvsp[(3) - (3)].node)->type==NODE_DECL_LEXICAL_VAR)
  1808. {
  1809. // multiple variables declarations like "integer i j;"
  1810. // we must set the type for each variable
  1811. AstNode *tempNode = (yyvsp[(3) - (3)].node);
  1812. while(tempNode!=NULL)
  1813. {
  1814. //printf("\nVar ids: %s (on %s %d)\n", varNode->info->name, __FILE__, __LINE__);
  1815. setComputedType(tempNode,(yyvsp[(1) - (3)].nval));
  1816. tempNode=tempNode->left;
  1817. }
  1818.  
  1819. (yyval.node)=createASTNode(&yylloc,NODE_DECL_LEXICAL_VAR, createASTNodeInfo((yyvsp[(2) - (3)].text), (yyvsp[(1) - (3)].nval), NO_VAL), (yyvsp[(3) - (3)].node), NULL);
  1820. setComputedType((yyval.node),(yyvsp[(1) - (3)].nval));
  1821. }
  1822. else
  1823. {
  1824. // function declaration
  1825. (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);
  1826. setComputedType((yyval.node),(yyvsp[(1) - (3)].nval));
  1827. //setNodeSubType($$, SUBFUNCTION);
  1828. free((yyvsp[(3) - (3)].node));
  1829. }
  1830. }
  1831. break;
  1832.  
  1833. case 11:
  1834.  
  1835. /* Line 1455 of yacc.c */
  1836. #line 193 "lsd10.y"
  1837. {
  1838. (yyval.node)=createASTNode(&yylloc,NODE_DECL_PVAL, createASTNodeInfo("function", NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(2) - (4)].node), (yyvsp[(4) - (4)].node));
  1839. }
  1840. break;
  1841.  
  1842. case 12:
  1843.  
  1844. /* Line 1455 of yacc.c */
  1845. #line 196 "lsd10.y"
  1846. {
  1847. (yyval.node)=(yyvsp[(1) - (2)].node);
  1848. }
  1849. break;
  1850.  
  1851. case 13:
  1852.  
  1853. /* Line 1455 of yacc.c */
  1854. #line 202 "lsd10.y"
  1855. {(yyval.node)=NULL;}
  1856. break;
  1857.  
  1858. case 14:
  1859.  
  1860. /* Line 1455 of yacc.c */
  1861. #line 203 "lsd10.y"
  1862. {
  1863. (yyval.node)=createASTNode(&yylloc,NODE_DECL_LEXICAL_VAR, createASTNodeInfo((yyvsp[(1) - (2)].text), NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(2) - (2)].node), NULL);
  1864. }
  1865. break;
  1866.  
  1867. case 15:
  1868.  
  1869. /* Line 1455 of yacc.c */
  1870. #line 209 "lsd10.y"
  1871. {
  1872. (yyval.nval)=AST_BOOLEAN_VAR_TYPE;
  1873. #if(VERBOSE_LEVEL<=DEB_Y)
  1874. printMsg(DEB_Y,"FunctionType node : boolean", __FILE__, __LINE__);
  1875. #endif
  1876. }
  1877. break;
  1878.  
  1879. case 16:
  1880.  
  1881. /* Line 1455 of yacc.c */
  1882. #line 215 "lsd10.y"
  1883. {
  1884. (yyval.nval)=AST_INTEGER_VAR_TYPE;
  1885. #if(VERBOSE_LEVEL<=DEB_Y)
  1886. printMsg(DEB_Y,"FunctionType node : integer", __FILE__, __LINE__);
  1887. #endif
  1888. }
  1889. break;
  1890.  
  1891. case 17:
  1892.  
  1893. /* Line 1455 of yacc.c */
  1894. #line 221 "lsd10.y"
  1895. {
  1896. (yyval.nval)=AST_VOID_VAR_TYPE;
  1897. #if(VERBOSE_LEVEL<=DEB_Y)
  1898. printMsg(DEB_Y,"FunctionType node : void", __FILE__, __LINE__);
  1899. #endif
  1900. }
  1901. break;
  1902.  
  1903. case 18:
  1904.  
  1905. /* Line 1455 of yacc.c */
  1906. #line 230 "lsd10.y"
  1907. {
  1908. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_PARAM_LIST, createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  1909. }
  1910. break;
  1911.  
  1912. case 19:
  1913.  
  1914. /* Line 1455 of yacc.c */
  1915. #line 233 "lsd10.y"
  1916. {
  1917. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_PARAM_LIST, createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL), (yyvsp[(1) - (1)].node), NULL);
  1918. }
  1919. break;
  1920.  
  1921. case 20:
  1922.  
  1923. /* Line 1455 of yacc.c */
  1924. #line 236 "lsd10.y"
  1925. {(yyval.node)=NULL;}
  1926. break;
  1927.  
  1928. case 21:
  1929.  
  1930. /* Line 1455 of yacc.c */
  1931. #line 240 "lsd10.y"
  1932. {
  1933. #if(VERBOSE_LEVEL<=DEB_Y)
  1934. printMsg(DEB_Y,"LEXICAL_VAR VarType ID node", __FILE__, __LINE__);
  1935. #endif
  1936. (yyval.node) = createASTNode(&yylloc,NODE_ARG_DECL_LEXICAL_VAR, createASTNodeInfo((yyvsp[(3) - (3)].text), (yyvsp[(2) - (3)].nval), NO_VAL), NULL, NULL);
  1937. setNodeSubType((yyval.node), LEXICAL_VAR);
  1938. }
  1939. break;
  1940.  
  1941. case 22:
  1942.  
  1943. /* Line 1455 of yacc.c */
  1944. #line 247 "lsd10.y"
  1945. {
  1946. #if(VERBOSE_LEVEL<=DEB_Y)
  1947. printMsg(DEB_Y,"VarType ID node", __FILE__, __LINE__);
  1948. #endif
  1949. (yyval.node) = createASTNode(&yylloc,NODE_ARG_DECL_LEXICAL_VAR, createASTNodeInfo((yyvsp[(2) - (2)].text), (yyvsp[(1) - (2)].nval), NO_VAL), NULL, NULL);
  1950. setNodeSubType((yyval.node), ID);
  1951. }
  1952. break;
  1953.  
  1954. case 23:
  1955.  
  1956. /* Line 1455 of yacc.c */
  1957. #line 258 "lsd10.y"
  1958. {
  1959. (yyval.nval)=AST_BOOLEAN_VAR_TYPE;
  1960. #if(VERBOSE_LEVEL<=DEB_Y)
  1961. printMsg(DEB_Y,"VarType node : boolean", __FILE__, __LINE__);
  1962. #endif
  1963. }
  1964. break;
  1965.  
  1966. case 24:
  1967.  
  1968. /* Line 1455 of yacc.c */
  1969. #line 264 "lsd10.y"
  1970. {
  1971. (yyval.nval)=AST_INTEGER_VAR_TYPE;
  1972. #if(VERBOSE_LEVEL<=DEB_Y)
  1973. printMsg(DEB_Y,"VarType node : integer", __FILE__, __LINE__);
  1974. #endif
  1975. }
  1976. break;
  1977.  
  1978. case 25:
  1979.  
  1980. /* Line 1455 of yacc.c */
  1981. #line 270 "lsd10.y"
  1982. {
  1983. (yyval.nval)=AST_INSTACK_VAR_TYPE;
  1984. #if(VERBOSE_LEVEL<=DEB_Y)
  1985. printMsg(DEB_Y,"VarType node : instack", __FILE__, __LINE__);
  1986. #endif
  1987. }
  1988. break;
  1989.  
  1990. case 26:
  1991.  
  1992. /* Line 1455 of yacc.c */
  1993. #line 276 "lsd10.y"
  1994. {
  1995. (yyval.nval)=AST_INTEGER_ARRAY_VAR_TYPE;
  1996. #if(VERBOSE_LEVEL<=DEB_Y)
  1997. printMsg(DEB_Y,"VarType node : integer", __FILE__, __LINE__);
  1998. #endif
  1999. }
  2000. break;
  2001.  
  2002. case 27:
  2003.  
  2004. /* Line 1455 of yacc.c */
  2005. #line 282 "lsd10.y"
  2006. {
  2007. (yyval.nval)=AST_BOOLEAN_ARRAY_VAR_TYPE;
  2008. #if(VERBOSE_LEVEL<=DEB_Y)
  2009. printMsg(DEB_Y,"VarType node : integer", __FILE__, __LINE__);
  2010. #endif
  2011. }
  2012. break;
  2013.  
  2014. case 28:
  2015.  
  2016. /* Line 1455 of yacc.c */
  2017. #line 291 "lsd10.y"
  2018. {
  2019. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),NULL, (yyvsp[(2) - (2)].node));
  2020. setNodeSubType((yyval.node), LEXICAL_NOT);
  2021. }
  2022. break;
  2023.  
  2024. case 29:
  2025.  
  2026. /* Line 1455 of yacc.c */
  2027. #line 296 "lsd10.y"
  2028. {
  2029. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2030. setNodeSubType((yyval.node), LEXICAL_AND);
  2031. }
  2032. break;
  2033.  
  2034. case 30:
  2035.  
  2036. /* Line 1455 of yacc.c */
  2037. #line 300 "lsd10.y"
  2038. {
  2039. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2040. setNodeSubType((yyval.node), LEXICAL_OR);
  2041. }
  2042. break;
  2043.  
  2044. case 31:
  2045.  
  2046. /* Line 1455 of yacc.c */
  2047. #line 304 "lsd10.y"
  2048. {
  2049. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2050. setNodeSubType((yyval.node), LEXICAL_ANDLAZY);
  2051. }
  2052. break;
  2053.  
  2054. case 32:
  2055.  
  2056. /* Line 1455 of yacc.c */
  2057. #line 308 "lsd10.y"
  2058. {
  2059. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2060. setNodeSubType((yyval.node), LEXICAL_ORLAZY);
  2061. }
  2062. break;
  2063.  
  2064. case 33:
  2065.  
  2066. /* Line 1455 of yacc.c */
  2067. #line 312 "lsd10.y"
  2068. {
  2069. (yyval.node)=createASTNode(&yylloc,LEXICAL_TRUE_VAL, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),NULL, NULL);
  2070. setNodeSubType((yyval.node), LEXICAL_TRUE_VAL);
  2071. }
  2072. break;
  2073.  
  2074. case 34:
  2075.  
  2076. /* Line 1455 of yacc.c */
  2077. #line 316 "lsd10.y"
  2078. {
  2079. (yyval.node)=createASTNode(&yylloc,LEXICAL_FALSE_VAL, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),NULL, NULL);
  2080. setNodeSubType((yyval.node), LEXICAL_FALSE_VAL);
  2081. }
  2082. break;
  2083.  
  2084. case 35:
  2085.  
  2086. /* Line 1455 of yacc.c */
  2087. #line 320 "lsd10.y"
  2088. {
  2089. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),
  2090. NULL,
  2091. createASTNode(&yylloc,NODE_TYPE_ID, createASTNodeInfo((yyvsp[(3) - (4)].text), NODE_TYPE_TODO, NO_VAL),NULL, NULL)
  2092. );
  2093. setNodeSubType((yyval.node), LEXICAL_ISEMPTY_OPS);
  2094. }
  2095. break;
  2096.  
  2097. case 36:
  2098.  
  2099. /* Line 1455 of yacc.c */
  2100. #line 327 "lsd10.y"
  2101. {
  2102. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_INTEGER_VAR_TYPE, NO_VAL),
  2103. NULL,
  2104. createASTNode(&yylloc,NODE_TYPE_ID, createASTNodeInfo((yyvsp[(3) - (4)].text), NODE_TYPE_TODO, NO_VAL),NULL, NULL)
  2105. );
  2106. setNodeSubType((yyval.node), LEXICAL_GET_OPS);
  2107. }
  2108. break;
  2109.  
  2110. case 37:
  2111.  
  2112. /* Line 1455 of yacc.c */
  2113. #line 334 "lsd10.y"
  2114. {
  2115. #if(VERBOSE_LEVEL<=DEB_Y)
  2116. printMsg(DEB_Y,"=", __FILE__, __LINE__);
  2117. #endif
  2118. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2119. setNodeSubType((yyval.node), LEXICAL_EQUALS);
  2120. }
  2121. break;
  2122.  
  2123. case 38:
  2124.  
  2125. /* Line 1455 of yacc.c */
  2126. #line 341 "lsd10.y"
  2127. {
  2128. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2129. setNodeSubType((yyval.node), LEXICAL_LESS_EQUALS);
  2130. #if(VERBOSE_LEVEL<=DEB_Y)
  2131. //printf(";\ttest subtype %d",$$->subtype);
  2132. printMsg(DEB_Y,"<=", __FILE__, __LINE__);
  2133. #endif
  2134. }
  2135. break;
  2136.  
  2137. case 39:
  2138.  
  2139. /* Line 1455 of yacc.c */
  2140. #line 349 "lsd10.y"
  2141. {
  2142. #if(VERBOSE_LEVEL<=DEB_Y)
  2143. printMsg(DEB_Y,"<", __FILE__, __LINE__);
  2144. #endif
  2145. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_BOOLEAN_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2146. setNodeSubType((yyval.node), LEXICAL_LESS);
  2147. }
  2148. break;
  2149.  
  2150. case 40:
  2151.  
  2152. /* Line 1455 of yacc.c */
  2153. #line 356 "lsd10.y"
  2154. {
  2155. #if(VERBOSE_LEVEL<=DEB_Y)
  2156. printMsg(DEB_Y,"+", __FILE__, __LINE__);
  2157. #endif
  2158. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_INTEGER_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2159. setNodeSubType((yyval.node), LEXICAL_PLUS);
  2160. }
  2161. break;
  2162.  
  2163. case 41:
  2164.  
  2165. /* Line 1455 of yacc.c */
  2166. #line 363 "lsd10.y"
  2167. {
  2168. #if(VERBOSE_LEVEL<=DEB_Y)
  2169. printMsg(DEB_Y,"-", __FILE__, __LINE__);
  2170. #endif
  2171. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_INTEGER_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2172. setNodeSubType((yyval.node), LEXICAL_MINUS);
  2173. }
  2174. break;
  2175.  
  2176. case 42:
  2177.  
  2178. /* Line 1455 of yacc.c */
  2179. #line 370 "lsd10.y"
  2180. {
  2181. #if(VERBOSE_LEVEL<=DEB_Y)
  2182. printMsg(DEB_Y,"*", __FILE__, __LINE__);
  2183. #endif
  2184. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_INTEGER_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2185. setNodeSubType((yyval.node), LEXICAL_MULT);
  2186. }
  2187. break;
  2188.  
  2189. case 43:
  2190.  
  2191. /* Line 1455 of yacc.c */
  2192. #line 377 "lsd10.y"
  2193. {
  2194. #if(VERBOSE_LEVEL<=DEB_Y)
  2195. printMsg(DEB_Y,"LEXICAL_DIV", __FILE__, __LINE__);
  2196. #endif
  2197. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_INTEGER_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2198. setNodeSubType((yyval.node), LEXICAL_DIV);
  2199. }
  2200. break;
  2201.  
  2202. case 44:
  2203.  
  2204. /* Line 1455 of yacc.c */
  2205. #line 384 "lsd10.y"
  2206. {
  2207. #if(VERBOSE_LEVEL<=DEB_Y)
  2208. printMsg(DEB_Y,"LEXICAL_MOD", __FILE__, __LINE__);
  2209. #endif
  2210. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, AST_INTEGER_VAR_TYPE, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2211. setNodeSubType((yyval.node), LEXICAL_MOD);
  2212. }
  2213. break;
  2214.  
  2215. case 45:
  2216.  
  2217. /* Line 1455 of yacc.c */
  2218. #line 391 "lsd10.y"
  2219. {
  2220. #if(VERBOSE_LEVEL<=DEB_Y)
  2221. printMsg(DEB_Y,"(RExpr)", __FILE__, __LINE__);
  2222. #endif
  2223. (yyval.node)=(yyvsp[(2) - (3)].node);//createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, NODE_TYPE_TODO, NO_VAL),NULL, $2);
  2224. }
  2225. break;
  2226.  
  2227. case 46:
  2228.  
  2229. /* Line 1455 of yacc.c */
  2230. #line 397 "lsd10.y"
  2231. {
  2232. #if(VERBOSE_LEVEL<=DEB_Y)
  2233. printMsg(DEB_Y,"LExpr", __FILE__, __LINE__);
  2234. #endif
  2235. (yyval.node)=(yyvsp[(1) - (1)].node);//createASTNode(&yylloc,NODE_TYPE_REXP, createASTNodeInfo(NO_NAME, NODE_TYPE_TODO, NO_VAL),$1, NULL);
  2236. }
  2237. break;
  2238.  
  2239. case 47:
  2240.  
  2241. /* Line 1455 of yacc.c */
  2242. #line 403 "lsd10.y"
  2243. {
  2244. #if(VERBOSE_LEVEL<=DEB_Y)
  2245. printMsg(DEB_Y,"Function call with parameters", __FILE__, __LINE__);
  2246. #endif
  2247. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_FUNCTION_CALL, createASTNodeInfo((yyvsp[(1) - (4)].text), NODE_TYPE_TODO, NO_VAL),(yyvsp[(3) - (4)].node), NULL);
  2248. }
  2249. break;
  2250.  
  2251. case 48:
  2252.  
  2253. /* Line 1455 of yacc.c */
  2254. #line 409 "lsd10.y"
  2255. {
  2256. #if(VERBOSE_LEVEL<=DEB_Y)
  2257. printMsg(DEB_Y,"Function call without parameters", __FILE__, __LINE__);
  2258. #endif
  2259. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_FUNCTION_CALL, createASTNodeInfo((yyvsp[(1) - (3)].text), NODE_TYPE_TODO, NO_VAL),NULL, NULL);
  2260. }
  2261. break;
  2262.  
  2263. case 49:
  2264.  
  2265. /* Line 1455 of yacc.c */
  2266. #line 415 "lsd10.y"
  2267. {
  2268. (yyval.node)=createASTNode(&yylloc,NUMBER, createASTNodeInfo("CONSTANT, NUMBER", AST_INTEGER_VAR_TYPE, (yyvsp[(1) - (1)].nval)),NULL, NULL);
  2269. }
  2270. break;
  2271.  
  2272. case 50:
  2273.  
  2274. /* Line 1455 of yacc.c */
  2275. #line 418 "lsd10.y"
  2276. {
  2277. (yyval.node)=createASTNode(&yylloc,NUMBER, createASTNodeInfo("CONSTANT, NEGATIVE NUMBER", AST_INTEGER_VAR_TYPE, 0-(yyvsp[(2) - (2)].nval)),NULL, NULL);
  2278. }
  2279. break;
  2280.  
  2281. case 51:
  2282.  
  2283. /* Line 1455 of yacc.c */
  2284. #line 427 "lsd10.y"
  2285. {
  2286. #if(VERBOSE_LEVEL<=DEB_Y)
  2287. printMsg(DEB_Y,"ID node", __FILE__, __LINE__);
  2288. #endif
  2289. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_ID, createASTNodeInfo((yyvsp[(1) - (1)].text), NODE_TYPE_NOTHING, NO_VAL),NULL, NULL);
  2290. }
  2291. break;
  2292.  
  2293. case 52:
  2294.  
  2295. /* Line 1455 of yacc.c */
  2296. #line 433 "lsd10.y"
  2297. {
  2298. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_ID,createASTNodeInfo((yyvsp[(1) - (4)].text), NODE_TYPE_NOTHING, NO_VAL),(yyvsp[(3) - (4)].node),NULL);
  2299. setNodeSubType((yyval.node), LEXICAL_INSTACK_TYPE);
  2300. }
  2301. break;
  2302.  
  2303. case 53:
  2304.  
  2305. /* Line 1455 of yacc.c */
  2306. #line 440 "lsd10.y"
  2307. {
  2308. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_PARAM_LIST, createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL),(yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  2309. }
  2310. break;
  2311.  
  2312. case 54:
  2313.  
  2314. /* Line 1455 of yacc.c */
  2315. #line 443 "lsd10.y"
  2316. {
  2317. (yyval.node)=(yyvsp[(1) - (1)].node);
  2318. setNodeType((yyval.node), NODE_TYPE_PARAM);
  2319. }
  2320. break;
  2321.  
  2322. case 55:
  2323.  
  2324. /* Line 1455 of yacc.c */
  2325. #line 450 "lsd10.y"
  2326. {
  2327. #if(VERBOSE_LEVEL<=DEB_Y)
  2328. printMsg(DEB_Y,"Statements node", __FILE__, __LINE__);
  2329. #endif
  2330. // Avoid building an unneeded node
  2331. if((yyvsp[(2) - (2)].node)==NULL)
  2332. {
  2333. (yyval.node)=(yyvsp[(1) - (2)].node);
  2334. }
  2335. else
  2336. {
  2337. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_FUNCTION_BODY, createASTNodeInfo("Statements node", NODE_TYPE_TODO, NO_VAL),(yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node));
  2338. }
  2339. }
  2340. break;
  2341.  
  2342. case 56:
  2343.  
  2344. /* Line 1455 of yacc.c */
  2345. #line 464 "lsd10.y"
  2346. { (yyval.node)=NULL;}
  2347. break;
  2348.  
  2349. case 57:
  2350.  
  2351. /* Line 1455 of yacc.c */
  2352. #line 468 "lsd10.y"
  2353. {
  2354. #if(VERBOSE_LEVEL<=DEB_Y)
  2355. printMsg(DEB_Y,"Statement : ';'", __FILE__, __LINE__);
  2356. #endif
  2357. (yyval.node)=NULL;
  2358. }
  2359. break;
  2360.  
  2361. case 58:
  2362.  
  2363. /* Line 1455 of yacc.c */
  2364. #line 474 "lsd10.y"
  2365. {
  2366. #if(VERBOSE_LEVEL<=DEB_Y)
  2367. printMsg(DEB_Y,"Statement : 'RExpr;'", __FILE__, __LINE__);
  2368. #endif
  2369. (yyval.node)=(yyvsp[(1) - (2)].node);
  2370. }
  2371. break;
  2372.  
  2373. case 59:
  2374.  
  2375. /* Line 1455 of yacc.c */
  2376. #line 480 "lsd10.y"
  2377. {
  2378. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_STATEMENT, createASTNodeInfo("Statement : 'LExpr = RExpr;'", NODE_TYPE_CHECK, NO_VAL),(yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].node));
  2379. setNodeSubType((yyval.node), LEXICAL_AFFECTATION);
  2380. }
  2381. break;
  2382.  
  2383. case 60:
  2384.  
  2385. /* Line 1455 of yacc.c */
  2386. #line 484 "lsd10.y"
  2387. {
  2388. #if(VERBOSE_LEVEL<=DEB_Y)
  2389. printMsg(DEB_Y,"Statement : 'if'", __FILE__, __LINE__);
  2390. #endif
  2391. (yyval.node)=(yyvsp[(1) - (1)].node);//createASTNode(&yylloc,NODE_TYPE_STATEMENT, createASTNodeInfo("Statement : 'if'", NODE_TYPE_NOTHING, NO_VAL),$1, NULL);
  2392. }
  2393. break;
  2394.  
  2395. case 61:
  2396.  
  2397. /* Line 1455 of yacc.c */
  2398. #line 490 "lsd10.y"
  2399. {
  2400. #if(VERBOSE_LEVEL<=DEB_Y)
  2401. printMsg(DEB_Y,"Statement : 'while'", __FILE__, __LINE__);
  2402. #endif
  2403. (yyval.node)=(yyvsp[(1) - (1)].node);
  2404. }
  2405. break;
  2406.  
  2407. case 62:
  2408.  
  2409. /* Line 1455 of yacc.c */
  2410. #line 496 "lsd10.y"
  2411. {
  2412. #if(VERBOSE_LEVEL<=DEB_Y)
  2413. printMsg(DEB_Y,"Statement : 'for'", __FILE__, __LINE__);
  2414. #endif
  2415. (yyval.node)=(yyvsp[(1) - (1)].node);
  2416. }
  2417. break;
  2418.  
  2419. case 63:
  2420.  
  2421. /* Line 1455 of yacc.c */
  2422. #line 502 "lsd10.y"
  2423. {
  2424. #if(VERBOSE_LEVEL<=DEB_Y)
  2425. printMsg(DEB_Y,"Statement : 'WRITE (RExpr);'", __FILE__, __LINE__);
  2426. #endif
  2427. (yyval.node)=createASTNode(&yylloc,LEXICAL_WRITE_OPS, createASTNodeInfo("Statement : 'WRITE (RExpr);'", AST_INTEGER_VAR_TYPE, NO_VAL),NULL, (yyvsp[(3) - (5)].node));
  2428. }
  2429. break;
  2430.  
  2431. case 64:
  2432.  
  2433. /* Line 1455 of yacc.c */
  2434. #line 508 "lsd10.y"
  2435. {
  2436. #if(VERBOSE_LEVEL<=DEB_Y)
  2437. printMsg(DEB_Y,"Statement : 'READ (LExpr);'", __FILE__, __LINE__);
  2438. #endif
  2439. (yyval.node)=createASTNode(&yylloc,LEXICAL_READ_OPS, createASTNodeInfo("Statement : 'READ (LExpr);'", AST_INTEGER_VAR_TYPE, NO_VAL),NULL, (yyvsp[(3) - (5)].node));
  2440. }
  2441. break;
  2442.  
  2443. case 65:
  2444.  
  2445. /* Line 1455 of yacc.c */
  2446. #line 514 "lsd10.y"
  2447. {
  2448. #if(VERBOSE_LEVEL<=DEB_Y)
  2449. printMsg(DEB_Y,"Statement : 'PUT (ID, RExpr);'", __FILE__, __LINE__);
  2450. #endif
  2451. (yyval.node)=createASTNode(&yylloc,
  2452. LEXICAL_PUT_OPS,
  2453. createASTNodeInfo("Statement : 'PUT;'", NODE_TYPE_NOTHING, NO_VAL),
  2454. createASTNode(&yylloc,NODE_TYPE_ID, createASTNodeInfo((yyvsp[(3) - (7)].text), NODE_TYPE_NOTHING, NO_VAL),NULL, NULL),
  2455. (yyvsp[(5) - (7)].node)
  2456. );
  2457. }
  2458. break;
  2459.  
  2460. case 66:
  2461.  
  2462. /* Line 1455 of yacc.c */
  2463. #line 525 "lsd10.y"
  2464. {
  2465. #if(VERBOSE_LEVEL<=DEB_Y)
  2466. printMsg(DEB_Y,"Statement : 'LEXICAL_RETURN_STMT(RExpr);'", __FILE__, __LINE__);
  2467. #endif
  2468. (yyval.node)=createASTNode(&yylloc,LEXICAL_RETURN_STMT, createASTNodeInfo("Statement : 'LEXICAL_RETURN_STMT(RExpr);'", NODE_TYPE_NOTHING, NO_VAL),NULL, (yyvsp[(3) - (5)].node));
  2469. }
  2470. break;
  2471.  
  2472. case 67:
  2473.  
  2474. /* Line 1455 of yacc.c */
  2475. #line 533 "lsd10.y"
  2476. {
  2477. AstNode *forBoundariesNode = createASTNode(&yylloc,NODE_TYPE_CONTAINER,createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL),(yyvsp[(3) - (11)].node),(yyvsp[(7) - (11)].node));
  2478. AstNode *forNode = createASTNode(&yylloc,NODE_TYPE_CONTAINER,createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL),forBoundariesNode, (yyvsp[(10) - (11)].node));
  2479. //AstNode *forConditionNode = createASTNode(&yylloc,NODE_TYPE_REXP,createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL),$5,NULL);
  2480.  
  2481. (yyval.node) = createASTNode(&yylloc,NODE_TYPE_STATEMENT,createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL),
  2482. (yyvsp[(5) - (11)].node),
  2483. forNode
  2484. );
  2485. setNodeSubType((yyval.node), LEXICAL_FLEXICAL_OR_STMT);
  2486. }
  2487. break;
  2488.  
  2489. case 68:
  2490.  
  2491. /* Line 1455 of yacc.c */
  2492. #line 546 "lsd10.y"
  2493. {
  2494. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_STATEMENT,createASTNodeInfo("while(RExpr){Statement}", NODE_TYPE_NOTHING, NO_VAL),(yyvsp[(3) - (7)].node), (yyvsp[(6) - (7)].node));
  2495. setNodeSubType((yyval.node), LEXICAL_WHILE_STMT);
  2496. }
  2497. break;
  2498.  
  2499. case 69:
  2500.  
  2501. /* Line 1455 of yacc.c */
  2502. #line 553 "lsd10.y"
  2503. {
  2504.  
  2505. AstNode *ifNode = (yyvsp[(6) - (11)].node);
  2506. AstNode *elseNode = (yyvsp[(10) - (11)].node);
  2507. (yyval.node)=createASTNode(&yylloc,
  2508. NODE_TYPE_STATEMENT,
  2509. createASTNodeInfo("if(RExpr){Statement}else{Statement}", NODE_TYPE_NOTHING, NO_VAL),
  2510. (yyvsp[(3) - (11)].node),
  2511. createASTNode(&yylloc,
  2512. NODE_TYPE_CONTAINER,
  2513. createASTNodeInfo(NO_NAME, NODE_TYPE_NOTHING, NO_VAL),
  2514. ifNode,
  2515. elseNode
  2516. )
  2517. );
  2518. setNodeSubType((yyval.node), AST_IF_ELSE_STMT);
  2519. }
  2520. break;
  2521.  
  2522. case 70:
  2523.  
  2524. /* Line 1455 of yacc.c */
  2525. #line 570 "lsd10.y"
  2526. {
  2527. (yyval.node)=createASTNode(&yylloc,NODE_TYPE_STATEMENT,createASTNodeInfo("if(RExpr){Statement}", NODE_TYPE_NOTHING, NO_VAL),(yyvsp[(3) - (7)].node), (yyvsp[(6) - (7)].node));
  2528. setNodeSubType((yyval.node), LEXICAL_IF_STMT);
  2529. }
  2530. break;
  2531.  
  2532.  
  2533.  
  2534. /* Line 1455 of yacc.c */
  2535. #line 2539 "y.tab.c"
  2536. default: break;
  2537. }
  2538. YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  2539.  
  2540. YYPOPSTACK (yylen);
  2541. yylen = 0;
  2542. YY_STACK_PRINT (yyss, yyssp);
  2543.  
  2544. *++yyvsp = yyval;
  2545. *++yylsp = yyloc;
  2546.  
  2547. /* Now `shift' the result of the reduction. Determine what state
  2548.   that goes to, based on the state we popped back to and the rule
  2549.   number reduced by. */
  2550.  
  2551. yyn = yyr1[yyn];
  2552.  
  2553. yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  2554. if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  2555. yystate = yytable[yystate];
  2556. else
  2557. yystate = yydefgoto[yyn - YYNTOKENS];
  2558.  
  2559. goto yynewstate;
  2560.  
  2561.  
  2562. /*------------------------------------.
  2563. | yyerrlab -- here on detecting error |
  2564. `------------------------------------*/
  2565. yyerrlab:
  2566. /* If not already recovering from an error, report this error. */
  2567. if (!yyerrstatus)
  2568. {
  2569. ++yynerrs;
  2570. #if ! YYERROR_VERBOSE
  2571. yyerror (YY_("syntax error"));
  2572. #else
  2573. {
  2574. YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
  2575. if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
  2576. {
  2577. YYSIZE_T yyalloc = 2 * yysize;
  2578. if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
  2579. yyalloc = YYSTACK_ALLOC_MAXIMUM;
  2580. if (yymsg != yymsgbuf)
  2581. YYSTACK_FREE (yymsg);
  2582. yymsg = (char *) YYSTACK_ALLOC (yyalloc);
  2583. if (yymsg)
  2584. yymsg_alloc = yyalloc;
  2585. else
  2586. {
  2587. yymsg = yymsgbuf;
  2588. yymsg_alloc = sizeof yymsgbuf;
  2589. }
  2590. }
  2591.  
  2592. if (0 < yysize && yysize <= yymsg_alloc)
  2593. {
  2594. (void) yysyntax_error (yymsg, yystate, yychar);
  2595. yyerror (yymsg);
  2596. }
  2597. else
  2598. {
  2599. yyerror (YY_("syntax error"));
  2600. if (yysize != 0)
  2601. goto yyexhaustedlab;
  2602. }
  2603. }
  2604. #endif
  2605. }
  2606.  
  2607. yyerror_range[0] = yylloc;
  2608.  
  2609. if (yyerrstatus == 3)
  2610. {
  2611. /* If just tried and failed to reuse lookahead token after an
  2612. error, discard it. */
  2613.  
  2614. if (yychar <= YYEOF)
  2615. {
  2616. /* Return failure if at end of input. */
  2617. if (yychar == YYEOF)
  2618. YYABORT;
  2619. }
  2620. else
  2621. {
  2622. yydestruct ("Error: discarding",
  2623. yytoken, &yylval, &yylloc);
  2624. yychar = YYEMPTY;
  2625. }
  2626. }
  2627.  
  2628. /* Else will try to reuse lookahead token after shifting the error
  2629.   token. */
  2630. goto yyerrlab1;
  2631.  
  2632.  
  2633. /*---------------------------------------------------.
  2634. | yyerrorlab -- error raised explicitly by YYERROR. |
  2635. `---------------------------------------------------*/
  2636. yyerrorlab:
  2637.  
  2638. /* Pacify compilers like GCC when the user code never invokes
  2639.   YYERROR and the label yyerrorlab therefore never appears in user
  2640.   code. */
  2641. if (/*CONSTCOND*/ 0)
  2642. goto yyerrorlab;
  2643.  
  2644. yyerror_range[0] = yylsp[1-yylen];
  2645. /* Do not reclaim the symbols of the rule which action triggered
  2646.   this YYERROR. */
  2647. YYPOPSTACK (yylen);
  2648. yylen = 0;
  2649. YY_STACK_PRINT (yyss, yyssp);
  2650. yystate = *yyssp;
  2651. goto yyerrlab1;
  2652.  
  2653.  
  2654. /*-------------------------------------------------------------.
  2655. | yyerrlab1 -- common code for both syntax error and YYERROR. |
  2656. `-------------------------------------------------------------*/
  2657. yyerrlab1:
  2658. yyerrstatus = 3; /* Each real token shifted decrements this. */
  2659.  
  2660. for (;;)
  2661. {
  2662. yyn = yypact[yystate];
  2663. if (yyn != YYPACT_NINF)
  2664. {
  2665. yyn += YYTERROR;
  2666. if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  2667. {
  2668. yyn = yytable[yyn];
  2669. if (0 < yyn)
  2670. break;
  2671. }
  2672. }
  2673.  
  2674. /* Pop the current state because it cannot handle the error token. */
  2675. if (yyssp == yyss)
  2676. YYABORT;
  2677.  
  2678. yyerror_range[0] = *yylsp;
  2679. yydestruct ("Error: popping",
  2680. yystos[yystate], yyvsp, yylsp);
  2681. YYPOPSTACK (1);
  2682. yystate = *yyssp;
  2683. YY_STACK_PRINT (yyss, yyssp);
  2684. }
  2685.  
  2686. *++yyvsp = yylval;
  2687.  
  2688. yyerror_range[1] = yylloc;
  2689. /* Using YYLLOC is tempting, but would change the location of
  2690.   the lookahead. YYLOC is available though. */
  2691. YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
  2692. *++yylsp = yyloc;
  2693.  
  2694. /* Shift the error token. */
  2695. YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  2696.  
  2697. yystate = yyn;
  2698. goto yynewstate;
  2699.  
  2700.  
  2701. /*-------------------------------------.
  2702. | yyacceptlab -- YYACCEPT comes here. |
  2703. `-------------------------------------*/
  2704. yyacceptlab:
  2705. yyresult = 0;
  2706. goto yyreturn;
  2707.  
  2708. /*-----------------------------------.
  2709. | yyabortlab -- YYABORT comes here. |
  2710. `-----------------------------------*/
  2711. yyabortlab:
  2712. yyresult = 1;
  2713. goto yyreturn;
  2714.  
  2715. #if !defined(yyoverflow) || YYERROR_VERBOSE
  2716. /*-------------------------------------------------.
  2717. | yyexhaustedlab -- memory exhaustion comes here. |
  2718. `-------------------------------------------------*/
  2719. yyexhaustedlab:
  2720. yyerror (YY_("memory exhausted"));
  2721. yyresult = 2;
  2722. /* Fall through. */
  2723. #endif
  2724.  
  2725. yyreturn:
  2726. if (yychar != YYEMPTY)
  2727. yydestruct ("Cleanup: discarding lookahead",
  2728. yytoken, &yylval, &yylloc);
  2729. /* Do not reclaim the symbols of the rule which action triggered
  2730.   this YYABORT or YYACCEPT. */
  2731. YYPOPSTACK (yylen);
  2732. YY_STACK_PRINT (yyss, yyssp);
  2733. while (yyssp != yyss)
  2734. {
  2735. yydestruct ("Cleanup: popping",
  2736. yystos[*yyssp], yyvsp, yylsp);
  2737. YYPOPSTACK (1);
  2738. }
  2739. #ifndef yyoverflow
  2740. if (yyss != yyssa)
  2741. YYSTACK_FREE (yyss);
  2742. #endif
  2743. #if YYERROR_VERBOSE
  2744. if (yymsg != yymsgbuf)
  2745. YYSTACK_FREE (yymsg);
  2746. #endif
  2747. /* Make sure YYID is used. */
  2748. return YYID (yyresult);
  2749. }
  2750.  
  2751.  
  2752.  
  2753. /* Line 1675 of yacc.c */
  2754. #line 576 "lsd10.y"
  2755.  
  2756.  
  2757. void finalizeYacc()
  2758. {
  2759. #if(SYMTABLE_PRINT_REQUESTED==1 || VERBOSE_LEVEL<=DEB_I)
  2760. printSymbolsTableFooter();
  2761. #endif
  2762. #if(VERBOSE_LEVEL<=DEB_EXEC)
  2763. printMsg(DEB_EXEC,"Cleaning memory...", __FILE__, __LINE__);
  2764. #endif
  2765. // finalizeSymbolsTable MUST be called BELEXICAL_FLEXICAL_OR_STMTE finalizeAST to avoid double free or corruption
  2766. finalizeSymbolsTable();
  2767. finalizeAST();
  2768.  
  2769. // if(psnBeforeToken!=NULL)
  2770. // {
  2771. // free(psnBeforeToken);
  2772. // }
  2773. // if(psnAfterToken!=NULL)
  2774. // {
  2775. // free(psnAfterToken);
  2776. // }
  2777. yylex_destroy();
  2778. #if(VERBOSE_LEVEL<=DEB_EXEC)
  2779. printMsg(DEB_EXEC,"...OK Memory cleaned\n;\n;", __FILE__, __LINE__);
  2780. #endif
  2781. }
  2782.  
  2783. int testFile(char *path)
  2784. {
  2785. #if(VERBOSE_LEVEL<=DEB_EXEC)
  2786. time_t startTime = time(NULL);
  2787. printf(";****************************************************************************************");
  2788. printMsg(DEB_EXEC,"Creating Symbols Table",__FILE__, __LINE__);
  2789. #endif
  2790.  
  2791. initializeSymbolsTable();
  2792. #if(SYMTABLE_PRINT_REQUESTED==1)
  2793. printSymbolsTableHeader();
  2794. #endif
  2795. #if(SYMTABLE_PRINT_REQUESTED!=1 && VERBOSE_LEVEL<=DEB_EXEC)
  2796. printMsg(DEB_W,"Print Symbols table not requested (use DEB_I level minimum to print it)", __FILE__, __LINE__);
  2797. #endif
  2798.  
  2799. if(path==NULL || !(yyin=fopen(path,"r")))
  2800. {
  2801. #if(VERBOSE_LEVEL<=DEB_EXEC)
  2802. printMsg(DEB_EXEC,"Using Test file...false", __FILE__, __LINE__);
  2803. printMsg(DEB_E, (char *)strerror(errno), __FILE__, __LINE__);
  2804. printMsg(DEB_EXEC,"Calling yyparse()", __FILE__, __LINE__);
  2805. #endif
  2806. yyparse();
  2807. }
  2808. else
  2809. {
  2810. #if(VERBOSE_LEVEL<=DEB_EXEC)
  2811. printMsg(DEB_EXEC,"Using Test file...true", __FILE__, __LINE__);
  2812. printf("; Parsing %s file...", path);
  2813. printMsg(DEB_EXEC,"Calling yyparse()", __FILE__, __LINE__);
  2814. #endif
  2815. yyparse();/*retourne un booleen?*/
  2816. fclose(yyin);
  2817. }
  2818. #if(VERBOSE_LEVEL<=DEB_EXEC)
  2819. printMsg(DEB_EXEC,"End of yyparse execution;", __FILE__, __LINE__);
  2820. #endif
  2821. #if(AST_PRINT_REQUESTED==1)
  2822. printTree();
  2823. #endif
  2824. #if(AST_PRINT_REQUESTED!=1 && VERBOSE_LEVEL<=DEB_EXEC)
  2825. printMsg(DEB_W,"Print tree not requested (use DEB_I level minimum to print it)", __FILE__, __LINE__);
  2826. #endif
  2827. checkAST();
  2828. #if(AST_IMAGE_REQUESTED!=0)
  2829. printGraph();
  2830. #endif
  2831.  
  2832. #if(VERBOSE_LEVEL<=DEB_EXEC && PCODE_GENERATION_BYPASS)
  2833. printMsg(DEB_EXEC,"P-code generation not requested.", __FILE__, __LINE__);
  2834. #endif
  2835. #if(!PCODE_GENERATION_BYPASS)
  2836. #if(VERBOSE_LEVEL<=DEB_EXEC)
  2837. printMsg(DEB_EXEC,"Generating p-code...", __FILE__, __LINE__);
  2838. #endif
  2839. generatePCode();
  2840. #if(VERBOSE_LEVEL<=DEB_EXEC)
  2841. printMsg(DEB_EXEC,"...OK P-code generated;", __FILE__, __LINE__);
  2842. #endif
  2843. #endif
  2844. #if(VAR_USAGE_REPLEXICAL_ORT_REQUESTED)
  2845. printSymbolsUsage();
  2846. #endif
  2847. finalizeYacc();
  2848. #if(VERBOSE_LEVEL<=DEB_EXEC)
  2849. time_t endTime = time(NULL);
  2850.  
  2851. char str[1024];//todo: minimize length
  2852. str,
  2853. "Parsing started at %s;\t%d lines %d chars parsed in %g seconds\n;\tVerbose set on \"%s\" level",
  2854. asctime(localtime(&startTime)),
  2855. lexLinesCount,
  2856. lexTotalCharsCount,
  2857. difftime(endTime, startTime),
  2858. debugLevelToString(VERBOSE_LEVEL)
  2859. );
  2860. printMsg(DEB_EXEC,str, __FILE__, __LINE__);
  2861. #endif
  2862. //fprintf(stderr,"OK\n");
  2863. return EXIT_SUCCESS;
  2864. }
  2865.  
  2866. int main()
  2867. {
  2868. DIR *dir = NULL;
  2869. struct dirent *file = NULL;
  2870. char *path="tests";
  2871.  
  2872. #if(VERBOSE_LEVEL<=DEB_EXEC)
  2873. printMsg(DEB_EXEC,"\n;\n;\tLSD010 Compiler [SSHD09]\n;\n;", __FILE__, __LINE__);
  2874. #endif
  2875.  
  2876. if((dir = opendir(path)) == NULL)
  2877. {
  2878. testFile(NULL);
  2879. }
  2880. else
  2881. {
  2882. char *filePath;
  2883. while((file = readdir(dir)) != NULL)
  2884. {
  2885. if(strcmp(file->d_name, ".") && strcmp(file->d_name, ".."))
  2886. {
  2887. filePath = malloc(strlen(path) + strlen(file->d_name) + 2);
  2888. sprintf(filePath, "%s%s%s", path, FILE_SEPARATLEXICAL_OR, file->d_name);
  2889. //printf("\n; Opening %s file...", filePath);
  2890. if(testFile(filePath) != EXIT_SUCCESS)
  2891. {
  2892. return EXIT_FAILURE;
  2893. }
  2894. }
  2895. }
  2896. closedir(dir);
  2897. free(filePath);
  2898. }
  2899. #if(VERBOSE_LEVEL<=DEB_EXEC)
  2900. printMsg(DEB_EXEC,"That's All Folks!", __FILE__, __LINE__);
  2901. #endif
  2902.  
  2903.  
  2904. fprintf(stderr,"OK\n");
  2905. return EXIT_SUCCESS;
  2906. }
  2907.  
  2908. int yyerror(char *str)
  2909. {
  2910. fprintf(stderr,"KO\n");
  2911. if(yytext!=NULL)
  2912. {
  2913. fprintf(stderr,";\n;\tError : \"%s\" On parsed code, Line %d : UNRECOGNISED '%s'\n\n", str, lexLinesCount, yytext);
  2914. }else if(debugInfo!=NULL)
  2915. {
  2916. stderr,
  2917. ";\n;\tError : \"%s\" On %s, Line %d col %d\n\n",
  2918. str,
  2919. debugInfo->file,
  2920. debugInfo->line,
  2921. debugInfo->linePsn
  2922. );
  2923. }
  2924. // else if(lexLinesCount>0)
  2925. // {
  2926. // fprintf(stderr,";\n;\tError : \"%s\" On parsed code, Line %d\n\n", str, lexLinesCount);
  2927. // }
  2928. else
  2929. {
  2930. fprintf(stderr,";\n;\tError : \"%s\"\n\n", str);
  2931. }
  2932. finalizeYacc();
  2933. //failure for the parsed code, but success for the compiler (it must stop here)
  2934. exit(EXIT_SUCCESS);
  2935. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/lsd010/project/source/ 
IcôneNomTailleModification
Pas de sous-répertoires.
IcôneNomTailleModification
| _ Répertoire parent0 octets1714084895 26/04/2024 00:41:35
Fichiers contenus dans /var/www/bin/sniplets/lsd010/project/source/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .o|.ographVizHelper.o4.72 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .c|.cast.c27.73 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .h|.hconst.h4.01 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .c|.cy.tab.c84.53 Ko31/10/2018 18:32:39-refusé-
Afficher le fichier .y|.ylsd10.y22.88 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .o|.olex.yy.o18.88 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .c|.cscopeStack.c3.69 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .h|.hgraphVizHelper.h573 octets31/10/2018 18:32:37-refusé-
Afficher le fichier .h|.hsymbolsTableDataRepresentation.h1.31 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .o|.osymbolsTable.o5.2 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .h|.hcommon.h1.08 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .c|.cscopeHelper.c4.09 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .o|.ohashCode.o1.45 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .h|.hconsole.h2.21 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .o|.oconsole.o12.23 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .|lsd10lsd1075.26 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .h|.hhashCode.h1020 octets31/10/2018 18:32:37-refusé-
Afficher le fichier .h|.hsymbolsTable.h2.65 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .h|.hpcode.h417 octets31/10/2018 18:32:38-refusé-
Afficher le fichier .o|.oast.o11.45 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .h|.hscopeStack.h2.2 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .c|.cgraphVizHelper.c6.11 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .l|.llsd10.l6.46 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .h|.hy.tab.h4.69 Ko31/10/2018 18:32:39-refusé-
Afficher le fichier .output|.outputy.output81.69 Ko31/10/2018 18:32:39-refusé-
Afficher le fichier .o|.oy.tab.o24.45 Ko31/10/2018 18:32:39-refusé-
Afficher le fichier .c|.clex.yy.c57.93 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .h|.hast.h2.39 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .o|.oscopeStack.o1.34 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .o|.oscopeHelper.o2.59 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .h|.hastDataRepresentation.h1.87 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .c|.csymbolsTable.c14.91 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .c|.cpcode.c23.45 Ko31/10/2018 18:32:38-refusé-
Afficher le fichier .c|.chashCode.c3.94 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .c|.cconsole.c18.01 Ko31/10/2018 18:32:37-refusé-
Afficher le fichier .h|.hscopeHelper.h719 octets31/10/2018 18:32:38-refusé-

Avertissement

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.

Document créé le 07/03/2010, dernière modification le 28/10/2018
Source du document imprimé : https://www.gaudry.be/langages-lsd10-source-rf-project/source/y.tab.c.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Notes

  1. 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.

Table des matières Haut

Références

  1. livre Langue du document :fr IHDCB332 - Théorie des langages : Syntaxe et sémantique : PY Schobbens, Syntaxe et sémantique (January 2010)

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.

Table des matières Haut