eval.tab.c 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473
  1. /* A Bison parser, made by GNU Bison 3.0.4. */
  2. /* Bison implementation for Yacc-like parsers in C
  3. Copyright (C) 1984, 1989-1990, 2000-2015 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 "3.0.4"
  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 7 "eval.y" /* yacc.c:339 */
  47. #include <stdio.h>
  48. /* Pré-déclarations */
  49. int yylex (void);
  50. void yyerror (const char *);
  51. /* Variable définie dans un autre fichier */
  52. extern char* yytext;
  53. #line 78 "eval.tab.c" /* yacc.c:339 */
  54. # ifndef YY_NULLPTR
  55. # if defined __cplusplus && 201103L <= __cplusplus
  56. # define YY_NULLPTR nullptr
  57. # else
  58. # define YY_NULLPTR 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 "eval.tab.h". */
  70. #ifndef YY_YY_EVAL_TAB_H_INCLUDED
  71. # define YY_YY_EVAL_TAB_H_INCLUDED
  72. /* Debug traces. */
  73. #ifndef YYDEBUG
  74. # define YYDEBUG 0
  75. #endif
  76. #if YYDEBUG
  77. extern int yydebug;
  78. #endif
  79. /* Token type. */
  80. #ifndef YYTOKENTYPE
  81. # define YYTOKENTYPE
  82. enum yytokentype
  83. {
  84. nombre = 258
  85. };
  86. #endif
  87. /* Value type. */
  88. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  89. typedef int YYSTYPE;
  90. # define YYSTYPE_IS_TRIVIAL 1
  91. # define YYSTYPE_IS_DECLARED 1
  92. #endif
  93. extern YYSTYPE yylval;
  94. int yyparse (void);
  95. #endif /* !YY_YY_EVAL_TAB_H_INCLUDED */
  96. /* Copy the second part of user declarations. */
  97. #line 133 "eval.tab.c" /* yacc.c:358 */
  98. #ifdef short
  99. # undef short
  100. #endif
  101. #ifdef YYTYPE_UINT8
  102. typedef YYTYPE_UINT8 yytype_uint8;
  103. #else
  104. typedef unsigned char yytype_uint8;
  105. #endif
  106. #ifdef YYTYPE_INT8
  107. typedef YYTYPE_INT8 yytype_int8;
  108. #else
  109. typedef signed char yytype_int8;
  110. #endif
  111. #ifdef YYTYPE_UINT16
  112. typedef YYTYPE_UINT16 yytype_uint16;
  113. #else
  114. typedef unsigned short int yytype_uint16;
  115. #endif
  116. #ifdef YYTYPE_INT16
  117. typedef YYTYPE_INT16 yytype_int16;
  118. #else
  119. typedef short int yytype_int16;
  120. #endif
  121. #ifndef YYSIZE_T
  122. # ifdef __SIZE_TYPE__
  123. # define YYSIZE_T __SIZE_TYPE__
  124. # elif defined size_t
  125. # define YYSIZE_T size_t
  126. # elif ! defined YYSIZE_T
  127. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  128. # define YYSIZE_T size_t
  129. # else
  130. # define YYSIZE_T unsigned int
  131. # endif
  132. #endif
  133. #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
  134. #ifndef YY_
  135. # if defined YYENABLE_NLS && YYENABLE_NLS
  136. # if ENABLE_NLS
  137. # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  138. # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
  139. # endif
  140. # endif
  141. # ifndef YY_
  142. # define YY_(Msgid) Msgid
  143. # endif
  144. #endif
  145. #ifndef YY_ATTRIBUTE
  146. # if (defined __GNUC__ \
  147. && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
  148. || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
  149. # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
  150. # else
  151. # define YY_ATTRIBUTE(Spec) /* empty */
  152. # endif
  153. #endif
  154. #ifndef YY_ATTRIBUTE_PURE
  155. # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
  156. #endif
  157. #ifndef YY_ATTRIBUTE_UNUSED
  158. # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
  159. #endif
  160. #if !defined _Noreturn \
  161. && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
  162. # if defined _MSC_VER && 1200 <= _MSC_VER
  163. # define _Noreturn __declspec (noreturn)
  164. # else
  165. # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
  166. # endif
  167. #endif
  168. /* Suppress unused-variable warnings by "using" E. */
  169. #if ! defined lint || defined __GNUC__
  170. # define YYUSE(E) ((void) (E))
  171. #else
  172. # define YYUSE(E) /* empty */
  173. #endif
  174. #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  175. /* Suppress an incorrect diagnostic about yylval being uninitialized. */
  176. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
  177. _Pragma ("GCC diagnostic push") \
  178. _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
  179. _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  180. # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
  181. _Pragma ("GCC diagnostic pop")
  182. #else
  183. # define YY_INITIAL_VALUE(Value) Value
  184. #endif
  185. #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  186. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  187. # define YY_IGNORE_MAYBE_UNINITIALIZED_END
  188. #endif
  189. #ifndef YY_INITIAL_VALUE
  190. # define YY_INITIAL_VALUE(Value) /* Nothing. */
  191. #endif
  192. #if ! defined yyoverflow || YYERROR_VERBOSE
  193. /* The parser invokes alloca or malloc; define the necessary symbols. */
  194. # ifdef YYSTACK_USE_ALLOCA
  195. # if YYSTACK_USE_ALLOCA
  196. # ifdef __GNUC__
  197. # define YYSTACK_ALLOC __builtin_alloca
  198. # elif defined __BUILTIN_VA_ARG_INCR
  199. # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  200. # elif defined _AIX
  201. # define YYSTACK_ALLOC __alloca
  202. # elif defined _MSC_VER
  203. # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  204. # define alloca _alloca
  205. # else
  206. # define YYSTACK_ALLOC alloca
  207. # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
  208. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  209. /* Use EXIT_SUCCESS as a witness for stdlib.h. */
  210. # ifndef EXIT_SUCCESS
  211. # define EXIT_SUCCESS 0
  212. # endif
  213. # endif
  214. # endif
  215. # endif
  216. # endif
  217. # ifdef YYSTACK_ALLOC
  218. /* Pacify GCC's 'empty if-body' warning. */
  219. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  220. # ifndef YYSTACK_ALLOC_MAXIMUM
  221. /* The OS might guarantee only one guard page at the bottom of the stack,
  222. and a page size can be as small as 4096 bytes. So we cannot safely
  223. invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
  224. to allow for a few compiler-allocated temporary stack slots. */
  225. # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  226. # endif
  227. # else
  228. # define YYSTACK_ALLOC YYMALLOC
  229. # define YYSTACK_FREE YYFREE
  230. # ifndef YYSTACK_ALLOC_MAXIMUM
  231. # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  232. # endif
  233. # if (defined __cplusplus && ! defined EXIT_SUCCESS \
  234. && ! ((defined YYMALLOC || defined malloc) \
  235. && (defined YYFREE || defined free)))
  236. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  237. # ifndef EXIT_SUCCESS
  238. # define EXIT_SUCCESS 0
  239. # endif
  240. # endif
  241. # ifndef YYMALLOC
  242. # define YYMALLOC malloc
  243. # if ! defined malloc && ! defined EXIT_SUCCESS
  244. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  245. # endif
  246. # endif
  247. # ifndef YYFREE
  248. # define YYFREE free
  249. # if ! defined free && ! defined EXIT_SUCCESS
  250. void free (void *); /* INFRINGES ON USER NAME SPACE */
  251. # endif
  252. # endif
  253. # endif
  254. #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  255. #if (! defined yyoverflow \
  256. && (! defined __cplusplus \
  257. || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  258. /* A type that is properly aligned for any stack member. */
  259. union yyalloc
  260. {
  261. yytype_int16 yyss_alloc;
  262. YYSTYPE yyvs_alloc;
  263. };
  264. /* The size of the maximum gap between one aligned stack and the next. */
  265. # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
  266. /* The size of an array large to enough to hold all stacks, each with
  267. N elements. */
  268. # define YYSTACK_BYTES(N) \
  269. ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
  270. + YYSTACK_GAP_MAXIMUM)
  271. # define YYCOPY_NEEDED 1
  272. /* Relocate STACK from its old location to the new one. The
  273. local variables YYSIZE and YYSTACKSIZE give the old and new number of
  274. elements in the stack, and YYPTR gives the new location of the
  275. stack. Advance YYPTR to a properly aligned location for the next
  276. stack. */
  277. # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
  278. do \
  279. { \
  280. YYSIZE_T yynewbytes; \
  281. YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
  282. Stack = &yyptr->Stack_alloc; \
  283. yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  284. yyptr += yynewbytes / sizeof (*yyptr); \
  285. } \
  286. while (0)
  287. #endif
  288. #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
  289. /* Copy COUNT objects from SRC to DST. The source and destination do
  290. not overlap. */
  291. # ifndef YYCOPY
  292. # if defined __GNUC__ && 1 < __GNUC__
  293. # define YYCOPY(Dst, Src, Count) \
  294. __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
  295. # else
  296. # define YYCOPY(Dst, Src, Count) \
  297. do \
  298. { \
  299. YYSIZE_T yyi; \
  300. for (yyi = 0; yyi < (Count); yyi++) \
  301. (Dst)[yyi] = (Src)[yyi]; \
  302. } \
  303. while (0)
  304. # endif
  305. # endif
  306. #endif /* !YYCOPY_NEEDED */
  307. /* YYFINAL -- State number of the termination state. */
  308. #define YYFINAL 8
  309. /* YYLAST -- Last index in YYTABLE. */
  310. #define YYLAST 16
  311. /* YYNTOKENS -- Number of terminals. */
  312. #define YYNTOKENS 9
  313. /* YYNNTS -- Number of nonterminals. */
  314. #define YYNNTS 5
  315. /* YYNRULES -- Number of rules. */
  316. #define YYNRULES 9
  317. /* YYNSTATES -- Number of states. */
  318. #define YYNSTATES 16
  319. /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
  320. by yylex, with out-of-bounds checking. */
  321. #define YYUNDEFTOK 2
  322. #define YYMAXUTOK 258
  323. #define YYTRANSLATE(YYX) \
  324. ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  325. /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
  326. as returned by yylex, without out-of-bounds checking. */
  327. static const yytype_uint8 yytranslate[] =
  328. {
  329. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  330. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  331. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  332. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  333. 7, 8, 2, 5, 2, 6, 2, 2, 2, 2,
  334. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  335. 2, 4, 2, 2, 2, 2, 2, 2, 2, 2,
  336. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  337. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  338. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  339. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  340. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  341. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  342. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  343. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  344. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  345. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  346. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  347. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  348. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  349. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  350. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  351. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  352. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  353. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  354. 2, 2, 2, 2, 2, 2, 1, 2, 3
  355. };
  356. #if YYDEBUG
  357. /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
  358. static const yytype_uint8 yyrline[] =
  359. {
  360. 0, 27, 27, 28, 31, 34, 35, 36, 39, 40
  361. };
  362. #endif
  363. #if YYDEBUG || YYERROR_VERBOSE || 0
  364. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  365. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  366. static const char *const yytname[] =
  367. {
  368. "$end", "error", "$undefined", "nombre", "'='", "'+'", "'-'", "'('",
  369. "')'", "$accept", "EXPR_CALCS", "EXPR_CALC", "EXPR", "FACTEUR", YY_NULLPTR
  370. };
  371. #endif
  372. # ifdef YYPRINT
  373. /* YYTOKNUM[NUM] -- (External) token number corresponding to the
  374. (internal) symbol number NUM (which must be that of a token). */
  375. static const yytype_uint16 yytoknum[] =
  376. {
  377. 0, 256, 257, 258, 61, 43, 45, 40, 41
  378. };
  379. # endif
  380. #define YYPACT_NINF -3
  381. #define yypact_value_is_default(Yystate) \
  382. (!!((Yystate) == (-3)))
  383. #define YYTABLE_NINF -1
  384. #define yytable_value_is_error(Yytable_value) \
  385. 0
  386. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  387. STATE-NUM. */
  388. static const yytype_int8 yypact[] =
  389. {
  390. -2, -3, -2, 0, -3, 8, -3, 3, -3, -3,
  391. -3, -2, -2, -3, -3, -3
  392. };
  393. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  394. Performed when YYTABLE does not specify something else to do. Zero
  395. means the default is an error. */
  396. static const yytype_uint8 yydefact[] =
  397. {
  398. 0, 8, 0, 0, 2, 0, 5, 0, 1, 3,
  399. 4, 0, 0, 9, 6, 7
  400. };
  401. /* YYPGOTO[NTERM-NUM]. */
  402. static const yytype_int8 yypgoto[] =
  403. {
  404. -3, -3, -1, 2, 4
  405. };
  406. /* YYDEFGOTO[NTERM-NUM]. */
  407. static const yytype_int8 yydefgoto[] =
  408. {
  409. -1, 3, 4, 5, 6
  410. };
  411. /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
  412. positive, shift that token. If negative, reduce the rule whose
  413. number is the opposite. If YYTABLE_NINF, syntax error. */
  414. static const yytype_uint8 yytable[] =
  415. {
  416. 8, 1, 9, 1, 7, 2, 0, 2, 11, 12,
  417. 0, 13, 10, 11, 12, 14, 15
  418. };
  419. static const yytype_int8 yycheck[] =
  420. {
  421. 0, 3, 3, 3, 2, 7, -1, 7, 5, 6,
  422. -1, 8, 4, 5, 6, 11, 12
  423. };
  424. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  425. symbol of state STATE-NUM. */
  426. static const yytype_uint8 yystos[] =
  427. {
  428. 0, 3, 7, 10, 11, 12, 13, 12, 0, 11,
  429. 4, 5, 6, 8, 13, 13
  430. };
  431. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  432. static const yytype_uint8 yyr1[] =
  433. {
  434. 0, 9, 10, 10, 11, 12, 12, 12, 13, 13
  435. };
  436. /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
  437. static const yytype_uint8 yyr2[] =
  438. {
  439. 0, 2, 1, 2, 2, 1, 3, 3, 1, 3
  440. };
  441. #define yyerrok (yyerrstatus = 0)
  442. #define yyclearin (yychar = YYEMPTY)
  443. #define YYEMPTY (-2)
  444. #define YYEOF 0
  445. #define YYACCEPT goto yyacceptlab
  446. #define YYABORT goto yyabortlab
  447. #define YYERROR goto yyerrorlab
  448. #define YYRECOVERING() (!!yyerrstatus)
  449. #define YYBACKUP(Token, Value) \
  450. do \
  451. if (yychar == YYEMPTY) \
  452. { \
  453. yychar = (Token); \
  454. yylval = (Value); \
  455. YYPOPSTACK (yylen); \
  456. yystate = *yyssp; \
  457. goto yybackup; \
  458. } \
  459. else \
  460. { \
  461. yyerror (YY_("syntax error: cannot back up")); \
  462. YYERROR; \
  463. } \
  464. while (0)
  465. /* Error token number */
  466. #define YYTERROR 1
  467. #define YYERRCODE 256
  468. /* Enable debugging if requested. */
  469. #if YYDEBUG
  470. # ifndef YYFPRINTF
  471. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  472. # define YYFPRINTF fprintf
  473. # endif
  474. # define YYDPRINTF(Args) \
  475. do { \
  476. if (yydebug) \
  477. YYFPRINTF Args; \
  478. } while (0)
  479. /* This macro is provided for backward compatibility. */
  480. #ifndef YY_LOCATION_PRINT
  481. # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  482. #endif
  483. # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
  484. do { \
  485. if (yydebug) \
  486. { \
  487. YYFPRINTF (stderr, "%s ", Title); \
  488. yy_symbol_print (stderr, \
  489. Type, Value); \
  490. YYFPRINTF (stderr, "\n"); \
  491. } \
  492. } while (0)
  493. /*----------------------------------------.
  494. | Print this symbol's value on YYOUTPUT. |
  495. `----------------------------------------*/
  496. static void
  497. yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
  498. {
  499. FILE *yyo = yyoutput;
  500. YYUSE (yyo);
  501. if (!yyvaluep)
  502. return;
  503. # ifdef YYPRINT
  504. if (yytype < YYNTOKENS)
  505. YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  506. # endif
  507. YYUSE (yytype);
  508. }
  509. /*--------------------------------.
  510. | Print this symbol on YYOUTPUT. |
  511. `--------------------------------*/
  512. static void
  513. yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
  514. {
  515. YYFPRINTF (yyoutput, "%s %s (",
  516. yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
  517. yy_symbol_value_print (yyoutput, yytype, yyvaluep);
  518. YYFPRINTF (yyoutput, ")");
  519. }
  520. /*------------------------------------------------------------------.
  521. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  522. | TOP (included). |
  523. `------------------------------------------------------------------*/
  524. static void
  525. yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
  526. {
  527. YYFPRINTF (stderr, "Stack now");
  528. for (; yybottom <= yytop; yybottom++)
  529. {
  530. int yybot = *yybottom;
  531. YYFPRINTF (stderr, " %d", yybot);
  532. }
  533. YYFPRINTF (stderr, "\n");
  534. }
  535. # define YY_STACK_PRINT(Bottom, Top) \
  536. do { \
  537. if (yydebug) \
  538. yy_stack_print ((Bottom), (Top)); \
  539. } while (0)
  540. /*------------------------------------------------.
  541. | Report that the YYRULE is going to be reduced. |
  542. `------------------------------------------------*/
  543. static void
  544. yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
  545. {
  546. unsigned long int yylno = yyrline[yyrule];
  547. int yynrhs = yyr2[yyrule];
  548. int yyi;
  549. YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  550. yyrule - 1, yylno);
  551. /* The symbols being reduced. */
  552. for (yyi = 0; yyi < yynrhs; yyi++)
  553. {
  554. YYFPRINTF (stderr, " $%d = ", yyi + 1);
  555. yy_symbol_print (stderr,
  556. yystos[yyssp[yyi + 1 - yynrhs]],
  557. &(yyvsp[(yyi + 1) - (yynrhs)])
  558. );
  559. YYFPRINTF (stderr, "\n");
  560. }
  561. }
  562. # define YY_REDUCE_PRINT(Rule) \
  563. do { \
  564. if (yydebug) \
  565. yy_reduce_print (yyssp, yyvsp, Rule); \
  566. } while (0)
  567. /* Nonzero means print parse trace. It is left uninitialized so that
  568. multiple parsers can coexist. */
  569. int yydebug;
  570. #else /* !YYDEBUG */
  571. # define YYDPRINTF(Args)
  572. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  573. # define YY_STACK_PRINT(Bottom, Top)
  574. # define YY_REDUCE_PRINT(Rule)
  575. #endif /* !YYDEBUG */
  576. /* YYINITDEPTH -- initial size of the parser's stacks. */
  577. #ifndef YYINITDEPTH
  578. # define YYINITDEPTH 200
  579. #endif
  580. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  581. if the built-in stack extension method is used).
  582. Do not make this value too large; the results are undefined if
  583. YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  584. evaluated with infinite-precision integer arithmetic. */
  585. #ifndef YYMAXDEPTH
  586. # define YYMAXDEPTH 10000
  587. #endif
  588. #if YYERROR_VERBOSE
  589. # ifndef yystrlen
  590. # if defined __GLIBC__ && defined _STRING_H
  591. # define yystrlen strlen
  592. # else
  593. /* Return the length of YYSTR. */
  594. static YYSIZE_T
  595. yystrlen (const char *yystr)
  596. {
  597. YYSIZE_T yylen;
  598. for (yylen = 0; yystr[yylen]; yylen++)
  599. continue;
  600. return yylen;
  601. }
  602. # endif
  603. # endif
  604. # ifndef yystpcpy
  605. # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  606. # define yystpcpy stpcpy
  607. # else
  608. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  609. YYDEST. */
  610. static char *
  611. yystpcpy (char *yydest, const char *yysrc)
  612. {
  613. char *yyd = yydest;
  614. const char *yys = yysrc;
  615. while ((*yyd++ = *yys++) != '\0')
  616. continue;
  617. return yyd - 1;
  618. }
  619. # endif
  620. # endif
  621. # ifndef yytnamerr
  622. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  623. quotes and backslashes, so that it's suitable for yyerror. The
  624. heuristic is that double-quoting is unnecessary unless the string
  625. contains an apostrophe, a comma, or backslash (other than
  626. backslash-backslash). YYSTR is taken from yytname. If YYRES is
  627. null, do not copy; instead, return the length of what the result
  628. would have been. */
  629. static YYSIZE_T
  630. yytnamerr (char *yyres, const char *yystr)
  631. {
  632. if (*yystr == '"')
  633. {
  634. YYSIZE_T yyn = 0;
  635. char const *yyp = yystr;
  636. for (;;)
  637. switch (*++yyp)
  638. {
  639. case '\'':
  640. case ',':
  641. goto do_not_strip_quotes;
  642. case '\\':
  643. if (*++yyp != '\\')
  644. goto do_not_strip_quotes;
  645. /* Fall through. */
  646. default:
  647. if (yyres)
  648. yyres[yyn] = *yyp;
  649. yyn++;
  650. break;
  651. case '"':
  652. if (yyres)
  653. yyres[yyn] = '\0';
  654. return yyn;
  655. }
  656. do_not_strip_quotes: ;
  657. }
  658. if (! yyres)
  659. return yystrlen (yystr);
  660. return yystpcpy (yyres, yystr) - yyres;
  661. }
  662. # endif
  663. /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
  664. about the unexpected token YYTOKEN for the state stack whose top is
  665. YYSSP.
  666. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
  667. not large enough to hold the message. In that case, also set
  668. *YYMSG_ALLOC to the required number of bytes. Return 2 if the
  669. required number of bytes is too large to store. */
  670. static int
  671. yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
  672. yytype_int16 *yyssp, int yytoken)
  673. {
  674. YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
  675. YYSIZE_T yysize = yysize0;
  676. enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  677. /* Internationalized format string. */
  678. const char *yyformat = YY_NULLPTR;
  679. /* Arguments of yyformat. */
  680. char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  681. /* Number of reported tokens (one for the "unexpected", one per
  682. "expected"). */
  683. int yycount = 0;
  684. /* There are many possibilities here to consider:
  685. - If this state is a consistent state with a default action, then
  686. the only way this function was invoked is if the default action
  687. is an error action. In that case, don't check for expected
  688. tokens because there are none.
  689. - The only way there can be no lookahead present (in yychar) is if
  690. this state is a consistent state with a default action. Thus,
  691. detecting the absence of a lookahead is sufficient to determine
  692. that there is no unexpected or expected token to report. In that
  693. case, just report a simple "syntax error".
  694. - Don't assume there isn't a lookahead just because this state is a
  695. consistent state with a default action. There might have been a
  696. previous inconsistent state, consistent state with a non-default
  697. action, or user semantic action that manipulated yychar.
  698. - Of course, the expected token list depends on states to have
  699. correct lookahead information, and it depends on the parser not
  700. to perform extra reductions after fetching a lookahead from the
  701. scanner and before detecting a syntax error. Thus, state merging
  702. (from LALR or IELR) and default reductions corrupt the expected
  703. token list. However, the list is correct for canonical LR with
  704. one exception: it will still contain any token that will not be
  705. accepted due to an error action in a later state.
  706. */
  707. if (yytoken != YYEMPTY)
  708. {
  709. int yyn = yypact[*yyssp];
  710. yyarg[yycount++] = yytname[yytoken];
  711. if (!yypact_value_is_default (yyn))
  712. {
  713. /* Start YYX at -YYN if negative to avoid negative indexes in
  714. YYCHECK. In other words, skip the first -YYN actions for
  715. this state because they are default actions. */
  716. int yyxbegin = yyn < 0 ? -yyn : 0;
  717. /* Stay within bounds of both yycheck and yytname. */
  718. int yychecklim = YYLAST - yyn + 1;
  719. int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  720. int yyx;
  721. for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  722. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
  723. && !yytable_value_is_error (yytable[yyx + yyn]))
  724. {
  725. if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
  726. {
  727. yycount = 1;
  728. yysize = yysize0;
  729. break;
  730. }
  731. yyarg[yycount++] = yytname[yyx];
  732. {
  733. YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
  734. if (! (yysize <= yysize1
  735. && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
  736. return 2;
  737. yysize = yysize1;
  738. }
  739. }
  740. }
  741. }
  742. switch (yycount)
  743. {
  744. # define YYCASE_(N, S) \
  745. case N: \
  746. yyformat = S; \
  747. break
  748. YYCASE_(0, YY_("syntax error"));
  749. YYCASE_(1, YY_("syntax error, unexpected %s"));
  750. YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
  751. YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
  752. YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
  753. YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
  754. # undef YYCASE_
  755. }
  756. {
  757. YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
  758. if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
  759. return 2;
  760. yysize = yysize1;
  761. }
  762. if (*yymsg_alloc < yysize)
  763. {
  764. *yymsg_alloc = 2 * yysize;
  765. if (! (yysize <= *yymsg_alloc
  766. && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
  767. *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
  768. return 1;
  769. }
  770. /* Avoid sprintf, as that infringes on the user's name space.
  771. Don't have undefined behavior even if the translation
  772. produced a string with the wrong number of "%s"s. */
  773. {
  774. char *yyp = *yymsg;
  775. int yyi = 0;
  776. while ((*yyp = *yyformat) != '\0')
  777. if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
  778. {
  779. yyp += yytnamerr (yyp, yyarg[yyi++]);
  780. yyformat += 2;
  781. }
  782. else
  783. {
  784. yyp++;
  785. yyformat++;
  786. }
  787. }
  788. return 0;
  789. }
  790. #endif /* YYERROR_VERBOSE */
  791. /*-----------------------------------------------.
  792. | Release the memory associated to this symbol. |
  793. `-----------------------------------------------*/
  794. static void
  795. yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
  796. {
  797. YYUSE (yyvaluep);
  798. if (!yymsg)
  799. yymsg = "Deleting";
  800. YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  801. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  802. YYUSE (yytype);
  803. YY_IGNORE_MAYBE_UNINITIALIZED_END
  804. }
  805. /* The lookahead symbol. */
  806. int yychar;
  807. /* The semantic value of the lookahead symbol. */
  808. YYSTYPE yylval;
  809. /* Number of syntax errors so far. */
  810. int yynerrs;
  811. /*----------.
  812. | yyparse. |
  813. `----------*/
  814. int
  815. yyparse (void)
  816. {
  817. int yystate;
  818. /* Number of tokens to shift before error messages enabled. */
  819. int yyerrstatus;
  820. /* The stacks and their tools:
  821. 'yyss': related to states.
  822. 'yyvs': related to semantic values.
  823. Refer to the stacks through separate pointers, to allow yyoverflow
  824. to reallocate them elsewhere. */
  825. /* The state stack. */
  826. yytype_int16 yyssa[YYINITDEPTH];
  827. yytype_int16 *yyss;
  828. yytype_int16 *yyssp;
  829. /* The semantic value stack. */
  830. YYSTYPE yyvsa[YYINITDEPTH];
  831. YYSTYPE *yyvs;
  832. YYSTYPE *yyvsp;
  833. YYSIZE_T yystacksize;
  834. int yyn;
  835. int yyresult;
  836. /* Lookahead token as an internal (translated) token number. */
  837. int yytoken = 0;
  838. /* The variables used to return semantic value and location from the
  839. action routines. */
  840. YYSTYPE yyval;
  841. #if YYERROR_VERBOSE
  842. /* Buffer for error messages, and its allocated size. */
  843. char yymsgbuf[128];
  844. char *yymsg = yymsgbuf;
  845. YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
  846. #endif
  847. #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
  848. /* The number of symbols on the RHS of the reduced rule.
  849. Keep to zero when no symbol should be popped. */
  850. int yylen = 0;
  851. yyssp = yyss = yyssa;
  852. yyvsp = yyvs = yyvsa;
  853. yystacksize = YYINITDEPTH;
  854. YYDPRINTF ((stderr, "Starting parse\n"));
  855. yystate = 0;
  856. yyerrstatus = 0;
  857. yynerrs = 0;
  858. yychar = YYEMPTY; /* Cause a token to be read. */
  859. goto yysetstate;
  860. /*------------------------------------------------------------.
  861. | yynewstate -- Push a new state, which is found in yystate. |
  862. `------------------------------------------------------------*/
  863. yynewstate:
  864. /* In all cases, when you get here, the value and location stacks
  865. have just been pushed. So pushing a state here evens the stacks. */
  866. yyssp++;
  867. yysetstate:
  868. *yyssp = yystate;
  869. if (yyss + yystacksize - 1 <= yyssp)
  870. {
  871. /* Get the current used size of the three stacks, in elements. */
  872. YYSIZE_T yysize = yyssp - yyss + 1;
  873. #ifdef yyoverflow
  874. {
  875. /* Give user a chance to reallocate the stack. Use copies of
  876. these so that the &'s don't force the real ones into
  877. memory. */
  878. YYSTYPE *yyvs1 = yyvs;
  879. yytype_int16 *yyss1 = yyss;
  880. /* Each stack pointer address is followed by the size of the
  881. data in use in that stack, in bytes. This used to be a
  882. conditional around just the two extra args, but that might
  883. be undefined if yyoverflow is a macro. */
  884. yyoverflow (YY_("memory exhausted"),
  885. &yyss1, yysize * sizeof (*yyssp),
  886. &yyvs1, yysize * sizeof (*yyvsp),
  887. &yystacksize);
  888. yyss = yyss1;
  889. yyvs = yyvs1;
  890. }
  891. #else /* no yyoverflow */
  892. # ifndef YYSTACK_RELOCATE
  893. goto yyexhaustedlab;
  894. # else
  895. /* Extend the stack our own way. */
  896. if (YYMAXDEPTH <= yystacksize)
  897. goto yyexhaustedlab;
  898. yystacksize *= 2;
  899. if (YYMAXDEPTH < yystacksize)
  900. yystacksize = YYMAXDEPTH;
  901. {
  902. yytype_int16 *yyss1 = yyss;
  903. union yyalloc *yyptr =
  904. (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  905. if (! yyptr)
  906. goto yyexhaustedlab;
  907. YYSTACK_RELOCATE (yyss_alloc, yyss);
  908. YYSTACK_RELOCATE (yyvs_alloc, yyvs);
  909. # undef YYSTACK_RELOCATE
  910. if (yyss1 != yyssa)
  911. YYSTACK_FREE (yyss1);
  912. }
  913. # endif
  914. #endif /* no yyoverflow */
  915. yyssp = yyss + yysize - 1;
  916. yyvsp = yyvs + yysize - 1;
  917. YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  918. (unsigned long int) yystacksize));
  919. if (yyss + yystacksize - 1 <= yyssp)
  920. YYABORT;
  921. }
  922. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  923. if (yystate == YYFINAL)
  924. YYACCEPT;
  925. goto yybackup;
  926. /*-----------.
  927. | yybackup. |
  928. `-----------*/
  929. yybackup:
  930. /* Do appropriate processing given the current state. Read a
  931. lookahead token if we need one and don't already have one. */
  932. /* First try to decide what to do without reference to lookahead token. */
  933. yyn = yypact[yystate];
  934. if (yypact_value_is_default (yyn))
  935. goto yydefault;
  936. /* Not known => get a lookahead token if don't already have one. */
  937. /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
  938. if (yychar == YYEMPTY)
  939. {
  940. YYDPRINTF ((stderr, "Reading a token: "));
  941. yychar = yylex ();
  942. }
  943. if (yychar <= YYEOF)
  944. {
  945. yychar = yytoken = YYEOF;
  946. YYDPRINTF ((stderr, "Now at end of input.\n"));
  947. }
  948. else
  949. {
  950. yytoken = YYTRANSLATE (yychar);
  951. YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  952. }
  953. /* If the proper action on seeing token YYTOKEN is to reduce or to
  954. detect an error, take that action. */
  955. yyn += yytoken;
  956. if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  957. goto yydefault;
  958. yyn = yytable[yyn];
  959. if (yyn <= 0)
  960. {
  961. if (yytable_value_is_error (yyn))
  962. goto yyerrlab;
  963. yyn = -yyn;
  964. goto yyreduce;
  965. }
  966. /* Count tokens shifted since error; after three, turn off error
  967. status. */
  968. if (yyerrstatus)
  969. yyerrstatus--;
  970. /* Shift the lookahead token. */
  971. YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  972. /* Discard the shifted token. */
  973. yychar = YYEMPTY;
  974. yystate = yyn;
  975. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  976. *++yyvsp = yylval;
  977. YY_IGNORE_MAYBE_UNINITIALIZED_END
  978. goto yynewstate;
  979. /*-----------------------------------------------------------.
  980. | yydefault -- do the default action for the current state. |
  981. `-----------------------------------------------------------*/
  982. yydefault:
  983. yyn = yydefact[yystate];
  984. if (yyn == 0)
  985. goto yyerrlab;
  986. goto yyreduce;
  987. /*-----------------------------.
  988. | yyreduce -- Do a reduction. |
  989. `-----------------------------*/
  990. yyreduce:
  991. /* yyn is the number of a rule to reduce with. */
  992. yylen = yyr2[yyn];
  993. /* If YYLEN is nonzero, implement the default value of the action:
  994. '$$ = $1'.
  995. Otherwise, the following line sets YYVAL to garbage.
  996. This behavior is undocumented and Bison
  997. users should not rely upon it. Assigning to YYVAL
  998. unconditionally makes the parser a bit smaller, and it avoids a
  999. GCC warning that YYVAL may be used uninitialized. */
  1000. yyval = yyvsp[1-yylen];
  1001. YY_REDUCE_PRINT (yyn);
  1002. switch (yyn)
  1003. {
  1004. case 4:
  1005. #line 31 "eval.y" /* yacc.c:1646 */
  1006. { printf("%d\n", (yyvsp[-1])); }
  1007. #line 1203 "eval.tab.c" /* yacc.c:1646 */
  1008. break;
  1009. case 6:
  1010. #line 35 "eval.y" /* yacc.c:1646 */
  1011. {(yyval) = (yyvsp[-2]) + (yyvsp[0]);}
  1012. #line 1209 "eval.tab.c" /* yacc.c:1646 */
  1013. break;
  1014. case 7:
  1015. #line 36 "eval.y" /* yacc.c:1646 */
  1016. {(yyval) = (yyvsp[-2]) - (yyvsp[0]);}
  1017. #line 1215 "eval.tab.c" /* yacc.c:1646 */
  1018. break;
  1019. case 8:
  1020. #line 39 "eval.y" /* yacc.c:1646 */
  1021. {(yyval) = (yyvsp[0]);}
  1022. #line 1221 "eval.tab.c" /* yacc.c:1646 */
  1023. break;
  1024. case 9:
  1025. #line 40 "eval.y" /* yacc.c:1646 */
  1026. {(yyval) = (yyvsp[-1]);}
  1027. #line 1227 "eval.tab.c" /* yacc.c:1646 */
  1028. break;
  1029. #line 1231 "eval.tab.c" /* yacc.c:1646 */
  1030. default: break;
  1031. }
  1032. /* User semantic actions sometimes alter yychar, and that requires
  1033. that yytoken be updated with the new translation. We take the
  1034. approach of translating immediately before every use of yytoken.
  1035. One alternative is translating here after every semantic action,
  1036. but that translation would be missed if the semantic action invokes
  1037. YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
  1038. if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
  1039. incorrect destructor might then be invoked immediately. In the
  1040. case of YYERROR or YYBACKUP, subsequent parser actions might lead
  1041. to an incorrect destructor call or verbose syntax error message
  1042. before the lookahead is translated. */
  1043. YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  1044. YYPOPSTACK (yylen);
  1045. yylen = 0;
  1046. YY_STACK_PRINT (yyss, yyssp);
  1047. *++yyvsp = yyval;
  1048. /* Now 'shift' the result of the reduction. Determine what state
  1049. that goes to, based on the state we popped back to and the rule
  1050. number reduced by. */
  1051. yyn = yyr1[yyn];
  1052. yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  1053. if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1054. yystate = yytable[yystate];
  1055. else
  1056. yystate = yydefgoto[yyn - YYNTOKENS];
  1057. goto yynewstate;
  1058. /*--------------------------------------.
  1059. | yyerrlab -- here on detecting error. |
  1060. `--------------------------------------*/
  1061. yyerrlab:
  1062. /* Make sure we have latest lookahead translation. See comments at
  1063. user semantic actions for why this is necessary. */
  1064. yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
  1065. /* If not already recovering from an error, report this error. */
  1066. if (!yyerrstatus)
  1067. {
  1068. ++yynerrs;
  1069. #if ! YYERROR_VERBOSE
  1070. yyerror (YY_("syntax error"));
  1071. #else
  1072. # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
  1073. yyssp, yytoken)
  1074. {
  1075. char const *yymsgp = YY_("syntax error");
  1076. int yysyntax_error_status;
  1077. yysyntax_error_status = YYSYNTAX_ERROR;
  1078. if (yysyntax_error_status == 0)
  1079. yymsgp = yymsg;
  1080. else if (yysyntax_error_status == 1)
  1081. {
  1082. if (yymsg != yymsgbuf)
  1083. YYSTACK_FREE (yymsg);
  1084. yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
  1085. if (!yymsg)
  1086. {
  1087. yymsg = yymsgbuf;
  1088. yymsg_alloc = sizeof yymsgbuf;
  1089. yysyntax_error_status = 2;
  1090. }
  1091. else
  1092. {
  1093. yysyntax_error_status = YYSYNTAX_ERROR;
  1094. yymsgp = yymsg;
  1095. }
  1096. }
  1097. yyerror (yymsgp);
  1098. if (yysyntax_error_status == 2)
  1099. goto yyexhaustedlab;
  1100. }
  1101. # undef YYSYNTAX_ERROR
  1102. #endif
  1103. }
  1104. if (yyerrstatus == 3)
  1105. {
  1106. /* If just tried and failed to reuse lookahead token after an
  1107. error, discard it. */
  1108. if (yychar <= YYEOF)
  1109. {
  1110. /* Return failure if at end of input. */
  1111. if (yychar == YYEOF)
  1112. YYABORT;
  1113. }
  1114. else
  1115. {
  1116. yydestruct ("Error: discarding",
  1117. yytoken, &yylval);
  1118. yychar = YYEMPTY;
  1119. }
  1120. }
  1121. /* Else will try to reuse lookahead token after shifting the error
  1122. token. */
  1123. goto yyerrlab1;
  1124. /*---------------------------------------------------.
  1125. | yyerrorlab -- error raised explicitly by YYERROR. |
  1126. `---------------------------------------------------*/
  1127. yyerrorlab:
  1128. /* Pacify compilers like GCC when the user code never invokes
  1129. YYERROR and the label yyerrorlab therefore never appears in user
  1130. code. */
  1131. if (/*CONSTCOND*/ 0)
  1132. goto yyerrorlab;
  1133. /* Do not reclaim the symbols of the rule whose action triggered
  1134. this YYERROR. */
  1135. YYPOPSTACK (yylen);
  1136. yylen = 0;
  1137. YY_STACK_PRINT (yyss, yyssp);
  1138. yystate = *yyssp;
  1139. goto yyerrlab1;
  1140. /*-------------------------------------------------------------.
  1141. | yyerrlab1 -- common code for both syntax error and YYERROR. |
  1142. `-------------------------------------------------------------*/
  1143. yyerrlab1:
  1144. yyerrstatus = 3; /* Each real token shifted decrements this. */
  1145. for (;;)
  1146. {
  1147. yyn = yypact[yystate];
  1148. if (!yypact_value_is_default (yyn))
  1149. {
  1150. yyn += YYTERROR;
  1151. if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  1152. {
  1153. yyn = yytable[yyn];
  1154. if (0 < yyn)
  1155. break;
  1156. }
  1157. }
  1158. /* Pop the current state because it cannot handle the error token. */
  1159. if (yyssp == yyss)
  1160. YYABORT;
  1161. yydestruct ("Error: popping",
  1162. yystos[yystate], yyvsp);
  1163. YYPOPSTACK (1);
  1164. yystate = *yyssp;
  1165. YY_STACK_PRINT (yyss, yyssp);
  1166. }
  1167. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1168. *++yyvsp = yylval;
  1169. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1170. /* Shift the error token. */
  1171. YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  1172. yystate = yyn;
  1173. goto yynewstate;
  1174. /*-------------------------------------.
  1175. | yyacceptlab -- YYACCEPT comes here. |
  1176. `-------------------------------------*/
  1177. yyacceptlab:
  1178. yyresult = 0;
  1179. goto yyreturn;
  1180. /*-----------------------------------.
  1181. | yyabortlab -- YYABORT comes here. |
  1182. `-----------------------------------*/
  1183. yyabortlab:
  1184. yyresult = 1;
  1185. goto yyreturn;
  1186. #if !defined yyoverflow || YYERROR_VERBOSE
  1187. /*-------------------------------------------------.
  1188. | yyexhaustedlab -- memory exhaustion comes here. |
  1189. `-------------------------------------------------*/
  1190. yyexhaustedlab:
  1191. yyerror (YY_("memory exhausted"));
  1192. yyresult = 2;
  1193. /* Fall through. */
  1194. #endif
  1195. yyreturn:
  1196. if (yychar != YYEMPTY)
  1197. {
  1198. /* Make sure we have latest lookahead translation. See comments at
  1199. user semantic actions for why this is necessary. */
  1200. yytoken = YYTRANSLATE (yychar);
  1201. yydestruct ("Cleanup: discarding lookahead",
  1202. yytoken, &yylval);
  1203. }
  1204. /* Do not reclaim the symbols of the rule whose action triggered
  1205. this YYABORT or YYACCEPT. */
  1206. YYPOPSTACK (yylen);
  1207. YY_STACK_PRINT (yyss, yyssp);
  1208. while (yyssp != yyss)
  1209. {
  1210. yydestruct ("Cleanup: popping",
  1211. yystos[*yyssp], yyvsp);
  1212. YYPOPSTACK (1);
  1213. }
  1214. #ifndef yyoverflow
  1215. if (yyss != yyssa)
  1216. YYSTACK_FREE (yyss);
  1217. #endif
  1218. #if YYERROR_VERBOSE
  1219. if (yymsg != yymsgbuf)
  1220. YYSTACK_FREE (yymsg);
  1221. #endif
  1222. return yyresult;
  1223. }
  1224. #line 43 "eval.y" /* yacc.c:1906 */
  1225. #include <stdio.h>
  1226. #include "eval.tab.h"
  1227. void yyerror (const char * error)
  1228. {
  1229. fprintf (stderr, "Erreur: %s sur l'expression %s\n", error, yytext);
  1230. }
  1231. int main() {
  1232. if ( yyparse() != 0 ) {
  1233. fprintf(stderr,"Syntaxe incorrecte\n"); return 1; }
  1234. else
  1235. return 0;
  1236. }