The Sol Programming Language!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2800 lines
93 KiB

  1. /* A Bison parser, made by GNU Bison 2.7.12-4996. */
  2. /* Bison implementation for Yacc-like parsers in C
  3. Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. /* As a special exception, you may create a larger work that contains
  15. part or all of the Bison parser skeleton and distribute that work
  16. under terms of your choice, so long as that work isn't itself a
  17. parser generator using the skeleton or a modified version thereof
  18. as a parser skeleton. Alternatively, if you modify or redistribute
  19. the parser skeleton itself, you may (at your option) remove this
  20. special exception, which will cause the skeleton and the resulting
  21. Bison output files to be licensed under the GNU General Public
  22. License without this special exception.
  23. This special exception was added by the Free Software Foundation in
  24. version 2.2 of Bison. */
  25. /* C LALR(1) parser skeleton written by Richard Stallman, by
  26. simplifying the original so-called "semantic" parser. */
  27. /* All symbols defined below should begin with yy or YY, to avoid
  28. infringing on user name space. This should be done even for local
  29. variables, as they might otherwise be expanded by user macros.
  30. There are some unavoidable exceptions within include files to
  31. define necessary library symbols; they are noted "INFRINGES ON
  32. USER NAME SPACE" below. */
  33. /* Identify Bison output. */
  34. #define YYBISON 1
  35. /* Bison version. */
  36. #define YYBISON_VERSION "2.7.12-4996"
  37. /* Skeleton name. */
  38. #define YYSKELETON_NAME "yacc.c"
  39. /* Pure parsers. */
  40. #define YYPURE 0
  41. /* Push parsers. */
  42. #define YYPUSH 0
  43. /* Pull parsers. */
  44. #define YYPULL 1
  45. /* Copy the first part of user declarations. */
  46. /* Line 371 of yacc.c */
  47. #line 1 "parser.y"
  48. #include "sol.h"
  49. #include "ast.h"
  50. #include <string.h>
  51. #define YYSTYPE void *
  52. /* Line 371 of yacc.c */
  53. #line 78 "parser.tab.c"
  54. # ifndef YY_NULL
  55. # if defined __cplusplus && 201103L <= __cplusplus
  56. # define YY_NULL nullptr
  57. # else
  58. # define YY_NULL 0
  59. # endif
  60. # endif
  61. /* Enabling verbose error messages. */
  62. #ifdef YYERROR_VERBOSE
  63. # undef YYERROR_VERBOSE
  64. # define YYERROR_VERBOSE 1
  65. #else
  66. # define YYERROR_VERBOSE 0
  67. #endif
  68. /* In a future release of Bison, this section will be replaced
  69. by #include "parser.tab.h". */
  70. #ifndef YY_YY_PARSER_TAB_H_INCLUDED
  71. # define YY_YY_PARSER_TAB_H_INCLUDED
  72. /* Enabling traces. */
  73. #ifndef YYDEBUG
  74. # define YYDEBUG 1
  75. #endif
  76. #if YYDEBUG
  77. extern int yydebug;
  78. #endif
  79. /* Tokens. */
  80. #ifndef YYTOKENTYPE
  81. # define YYTOKENTYPE
  82. /* Put the tokens into the symbol table, so that GDB and other debuggers
  83. know about them. */
  84. enum yytokentype {
  85. IF = 258,
  86. THEN = 259,
  87. ELSE = 260,
  88. WHILE = 261,
  89. FOR = 262,
  90. IN = 263,
  91. DO = 264,
  92. FUNC = 265,
  93. RETURN = 266,
  94. BREAK = 267,
  95. CONTINUE = 268,
  96. END = 269,
  97. NONE = 270,
  98. IDENT = 271,
  99. INT = 272,
  100. FLOAT = 273,
  101. STRING = 274,
  102. PLUS = 275,
  103. MINUS = 276,
  104. STAR = 277,
  105. SLASH = 278,
  106. DSTAR = 279,
  107. BAND = 280,
  108. BOR = 281,
  109. BXOR = 282,
  110. BNOT = 283,
  111. LAND = 284,
  112. LOR = 285,
  113. LNOT = 286,
  114. ASSIGN = 287,
  115. ASSIGNPLUS = 288,
  116. ASSIGNMINUS = 289,
  117. ASSIGNSTAR = 290,
  118. ASSIGNSLASH = 291,
  119. ASSIGNDSTAR = 292,
  120. ASSIGNBAND = 293,
  121. ASSIGNBOR = 294,
  122. ASSIGNBXOR = 295,
  123. EQUAL = 296,
  124. LESS = 297,
  125. GREATER = 298,
  126. LESSEQ = 299,
  127. GREATEREQ = 300,
  128. RSHIFT = 301,
  129. LSHIFT = 302,
  130. LBRACE = 303,
  131. RBRACE = 304,
  132. LPAREN = 305,
  133. RPAREN = 306,
  134. LBRACKET = 307,
  135. RBRACKET = 308,
  136. DOT = 309,
  137. COLON = 310,
  138. SEMICOLON = 311,
  139. COMMA = 312,
  140. POUND = 313
  141. };
  142. #endif
  143. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  144. typedef int YYSTYPE;
  145. # define YYSTYPE_IS_TRIVIAL 1
  146. # define yystype YYSTYPE /* obsolescent; will be withdrawn */
  147. # define YYSTYPE_IS_DECLARED 1
  148. #endif
  149. extern YYSTYPE yylval;
  150. #ifdef YYPARSE_PARAM
  151. #if defined __STDC__ || defined __cplusplus
  152. int yyparse (void *YYPARSE_PARAM);
  153. #else
  154. int yyparse ();
  155. #endif
  156. #else /* ! YYPARSE_PARAM */
  157. #if defined __STDC__ || defined __cplusplus
  158. int yyparse (stmt_node **program);
  159. #else
  160. int yyparse ();
  161. #endif
  162. #endif /* ! YYPARSE_PARAM */
  163. #endif /* !YY_YY_PARSER_TAB_H_INCLUDED */
  164. /* Copy the second part of user declarations. */
  165. /* Line 390 of yacc.c */
  166. #line 202 "parser.tab.c"
  167. #ifdef short
  168. # undef short
  169. #endif
  170. #ifdef YYTYPE_UINT8
  171. typedef YYTYPE_UINT8 yytype_uint8;
  172. #else
  173. typedef unsigned char yytype_uint8;
  174. #endif
  175. #ifdef YYTYPE_INT8
  176. typedef YYTYPE_INT8 yytype_int8;
  177. #elif (defined __STDC__ || defined __C99__FUNC__ \
  178. || defined __cplusplus || defined _MSC_VER)
  179. typedef signed char yytype_int8;
  180. #else
  181. typedef short int yytype_int8;
  182. #endif
  183. #ifdef YYTYPE_UINT16
  184. typedef YYTYPE_UINT16 yytype_uint16;
  185. #else
  186. typedef unsigned short int yytype_uint16;
  187. #endif
  188. #ifdef YYTYPE_INT16
  189. typedef YYTYPE_INT16 yytype_int16;
  190. #else
  191. typedef short int yytype_int16;
  192. #endif
  193. #ifndef YYSIZE_T
  194. # ifdef __SIZE_TYPE__
  195. # define YYSIZE_T __SIZE_TYPE__
  196. # elif defined size_t
  197. # define YYSIZE_T size_t
  198. # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
  199. || defined __cplusplus || defined _MSC_VER)
  200. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  201. # define YYSIZE_T size_t
  202. # else
  203. # define YYSIZE_T unsigned int
  204. # endif
  205. #endif
  206. #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
  207. #ifndef YY_
  208. # if defined YYENABLE_NLS && YYENABLE_NLS
  209. # if ENABLE_NLS
  210. # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  211. # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
  212. # endif
  213. # endif
  214. # ifndef YY_
  215. # define YY_(Msgid) Msgid
  216. # endif
  217. #endif
  218. #ifndef __attribute__
  219. /* This feature is available in gcc versions 2.5 and later. */
  220. # if (! defined __GNUC__ || __GNUC__ < 2 \
  221. || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
  222. # define __attribute__(Spec) /* empty */
  223. # endif
  224. #endif
  225. /* Suppress unused-variable warnings by "using" E. */
  226. #if ! defined lint || defined __GNUC__
  227. # define YYUSE(E) ((void) (E))
  228. #else
  229. # define YYUSE(E) /* empty */
  230. #endif
  231. /* Identity function, used to suppress warnings about constant conditions. */
  232. #ifndef lint
  233. # define YYID(N) (N)
  234. #else
  235. #if (defined __STDC__ || defined __C99__FUNC__ \
  236. || defined __cplusplus || defined _MSC_VER)
  237. static int
  238. YYID (int yyi)
  239. #else
  240. static int
  241. YYID (yyi)
  242. int yyi;
  243. #endif
  244. {
  245. return yyi;
  246. }
  247. #endif
  248. #if ! defined yyoverflow || YYERROR_VERBOSE
  249. /* The parser invokes alloca or malloc; define the necessary symbols. */
  250. # ifdef YYSTACK_USE_ALLOCA
  251. # if YYSTACK_USE_ALLOCA
  252. # ifdef __GNUC__
  253. # define YYSTACK_ALLOC __builtin_alloca
  254. # elif defined __BUILTIN_VA_ARG_INCR
  255. # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  256. # elif defined _AIX
  257. # define YYSTACK_ALLOC __alloca
  258. # elif defined _MSC_VER
  259. # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  260. # define alloca _alloca
  261. # else
  262. # define YYSTACK_ALLOC alloca
  263. # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
  264. || defined __cplusplus || defined _MSC_VER)
  265. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  266. /* Use EXIT_SUCCESS as a witness for stdlib.h. */
  267. # ifndef EXIT_SUCCESS
  268. # define EXIT_SUCCESS 0
  269. # endif
  270. # endif
  271. # endif
  272. # endif
  273. # endif
  274. # ifdef YYSTACK_ALLOC
  275. /* Pacify GCC's `empty if-body' warning. */
  276. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
  277. # ifndef YYSTACK_ALLOC_MAXIMUM
  278. /* The OS might guarantee only one guard page at the bottom of the stack,
  279. and a page size can be as small as 4096 bytes. So we cannot safely
  280. invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
  281. to allow for a few compiler-allocated temporary stack slots. */
  282. # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  283. # endif
  284. # else
  285. # define YYSTACK_ALLOC YYMALLOC
  286. # define YYSTACK_FREE YYFREE
  287. # ifndef YYSTACK_ALLOC_MAXIMUM
  288. # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  289. # endif
  290. # if (defined __cplusplus && ! defined EXIT_SUCCESS \
  291. && ! ((defined YYMALLOC || defined malloc) \
  292. && (defined YYFREE || defined free)))
  293. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  294. # ifndef EXIT_SUCCESS
  295. # define EXIT_SUCCESS 0
  296. # endif
  297. # endif
  298. # ifndef YYMALLOC
  299. # define YYMALLOC malloc
  300. # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
  301. || defined __cplusplus || defined _MSC_VER)
  302. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  303. # endif
  304. # endif
  305. # ifndef YYFREE
  306. # define YYFREE free
  307. # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
  308. || defined __cplusplus || defined _MSC_VER)
  309. void free (void *); /* INFRINGES ON USER NAME SPACE */
  310. # endif
  311. # endif
  312. # endif
  313. #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  314. #if (! defined yyoverflow \
  315. && (! defined __cplusplus \
  316. || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  317. /* A type that is properly aligned for any stack member. */
  318. union yyalloc
  319. {
  320. yytype_int16 yyss_alloc;
  321. YYSTYPE yyvs_alloc;
  322. };
  323. /* The size of the maximum gap between one aligned stack and the next. */
  324. # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
  325. /* The size of an array large to enough to hold all stacks, each with
  326. N elements. */
  327. # define YYSTACK_BYTES(N) \
  328. ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
  329. + YYSTACK_GAP_MAXIMUM)
  330. # define YYCOPY_NEEDED 1
  331. /* Relocate STACK from its old location to the new one. The
  332. local variables YYSIZE and YYSTACKSIZE give the old and new number of
  333. elements in the stack, and YYPTR gives the new location of the
  334. stack. Advance YYPTR to a properly aligned location for the next
  335. stack. */
  336. # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
  337. do \
  338. { \
  339. YYSIZE_T yynewbytes; \
  340. YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
  341. Stack = &yyptr->Stack_alloc; \
  342. yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  343. yyptr += yynewbytes / sizeof (*yyptr); \
  344. } \
  345. while (YYID (0))
  346. #endif
  347. #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
  348. /* Copy COUNT objects from SRC to DST. The source and destination do
  349. not overlap. */
  350. # ifndef YYCOPY
  351. # if defined __GNUC__ && 1 < __GNUC__
  352. # define YYCOPY(Dst, Src, Count) \
  353. __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
  354. # else
  355. # define YYCOPY(Dst, Src, Count) \
  356. do \
  357. { \
  358. YYSIZE_T yyi; \
  359. for (yyi = 0; yyi < (Count); yyi++) \
  360. (Dst)[yyi] = (Src)[yyi]; \
  361. } \
  362. while (YYID (0))
  363. # endif
  364. # endif
  365. #endif /* !YYCOPY_NEEDED */
  366. /* YYFINAL -- State number of the termination state. */
  367. #define YYFINAL 68
  368. /* YYLAST -- Last index in YYTABLE. */
  369. #define YYLAST 649
  370. /* YYNTOKENS -- Number of terminals. */
  371. #define YYNTOKENS 59
  372. /* YYNNTS -- Number of nonterminals. */
  373. #define YYNNTS 27
  374. /* YYNRULES -- Number of rules. */
  375. #define YYNRULES 102
  376. /* YYNRULES -- Number of states. */
  377. #define YYNSTATES 189
  378. /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
  379. #define YYUNDEFTOK 2
  380. #define YYMAXUTOK 313
  381. #define YYTRANSLATE(YYX) \
  382. ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  383. /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
  384. static const yytype_uint8 yytranslate[] =
  385. {
  386. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  387. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  388. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  389. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  390. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  391. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  392. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  393. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  394. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  395. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  396. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  397. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  398. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  399. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  400. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  401. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  402. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  403. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  404. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  405. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  406. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  407. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  408. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  409. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  410. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  411. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  412. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
  413. 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
  414. 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
  415. 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
  416. 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
  417. 55, 56, 57, 58
  418. };
  419. #if YYDEBUG
  420. /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
  421. YYRHS. */
  422. static const yytype_uint16 yyprhs[] =
  423. {
  424. 0, 0, 3, 5, 7, 13, 21, 27, 35, 38,
  425. 40, 42, 44, 47, 49, 52, 55, 59, 63, 67,
  426. 71, 75, 79, 83, 87, 91, 95, 99, 103, 107,
  427. 111, 115, 119, 123, 127, 129, 133, 137, 139, 142,
  428. 144, 148, 152, 156, 160, 164, 166, 170, 174, 176,
  429. 180, 184, 186, 190, 192, 196, 200, 204, 208, 212,
  430. 214, 217, 219, 222, 224, 229, 236, 238, 246, 253,
  431. 255, 257, 258, 263, 267, 269, 274, 278, 280, 282,
  432. 284, 287, 289, 291, 293, 295, 299, 303, 305, 309,
  433. 310, 312, 315, 319, 320, 322, 325, 329, 330, 332,
  434. 335, 339, 345
  435. };
  436. /* YYRHS -- A `-1'-separated list of the rules' RHS. */
  437. static const yytype_int8 yyrhs[] =
  438. {
  439. 60, 0, -1, 61, -1, 63, -1, 3, 63, 4,
  440. 61, 14, -1, 3, 63, 4, 61, 5, 61, 14,
  441. -1, 6, 63, 9, 61, 14, -1, 7, 16, 8,
  442. 63, 9, 61, 14, -1, 11, 63, -1, 11, -1,
  443. 12, -1, 13, -1, 61, 56, -1, 62, -1, 62,
  444. 61, -1, 61, 61, -1, 16, 32, 63, -1, 16,
  445. 33, 63, -1, 16, 34, 63, -1, 16, 35, 63,
  446. -1, 16, 36, 63, -1, 16, 37, 63, -1, 16,
  447. 38, 63, -1, 16, 39, 63, -1, 16, 40, 63,
  448. -1, 77, 32, 63, -1, 77, 33, 63, -1, 77,
  449. 34, 63, -1, 77, 35, 63, -1, 77, 36, 63,
  450. -1, 77, 37, 63, -1, 77, 38, 63, -1, 77,
  451. 39, 63, -1, 77, 40, 63, -1, 64, -1, 64,
  452. 29, 64, -1, 64, 30, 64, -1, 65, -1, 31,
  453. 65, -1, 66, -1, 66, 41, 66, -1, 66, 42,
  454. 66, -1, 66, 43, 66, -1, 66, 44, 66, -1,
  455. 66, 45, 66, -1, 67, -1, 67, 20, 67, -1,
  456. 67, 21, 67, -1, 68, -1, 68, 22, 68, -1,
  457. 68, 23, 68, -1, 69, -1, 69, 24, 69, -1,
  458. 70, -1, 70, 25, 70, -1, 70, 26, 70, -1,
  459. 70, 27, 70, -1, 70, 47, 70, -1, 70, 46,
  460. 70, -1, 71, -1, 28, 71, -1, 72, -1, 58,
  461. 72, -1, 73, -1, 73, 50, 82, 51, -1, 73,
  462. 55, 16, 50, 82, 51, -1, 74, -1, 10, 16,
  463. 50, 83, 51, 75, 14, -1, 10, 50, 83, 51,
  464. 75, 14, -1, 76, -1, 61, -1, -1, 63, 52,
  465. 63, 53, -1, 63, 54, 16, -1, 78, -1, 63,
  466. 52, 63, 53, -1, 63, 54, 16, -1, 16, -1,
  467. 79, -1, 17, -1, 21, 17, -1, 18, -1, 19,
  468. -1, 15, -1, 80, -1, 52, 82, 53, -1, 48,
  469. 84, 49, -1, 81, -1, 50, 63, 51, -1, -1,
  470. 63, -1, 82, 63, -1, 82, 57, 63, -1, -1,
  471. 16, -1, 83, 16, -1, 83, 57, 16, -1, -1,
  472. 85, -1, 84, 85, -1, 84, 57, 85, -1, 52,
  473. 63, 53, 32, 63, -1, 16, 32, 63, -1
  474. };
  475. /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
  476. static const yytype_uint16 yyrline[] =
  477. {
  478. 0, 31, 31, 35, 36, 37, 38, 39, 40, 41,
  479. 42, 43, 44, 45, 49, 58, 70, 71, 78, 85,
  480. 92, 99, 106, 113, 120, 127, 140, 153, 166, 179,
  481. 192, 205, 218, 231, 244, 248, 249, 250, 254, 255,
  482. 259, 260, 261, 262, 263, 264, 268, 269, 270, 274,
  483. 275, 276, 280, 281, 285, 286, 287, 288, 289, 290,
  484. 294, 295, 299, 300, 304, 305, 322, 326, 334, 342,
  485. 346, 347, 351, 352, 363, 367, 368, 382, 383, 387,
  486. 388, 389, 390, 391, 392, 396, 397, 398, 402, 406,
  487. 407, 412, 421, 433, 434, 439, 448, 460, 461, 466,
  488. 475, 487, 492
  489. };
  490. #endif
  491. #if YYDEBUG || YYERROR_VERBOSE || 0
  492. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  493. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  494. static const char *const yytname[] =
  495. {
  496. "$end", "error", "$undefined", "IF", "THEN", "ELSE", "WHILE", "FOR",
  497. "IN", "DO", "FUNC", "RETURN", "BREAK", "CONTINUE", "END", "NONE",
  498. "IDENT", "INT", "FLOAT", "STRING", "PLUS", "MINUS", "STAR", "SLASH",
  499. "DSTAR", "BAND", "BOR", "BXOR", "BNOT", "LAND", "LOR", "LNOT", "ASSIGN",
  500. "ASSIGNPLUS", "ASSIGNMINUS", "ASSIGNSTAR", "ASSIGNSLASH", "ASSIGNDSTAR",
  501. "ASSIGNBAND", "ASSIGNBOR", "ASSIGNBXOR", "EQUAL", "LESS", "GREATER",
  502. "LESSEQ", "GREATEREQ", "RSHIFT", "LSHIFT", "LBRACE", "RBRACE", "LPAREN",
  503. "RPAREN", "LBRACKET", "RBRACKET", "DOT", "COLON", "SEMICOLON", "COMMA",
  504. "POUND", "$accept", "program", "stmt", "stmt_list", "expr", "logic_expr",
  505. "ulogic_expr", "rel_expr", "term_expr", "factor_expr", "power_expr",
  506. "binary_expr", "ubinary_expr", "ulen_expr", "call_expr", "funcdecl_expr",
  507. "opt_stmt", "index_expr", "ex_index_expr", "ref_expr", "lit_expr",
  508. "gen_expr", "paren_expr", "expr_list", "ident_list", "assoc_list",
  509. "assoc_item", YY_NULL
  510. };
  511. #endif
  512. # ifdef YYPRINT
  513. /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
  514. token YYLEX-NUM. */
  515. static const yytype_uint16 yytoknum[] =
  516. {
  517. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  518. 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
  519. 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
  520. 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
  521. 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
  522. 305, 306, 307, 308, 309, 310, 311, 312, 313
  523. };
  524. # endif
  525. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  526. static const yytype_uint8 yyr1[] =
  527. {
  528. 0, 59, 60, 61, 61, 61, 61, 61, 61, 61,
  529. 61, 61, 61, 61, 62, 62, 63, 63, 63, 63,
  530. 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
  531. 63, 63, 63, 63, 63, 64, 64, 64, 65, 65,
  532. 66, 66, 66, 66, 66, 66, 67, 67, 67, 68,
  533. 68, 68, 69, 69, 70, 70, 70, 70, 70, 70,
  534. 71, 71, 72, 72, 73, 73, 73, 74, 74, 74,
  535. 75, 75, 76, 76, 76, 77, 77, 78, 78, 79,
  536. 79, 79, 79, 79, 79, 80, 80, 80, 81, 82,
  537. 82, 82, 82, 83, 83, 83, 83, 84, 84, 84,
  538. 84, 85, 85
  539. };
  540. /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
  541. static const yytype_uint8 yyr2[] =
  542. {
  543. 0, 2, 1, 1, 5, 7, 5, 7, 2, 1,
  544. 1, 1, 2, 1, 2, 2, 3, 3, 3, 3,
  545. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  546. 3, 3, 3, 3, 1, 3, 3, 1, 2, 1,
  547. 3, 3, 3, 3, 3, 1, 3, 3, 1, 3,
  548. 3, 1, 3, 1, 3, 3, 3, 3, 3, 1,
  549. 2, 1, 2, 1, 4, 6, 1, 7, 6, 1,
  550. 1, 0, 4, 3, 1, 4, 3, 1, 1, 1,
  551. 2, 1, 1, 1, 1, 3, 3, 1, 3, 0,
  552. 1, 2, 3, 0, 1, 2, 3, 0, 1, 2,
  553. 3, 5, 3
  554. };
  555. /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
  556. Performed when YYTABLE doesn't specify something else to do. Zero
  557. means the default is an error. */
  558. static const yytype_uint8 yydefact[] =
  559. {
  560. 0, 0, 0, 0, 0, 9, 10, 11, 83, 77,
  561. 79, 81, 82, 0, 0, 0, 97, 0, 89, 0,
  562. 0, 2, 13, 3, 34, 37, 39, 45, 48, 51,
  563. 53, 59, 61, 63, 66, 69, 0, 74, 78, 84,
  564. 87, 0, 0, 0, 0, 93, 8, 0, 0, 0,
  565. 0, 0, 0, 0, 0, 0, 80, 0, 60, 38,
  566. 0, 0, 0, 98, 0, 90, 0, 62, 1, 12,
  567. 15, 14, 0, 0, 0, 0, 0, 0, 0, 0,
  568. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  569. 0, 89, 0, 0, 0, 0, 0, 0, 0, 0,
  570. 0, 0, 0, 0, 0, 93, 94, 0, 16, 17,
  571. 18, 19, 20, 21, 22, 23, 24, 0, 0, 86,
  572. 0, 99, 88, 85, 0, 91, 0, 73, 35, 36,
  573. 40, 41, 42, 43, 44, 46, 47, 49, 50, 52,
  574. 54, 55, 56, 58, 57, 0, 0, 25, 26, 27,
  575. 28, 29, 30, 31, 32, 33, 0, 0, 0, 0,
  576. 95, 71, 0, 102, 0, 100, 92, 72, 64, 89,
  577. 0, 4, 6, 0, 71, 70, 0, 96, 0, 0,
  578. 0, 0, 0, 68, 101, 65, 5, 7, 67
  579. };
  580. /* YYDEFGOTO[NTERM-NUM]. */
  581. static const yytype_int16 yydefgoto[] =
  582. {
  583. -1, 20, 70, 22, 57, 24, 25, 26, 27, 28,
  584. 29, 30, 31, 32, 33, 34, 176, 35, 36, 37,
  585. 38, 39, 40, 66, 107, 62, 63
  586. };
  587. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  588. STATE-NUM. */
  589. #define YYPACT_NINF -89
  590. static const yytype_int16 yypact[] =
  591. {
  592. 365, 110, 110, -7, -9, 110, -89, -89, -89, 215,
  593. -89, -89, -89, -4, 110, 110, -10, 110, 110, 110,
  594. 19, 342, 365, -19, 10, -89, -13, 67, 124, 13,
  595. 107, -89, -89, -40, -89, -89, 292, -89, -89, -89,
  596. -89, 4, 5, 38, 14, 44, -19, 110, 110, 110,
  597. 110, 110, 110, 110, 110, 110, -89, -19, 455, 15,
  598. 48, 110, 91, -89, 31, -19, 58, 490, -89, -89,
  599. 342, 342, 110, 74, 110, 110, 110, 110, 110, 110,
  600. 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
  601. 110, 110, 76, 110, 110, 110, 110, 110, 110, 110,
  602. 110, 110, 365, 365, 110, 44, -89, 27, -19, -19,
  603. -19, -19, -19, -19, -19, -19, -19, 110, 69, -89,
  604. -10, -89, -89, -89, 110, -19, 130, 418, 83, 83,
  605. -18, -18, -18, -18, -18, 595, 595, 565, 565, 560,
  606. 525, 525, 525, 525, 525, 391, 55, -19, -19, -19,
  607. -19, -19, -19, -19, -19, -19, 188, 211, 11, 93,
  608. -89, 365, 98, -19, 117, -89, -19, 454, -89, 110,
  609. 365, -89, -89, 365, 365, 342, 116, -89, 110, 416,
  610. 265, 288, 122, -89, -19, -89, -89, -89, -89
  611. };
  612. /* YYPGOTO[NTERM-NUM]. */
  613. static const yytype_int16 yypgoto[] =
  614. {
  615. -89, -89, 16, -89, 0, 77, 127, 87, 90, 104,
  616. 54, 373, 141, 140, -89, -89, 2, -89, -89, -89,
  617. -89, -89, -89, -88, 80, -89, -58
  618. };
  619. /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
  620. positive, shift that token. If negative, reduce the rule which
  621. number is the opposite. If YYTABLE_NINF, syntax error. */
  622. #define YYTABLE_NINF -77
  623. static const yytype_int16 yytable[] =
  624. {
  625. 23, 41, 42, 145, 121, 46, 60, 44, 102, 43,
  626. 91, -39, -39, 56, 103, 92, 21, 64, 65, 68,
  627. 173, 23, 23, 76, 77, 78, 79, 80, 76, 77,
  628. 78, 79, 80, 72, -39, 73, -39, 85, 71, 74,
  629. 75, 45, 61, 160, -37, -37, 104, 108, 109, 110,
  630. 111, 112, 113, 114, 115, 116, 72, 72, 73, 73,
  631. 106, 118, 165, 72, 105, 73, 125, -37, 4, -37,
  632. 23, 23, 126, 8, 9, 10, 11, 12, 161, 13,
  633. 117, 179, 122, 72, 162, 73, 14, 81, 82, 15,
  634. 127, 65, 146, 147, 148, 149, 150, 151, 152, 153,
  635. 154, 155, 23, 23, 158, 169, 16, 60, 17, 160,
  636. 18, 123, 74, 75, 177, 124, 19, 163, 156, 157,
  637. 4, 72, 164, 73, 166, 8, 9, 10, 11, 12,
  638. 183, 13, 86, 87, 88, -34, 188, -34, 14, 139,
  639. 119, 15, 59, 61, 174, 125, 83, 84, 120, 178,
  640. 162, 128, 129, 89, 90, 58, 23, 23, 16, 67,
  641. 17, 23, 18, 130, 131, 132, 133, 134, 19, 65,
  642. 23, 135, 136, 23, 23, 23, 182, 175, 184, 125,
  643. 23, 23, 72, 167, 73, 159, 180, 137, 138, 181,
  644. 175, 1, 0, 170, 2, 3, 0, 0, 4, 5,
  645. 6, 7, 171, 8, 9, 10, 11, 12, 0, 13,
  646. 0, 0, 0, 0, 1, 0, 14, 2, 3, 15,
  647. 0, 4, 5, 6, 7, 172, 8, 9, 10, 11,
  648. 12, 0, 13, 0, 0, 0, 16, 0, 17, 14,
  649. 18, 0, 15, 0, 69, 0, 19, 47, 48, 49,
  650. 50, 51, 52, 53, 54, 55, 0, 0, 0, 16,
  651. 0, 17, 0, 18, 0, 0, 0, 69, 1, 19,
  652. 0, 2, 3, 0, 0, 4, 5, 6, 7, 186,
  653. 8, 9, 10, 11, 12, 0, 13, 0, 0, 0,
  654. 0, 1, 0, 14, 2, 3, 15, 0, 4, 5,
  655. 6, 7, 187, 8, 9, 10, 11, 12, 0, 13,
  656. 0, 0, 0, 16, 0, 17, 14, 18, 0, 15,
  657. 0, 69, 0, 19, 93, 94, 95, 96, 97, 98,
  658. 99, 100, 101, 0, 0, 0, 16, 0, 17, 0,
  659. 18, 0, 0, 0, 69, 1, 19, 0, 2, 3,
  660. 0, 0, 4, 5, 6, 7, 0, 8, 9, 10,
  661. 11, 12, 0, 13, 0, 0, 0, 0, 1, 0,
  662. 14, 2, 3, 15, 0, 4, 5, 6, 7, 0,
  663. 8, 9, 10, 11, 12, 0, 13, 0, 0, 0,
  664. 16, 0, 17, 14, 18, 0, 15, 0, 69, 0,
  665. 19, 4, 0, 0, 0, 0, 8, 9, 10, 11,
  666. 12, 0, 13, 16, 0, 17, 0, 18, 0, 14,
  667. 0, 0, 15, 19, 0, 0, 4, 0, 0, 0,
  668. 0, 8, 9, 10, 11, 12, 0, 13, 0, 16,
  669. 0, 17, 168, 18, 14, 0, 0, 15, 124, 19,
  670. -76, -76, -76, -76, -76, -76, -76, -76, -76, 140,
  671. 141, 142, 143, 144, 16, 0, 17, 185, 18, 0,
  672. 0, 0, 0, 124, 19, -59, -59, -59, -59, -59,
  673. -59, -59, -59, 0, -59, -59, -75, -75, -75, -75,
  674. -75, -75, -75, -75, -75, 0, -59, -59, -59, -59,
  675. -59, -59, -59, 0, 0, 0, 0, -59, 0, -59,
  676. -61, -61, -61, -61, -61, -61, -61, -61, 0, -61,
  677. -61, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  678. 0, -61, -61, -61, -61, -61, -61, -61, 0, 0,
  679. 0, 0, -61, 0, -61, -53, -53, -53, -53, -53,
  680. 86, 87, 88, 0, -53, -53, 0, 0, 0, 0,
  681. 0, 0, 0, 0, 0, 0, -53, -53, -53, -53,
  682. -53, 89, 90, 0, 0, 0, 0, -53, 0, -53,
  683. -51, -51, -51, -51, 85, -48, -48, 83, 84, -51,
  684. -51, 0, 0, 0, -48, -48, 0, 0, 0, 0,
  685. 0, -51, -51, -51, -51, -51, -48, -48, -48, -48,
  686. -48, 0, -51, 0, -51, 81, 82, -48, 0, -48,
  687. 0, 0, 0, 0, -45, -45, 0, 0, 0, 0,
  688. 0, 0, 0, 0, 0, 0, -45, -45, -45, -45,
  689. -45, 0, 0, 0, 0, 0, 0, -45, 0, -45
  690. };
  691. #define yypact_value_is_default(Yystate) \
  692. (!!((Yystate) == (-89)))
  693. #define yytable_value_is_error(Yytable_value) \
  694. YYID (0)
  695. static const yytype_int16 yycheck[] =
  696. {
  697. 0, 1, 2, 91, 62, 5, 16, 16, 4, 16,
  698. 50, 29, 30, 17, 9, 55, 0, 17, 18, 0,
  699. 9, 21, 22, 41, 42, 43, 44, 45, 41, 42,
  700. 43, 44, 45, 52, 52, 54, 54, 24, 22, 29,
  701. 30, 50, 52, 16, 29, 30, 8, 47, 48, 49,
  702. 50, 51, 52, 53, 54, 55, 52, 52, 54, 54,
  703. 16, 61, 120, 52, 50, 54, 66, 52, 10, 54,
  704. 70, 71, 72, 15, 16, 17, 18, 19, 51, 21,
  705. 32, 169, 51, 52, 57, 54, 28, 20, 21, 31,
  706. 16, 91, 16, 93, 94, 95, 96, 97, 98, 99,
  707. 100, 101, 102, 103, 104, 50, 48, 16, 50, 16,
  708. 52, 53, 29, 30, 16, 57, 58, 117, 102, 103,
  709. 10, 52, 53, 54, 124, 15, 16, 17, 18, 19,
  710. 14, 21, 25, 26, 27, 52, 14, 54, 28, 85,
  711. 49, 31, 15, 52, 51, 145, 22, 23, 57, 32,
  712. 57, 74, 75, 46, 47, 14, 156, 157, 48, 19,
  713. 50, 161, 52, 76, 77, 78, 79, 80, 58, 169,
  714. 170, 81, 82, 173, 174, 175, 174, 161, 178, 179,
  715. 180, 181, 52, 53, 54, 105, 170, 83, 84, 173,
  716. 174, 3, -1, 5, 6, 7, -1, -1, 10, 11,
  717. 12, 13, 14, 15, 16, 17, 18, 19, -1, 21,
  718. -1, -1, -1, -1, 3, -1, 28, 6, 7, 31,
  719. -1, 10, 11, 12, 13, 14, 15, 16, 17, 18,
  720. 19, -1, 21, -1, -1, -1, 48, -1, 50, 28,
  721. 52, -1, 31, -1, 56, -1, 58, 32, 33, 34,
  722. 35, 36, 37, 38, 39, 40, -1, -1, -1, 48,
  723. -1, 50, -1, 52, -1, -1, -1, 56, 3, 58,
  724. -1, 6, 7, -1, -1, 10, 11, 12, 13, 14,
  725. 15, 16, 17, 18, 19, -1, 21, -1, -1, -1,
  726. -1, 3, -1, 28, 6, 7, 31, -1, 10, 11,
  727. 12, 13, 14, 15, 16, 17, 18, 19, -1, 21,
  728. -1, -1, -1, 48, -1, 50, 28, 52, -1, 31,
  729. -1, 56, -1, 58, 32, 33, 34, 35, 36, 37,
  730. 38, 39, 40, -1, -1, -1, 48, -1, 50, -1,
  731. 52, -1, -1, -1, 56, 3, 58, -1, 6, 7,
  732. -1, -1, 10, 11, 12, 13, -1, 15, 16, 17,
  733. 18, 19, -1, 21, -1, -1, -1, -1, 3, -1,
  734. 28, 6, 7, 31, -1, 10, 11, 12, 13, -1,
  735. 15, 16, 17, 18, 19, -1, 21, -1, -1, -1,
  736. 48, -1, 50, 28, 52, -1, 31, -1, 56, -1,
  737. 58, 10, -1, -1, -1, -1, 15, 16, 17, 18,
  738. 19, -1, 21, 48, -1, 50, -1, 52, -1, 28,
  739. -1, -1, 31, 58, -1, -1, 10, -1, -1, -1,
  740. -1, 15, 16, 17, 18, 19, -1, 21, -1, 48,
  741. -1, 50, 51, 52, 28, -1, -1, 31, 57, 58,
  742. 32, 33, 34, 35, 36, 37, 38, 39, 40, 86,
  743. 87, 88, 89, 90, 48, -1, 50, 51, 52, -1,
  744. -1, -1, -1, 57, 58, 20, 21, 22, 23, 24,
  745. 25, 26, 27, -1, 29, 30, 32, 33, 34, 35,
  746. 36, 37, 38, 39, 40, -1, 41, 42, 43, 44,
  747. 45, 46, 47, -1, -1, -1, -1, 52, -1, 54,
  748. 20, 21, 22, 23, 24, 25, 26, 27, -1, 29,
  749. 30, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  750. -1, 41, 42, 43, 44, 45, 46, 47, -1, -1,
  751. -1, -1, 52, -1, 54, 20, 21, 22, 23, 24,
  752. 25, 26, 27, -1, 29, 30, -1, -1, -1, -1,
  753. -1, -1, -1, -1, -1, -1, 41, 42, 43, 44,
  754. 45, 46, 47, -1, -1, -1, -1, 52, -1, 54,
  755. 20, 21, 22, 23, 24, 20, 21, 22, 23, 29,
  756. 30, -1, -1, -1, 29, 30, -1, -1, -1, -1,
  757. -1, 41, 42, 43, 44, 45, 41, 42, 43, 44,
  758. 45, -1, 52, -1, 54, 20, 21, 52, -1, 54,
  759. -1, -1, -1, -1, 29, 30, -1, -1, -1, -1,
  760. -1, -1, -1, -1, -1, -1, 41, 42, 43, 44,
  761. 45, -1, -1, -1, -1, -1, -1, 52, -1, 54
  762. };
  763. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  764. symbol of state STATE-NUM. */
  765. static const yytype_uint8 yystos[] =
  766. {
  767. 0, 3, 6, 7, 10, 11, 12, 13, 15, 16,
  768. 17, 18, 19, 21, 28, 31, 48, 50, 52, 58,
  769. 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
  770. 70, 71, 72, 73, 74, 76, 77, 78, 79, 80,
  771. 81, 63, 63, 16, 16, 50, 63, 32, 33, 34,
  772. 35, 36, 37, 38, 39, 40, 17, 63, 71, 65,
  773. 16, 52, 84, 85, 63, 63, 82, 72, 0, 56,
  774. 61, 61, 52, 54, 29, 30, 41, 42, 43, 44,
  775. 45, 20, 21, 22, 23, 24, 25, 26, 27, 46,
  776. 47, 50, 55, 32, 33, 34, 35, 36, 37, 38,
  777. 39, 40, 4, 9, 8, 50, 16, 83, 63, 63,
  778. 63, 63, 63, 63, 63, 63, 63, 32, 63, 49,
  779. 57, 85, 51, 53, 57, 63, 63, 16, 64, 64,
  780. 66, 66, 66, 66, 66, 67, 67, 68, 68, 69,
  781. 70, 70, 70, 70, 70, 82, 16, 63, 63, 63,
  782. 63, 63, 63, 63, 63, 63, 61, 61, 63, 83,
  783. 16, 51, 57, 63, 53, 85, 63, 53, 51, 50,
  784. 5, 14, 14, 9, 51, 61, 75, 16, 32, 82,
  785. 61, 61, 75, 14, 63, 51, 14, 14, 14
  786. };
  787. #define yyerrok (yyerrstatus = 0)
  788. #define yyclearin (yychar = YYEMPTY)
  789. #define YYEMPTY (-2)
  790. #define YYEOF 0
  791. #define YYACCEPT goto yyacceptlab
  792. #define YYABORT goto yyabortlab
  793. #define YYERROR goto yyerrorlab
  794. /* Like YYERROR except do call yyerror. This remains here temporarily
  795. to ease the transition to the new meaning of YYERROR, for GCC.
  796. Once GCC version 2 has supplanted version 1, this can go. However,
  797. YYFAIL appears to be in use. Nevertheless, it is formally deprecated
  798. in Bison 2.4.2's NEWS entry, where a plan to phase it out is
  799. discussed. */
  800. #define YYFAIL goto yyerrlab
  801. #if defined YYFAIL
  802. /* This is here to suppress warnings from the GCC cpp's
  803. -Wunused-macros. Normally we don't worry about that warning, but
  804. some users do, and we want to make it easy for users to remove
  805. YYFAIL uses, which will produce warnings from Bison 2.5. */
  806. #endif
  807. #define YYRECOVERING() (!!yyerrstatus)
  808. #define YYBACKUP(Token, Value) \
  809. do \
  810. if (yychar == YYEMPTY) \
  811. { \
  812. yychar = (Token); \
  813. yylval = (Value); \
  814. YYPOPSTACK (yylen); \
  815. yystate = *yyssp; \
  816. goto yybackup; \
  817. } \
  818. else \
  819. { \
  820. yyerror (program, YY_("syntax error: cannot back up")); \
  821. YYERROR; \
  822. } \
  823. while (YYID (0))
  824. /* Error token number */
  825. #define YYTERROR 1
  826. #define YYERRCODE 256
  827. /* This macro is provided for backward compatibility. */
  828. #ifndef YY_LOCATION_PRINT
  829. # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  830. #endif
  831. /* YYLEX -- calling `yylex' with the right arguments. */
  832. #ifdef YYLEX_PARAM
  833. # define YYLEX yylex (YYLEX_PARAM)
  834. #else
  835. # define YYLEX yylex ()
  836. #endif
  837. /* Enable debugging if requested. */
  838. #if YYDEBUG
  839. # ifndef YYFPRINTF
  840. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  841. # define YYFPRINTF fprintf
  842. # endif
  843. # define YYDPRINTF(Args) \
  844. do { \
  845. if (yydebug) \
  846. YYFPRINTF Args; \
  847. } while (YYID (0))
  848. # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
  849. do { \
  850. if (yydebug) \
  851. { \
  852. YYFPRINTF (stderr, "%s ", Title); \
  853. yy_symbol_print (stderr, \
  854. Type, Value, program); \
  855. YYFPRINTF (stderr, "\n"); \
  856. } \
  857. } while (YYID (0))
  858. /*--------------------------------.
  859. | Print this symbol on YYOUTPUT. |
  860. `--------------------------------*/
  861. /*ARGSUSED*/
  862. #if (defined __STDC__ || defined __C99__FUNC__ \
  863. || defined __cplusplus || defined _MSC_VER)
  864. static void
  865. yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, stmt_node **program)
  866. #else
  867. static void
  868. yy_symbol_value_print (yyoutput, yytype, yyvaluep, program)
  869. FILE *yyoutput;
  870. int yytype;
  871. YYSTYPE const * const yyvaluep;
  872. stmt_node **program;
  873. #endif
  874. {
  875. FILE *yyo = yyoutput;
  876. YYUSE (yyo);
  877. if (!yyvaluep)
  878. return;
  879. YYUSE (program);
  880. # ifdef YYPRINT
  881. if (yytype < YYNTOKENS)
  882. YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  883. # else
  884. YYUSE (yyoutput);
  885. # endif
  886. YYUSE (yytype);
  887. }
  888. /*--------------------------------.
  889. | Print this symbol on YYOUTPUT. |
  890. `--------------------------------*/
  891. #if (defined __STDC__ || defined __C99__FUNC__ \
  892. || defined __cplusplus || defined _MSC_VER)
  893. static void
  894. yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, stmt_node **program)
  895. #else
  896. static void
  897. yy_symbol_print (yyoutput, yytype, yyvaluep, program)
  898. FILE *yyoutput;
  899. int yytype;
  900. YYSTYPE const * const yyvaluep;
  901. stmt_node **program;
  902. #endif
  903. {
  904. if (yytype < YYNTOKENS)
  905. YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
  906. else
  907. YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
  908. yy_symbol_value_print (yyoutput, yytype, yyvaluep, program);
  909. YYFPRINTF (yyoutput, ")");
  910. }
  911. /*------------------------------------------------------------------.
  912. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  913. | TOP (included). |
  914. `------------------------------------------------------------------*/
  915. #if (defined __STDC__ || defined __C99__FUNC__ \
  916. || defined __cplusplus || defined _MSC_VER)
  917. static void
  918. yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
  919. #else
  920. static void
  921. yy_stack_print (yybottom, yytop)
  922. yytype_int16 *yybottom;
  923. yytype_int16 *yytop;
  924. #endif
  925. {
  926. YYFPRINTF (stderr, "Stack now");
  927. for (; yybottom <= yytop; yybottom++)
  928. {
  929. int yybot = *yybottom;
  930. YYFPRINTF (stderr, " %d", yybot);
  931. }
  932. YYFPRINTF (stderr, "\n");
  933. }
  934. # define YY_STACK_PRINT(Bottom, Top) \
  935. do { \
  936. if (yydebug) \
  937. yy_stack_print ((Bottom), (Top)); \
  938. } while (YYID (0))
  939. /*------------------------------------------------.
  940. | Report that the YYRULE is going to be reduced. |
  941. `------------------------------------------------*/
  942. #if (defined __STDC__ || defined __C99__FUNC__ \
  943. || defined __cplusplus || defined _MSC_VER)
  944. static void
  945. yy_reduce_print (YYSTYPE *yyvsp, int yyrule, stmt_node **program)
  946. #else
  947. static void
  948. yy_reduce_print (yyvsp, yyrule, program)
  949. YYSTYPE *yyvsp;
  950. int yyrule;
  951. stmt_node **program;
  952. #endif
  953. {
  954. int yynrhs = yyr2[yyrule];
  955. int yyi;
  956. unsigned long int yylno = yyrline[yyrule];
  957. YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  958. yyrule - 1, yylno);
  959. /* The symbols being reduced. */
  960. for (yyi = 0; yyi < yynrhs; yyi++)
  961. {
  962. YYFPRINTF (stderr, " $%d = ", yyi + 1);
  963. yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
  964. &(yyvsp[(yyi + 1) - (yynrhs)])
  965. , program);
  966. YYFPRINTF (stderr, "\n");
  967. }
  968. }
  969. # define YY_REDUCE_PRINT(Rule) \
  970. do { \
  971. if (yydebug) \
  972. yy_reduce_print (yyvsp, Rule, program); \
  973. } while (YYID (0))
  974. /* Nonzero means print parse trace. It is left uninitialized so that
  975. multiple parsers can coexist. */
  976. int yydebug;
  977. #else /* !YYDEBUG */
  978. # define YYDPRINTF(Args)
  979. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  980. # define YY_STACK_PRINT(Bottom, Top)
  981. # define YY_REDUCE_PRINT(Rule)
  982. #endif /* !YYDEBUG */
  983. /* YYINITDEPTH -- initial size of the parser's stacks. */
  984. #ifndef YYINITDEPTH
  985. # define YYINITDEPTH 200
  986. #endif
  987. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  988. if the built-in stack extension method is used).
  989. Do not make this value too large; the results are undefined if
  990. YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  991. evaluated with infinite-precision integer arithmetic. */
  992. #ifndef YYMAXDEPTH
  993. # define YYMAXDEPTH 10000
  994. #endif
  995. #if YYERROR_VERBOSE
  996. # ifndef yystrlen
  997. # if defined __GLIBC__ && defined _STRING_H
  998. # define yystrlen strlen
  999. # else
  1000. /* Return the length of YYSTR. */
  1001. #if (defined __STDC__ || defined __C99__FUNC__ \
  1002. || defined __cplusplus || defined _MSC_VER)
  1003. static YYSIZE_T
  1004. yystrlen (const char *yystr)
  1005. #else
  1006. static YYSIZE_T
  1007. yystrlen (yystr)
  1008. const char *yystr;
  1009. #endif
  1010. {
  1011. YYSIZE_T yylen;
  1012. for (yylen = 0; yystr[yylen]; yylen++)
  1013. continue;
  1014. return yylen;
  1015. }
  1016. # endif
  1017. # endif
  1018. # ifndef yystpcpy
  1019. # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  1020. # define yystpcpy stpcpy
  1021. # else
  1022. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  1023. YYDEST. */
  1024. #if (defined __STDC__ || defined __C99__FUNC__ \
  1025. || defined __cplusplus || defined _MSC_VER)
  1026. static char *
  1027. yystpcpy (char *yydest, const char *yysrc)
  1028. #else
  1029. static char *
  1030. yystpcpy (yydest, yysrc)
  1031. char *yydest;
  1032. const char *yysrc;
  1033. #endif
  1034. {
  1035. char *yyd = yydest;
  1036. const char *yys = yysrc;
  1037. while ((*yyd++ = *yys++) != '\0')
  1038. continue;
  1039. return yyd - 1;
  1040. }
  1041. # endif
  1042. # endif
  1043. # ifndef yytnamerr
  1044. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  1045. quotes and backslashes, so that it's suitable for yyerror. The
  1046. heuristic is that double-quoting is unnecessary unless the string
  1047. contains an apostrophe, a comma, or backslash (other than
  1048. backslash-backslash). YYSTR is taken from yytname. If YYRES is
  1049. null, do not copy; instead, return the length of what the result
  1050. would have been. */
  1051. static YYSIZE_T
  1052. yytnamerr (char *yyres, const char *yystr)
  1053. {
  1054. if (*yystr == '"')
  1055. {
  1056. YYSIZE_T yyn = 0;
  1057. char const *yyp = yystr;
  1058. for (;;)
  1059. switch (*++yyp)
  1060. {
  1061. case '\'':
  1062. case ',':
  1063. goto do_not_strip_quotes;
  1064. case '\\':
  1065. if (*++yyp != '\\')
  1066. goto do_not_strip_quotes;
  1067. /* Fall through. */
  1068. default:
  1069. if (yyres)
  1070. yyres[yyn] = *yyp;
  1071. yyn++;
  1072. break;
  1073. case '"':
  1074. if (yyres)
  1075. yyres[yyn] = '\0';
  1076. return yyn;
  1077. }
  1078. do_not_strip_quotes: ;
  1079. }
  1080. if (! yyres)
  1081. return yystrlen (yystr);
  1082. return yystpcpy (yyres, yystr) - yyres;
  1083. }
  1084. # endif
  1085. /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
  1086. about the unexpected token YYTOKEN for the state stack whose top is
  1087. YYSSP.
  1088. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
  1089. not large enough to hold the message. In that case, also set
  1090. *YYMSG_ALLOC to the required number of bytes. Return 2 if the
  1091. required number of bytes is too large to store. */
  1092. static int
  1093. yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
  1094. yytype_int16 *yyssp, int yytoken)
  1095. {
  1096. YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
  1097. YYSIZE_T yysize = yysize0;
  1098. enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  1099. /* Internationalized format string. */
  1100. const char *yyformat = YY_NULL;
  1101. /* Arguments of yyformat. */
  1102. char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  1103. /* Number of reported tokens (one for the "unexpected", one per
  1104. "expected"). */
  1105. int yycount = 0;
  1106. /* There are many possibilities here to consider:
  1107. - Assume YYFAIL is not used. It's too flawed to consider. See
  1108. <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
  1109. for details. YYERROR is fine as it does not invoke this
  1110. function.
  1111. - If this state is a consistent state with a default action, then
  1112. the only way this function was invoked is if the default action
  1113. is an error action. In that case, don't check for expected
  1114. tokens because there are none.
  1115. - The only way there can be no lookahead present (in yychar) is if
  1116. this state is a consistent state with a default action. Thus,
  1117. detecting the absence of a lookahead is sufficient to determine
  1118. that there is no unexpected or expected token to report. In that
  1119. case, just report a simple "syntax error".
  1120. - Don't assume there isn't a lookahead just because this state is a
  1121. consistent state with a default action. There might have been a
  1122. previous inconsistent state, consistent state with a non-default
  1123. action, or user semantic action that manipulated yychar.
  1124. - Of course, the expected token list depends on states to have
  1125. correct lookahead information, and it depends on the parser not
  1126. to perform extra reductions after fetching a lookahead from the
  1127. scanner and before detecting a syntax error. Thus, state merging
  1128. (from LALR or IELR) and default reductions corrupt the expected
  1129. token list. However, the list is correct for canonical LR with
  1130. one exception: it will still contain any token that will not be
  1131. accepted due to an error action in a later state.
  1132. */
  1133. if (yytoken != YYEMPTY)
  1134. {
  1135. int yyn = yypact[*yyssp