No Description
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.

as.tab.c 57KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853
  1. /* A Bison parser, made by GNU Bison 3.5.1. */
  2. /* Bison implementation for Yacc-like parsers in C
  3. Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
  4. Inc.
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  15. /* As a special exception, you may create a larger work that contains
  16. part or all of the Bison parser skeleton and distribute that work
  17. under terms of your choice, so long as that work isn't itself a
  18. parser generator using the skeleton or a modified version thereof
  19. as a parser skeleton. Alternatively, if you modify or redistribute
  20. the parser skeleton itself, you may (at your option) remove this
  21. special exception, which will cause the skeleton and the resulting
  22. Bison output files to be licensed under the GNU General Public
  23. License without this special exception.
  24. This special exception was added by the Free Software Foundation in
  25. version 2.2 of Bison. */
  26. /* C LALR(1) parser skeleton written by Richard Stallman, by
  27. simplifying the original so-called "semantic" parser. */
  28. /* All symbols defined below should begin with yy or YY, to avoid
  29. infringing on user name space. This should be done even for local
  30. variables, as they might otherwise be expanded by user macros.
  31. There are some unavoidable exceptions within include files to
  32. define necessary library symbols; they are noted "INFRINGES ON
  33. USER NAME SPACE" below. */
  34. /* Undocumented macros, especially those whose name start with YY_,
  35. are private implementation details. Do not rely on them. */
  36. /* Identify Bison output. */
  37. #define YYBISON 1
  38. /* Bison version. */
  39. #define YYBISON_VERSION "3.5.1"
  40. /* Skeleton name. */
  41. #define YYSKELETON_NAME "yacc.c"
  42. /* Pure parsers. */
  43. #define YYPURE 0
  44. /* Push parsers. */
  45. #define YYPUSH 0
  46. /* Pull parsers. */
  47. #define YYPULL 1
  48. # ifndef YY_CAST
  49. # ifdef __cplusplus
  50. # define YY_CAST(Type, Val) static_cast<Type> (Val)
  51. # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
  52. # else
  53. # define YY_CAST(Type, Val) ((Type) (Val))
  54. # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
  55. # endif
  56. # endif
  57. # ifndef YY_NULLPTR
  58. # if defined __cplusplus
  59. # if 201103L <= __cplusplus
  60. # define YY_NULLPTR nullptr
  61. # else
  62. # define YY_NULLPTR 0
  63. # endif
  64. # else
  65. # define YY_NULLPTR ((void*)0)
  66. # endif
  67. # endif
  68. /* Enabling verbose error messages. */
  69. #ifdef YYERROR_VERBOSE
  70. # undef YYERROR_VERBOSE
  71. # define YYERROR_VERBOSE 1
  72. #else
  73. # define YYERROR_VERBOSE 0
  74. #endif
  75. /* Use api.header.include to #include this header
  76. instead of duplicating it here. */
  77. #ifndef YY_YY_AS_TAB_H_INCLUDED
  78. # define YY_YY_AS_TAB_H_INCLUDED
  79. /* Debug traces. */
  80. #ifndef YYDEBUG
  81. # define YYDEBUG 1
  82. #endif
  83. #if YYDEBUG
  84. extern int yydebug;
  85. #endif
  86. /* Token type. */
  87. #ifndef YYTOKENTYPE
  88. # define YYTOKENTYPE
  89. enum yytokentype
  90. {
  91. tMAIN = 258,
  92. tOBRACKET = 259,
  93. tCBRACKET = 260,
  94. tOBRACE = 261,
  95. tCBRACE = 262,
  96. tINT = 263,
  97. tCONST = 264,
  98. tPV = 265,
  99. tCOMA = 266,
  100. tMUL = 267,
  101. tDIV = 268,
  102. tADD = 269,
  103. tSUB = 270,
  104. tEQ = 271,
  105. tNB = 272,
  106. tNBEXP = 273,
  107. tID = 274,
  108. tPRINTF = 275,
  109. tERROR = 276,
  110. tIF = 277,
  111. tWHILE = 278,
  112. tELSE = 279,
  113. tLT = 280,
  114. tGT = 281,
  115. tEQCOND = 282,
  116. tAND = 283,
  117. tOR = 284,
  118. tNOT = 285
  119. };
  120. #endif
  121. /* Value type. */
  122. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  123. union YYSTYPE
  124. {
  125. #line 1 "as.y"
  126. int nombre;
  127. char id[30];
  128. #line 156 "as.tab.c"
  129. };
  130. typedef union YYSTYPE YYSTYPE;
  131. # define YYSTYPE_IS_TRIVIAL 1
  132. # define YYSTYPE_IS_DECLARED 1
  133. #endif
  134. extern YYSTYPE yylval;
  135. int yyparse (void);
  136. #endif /* !YY_YY_AS_TAB_H_INCLUDED */
  137. /* Second part of user prologue. */
  138. #line 5 "as.y"
  139. #include "../Symboles/table_symboles.h"
  140. #include <stdio.h>
  141. #include <string.h>
  142. #include <stdlib.h>
  143. #include "../Symboles/tab_instruc.h"
  144. #define TAILLE 1024
  145. enum type_t type_courant;
  146. #line 184 "as.tab.c"
  147. #ifdef short
  148. # undef short
  149. #endif
  150. /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
  151. <limits.h> and (if available) <stdint.h> are included
  152. so that the code can choose integer types of a good width. */
  153. #ifndef __PTRDIFF_MAX__
  154. # include <limits.h> /* INFRINGES ON USER NAME SPACE */
  155. # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
  156. # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
  157. # define YY_STDINT_H
  158. # endif
  159. #endif
  160. /* Narrow types that promote to a signed type and that can represent a
  161. signed or unsigned integer of at least N bits. In tables they can
  162. save space and decrease cache pressure. Promoting to a signed type
  163. helps avoid bugs in integer arithmetic. */
  164. #ifdef __INT_LEAST8_MAX__
  165. typedef __INT_LEAST8_TYPE__ yytype_int8;
  166. #elif defined YY_STDINT_H
  167. typedef int_least8_t yytype_int8;
  168. #else
  169. typedef signed char yytype_int8;
  170. #endif
  171. #ifdef __INT_LEAST16_MAX__
  172. typedef __INT_LEAST16_TYPE__ yytype_int16;
  173. #elif defined YY_STDINT_H
  174. typedef int_least16_t yytype_int16;
  175. #else
  176. typedef short yytype_int16;
  177. #endif
  178. #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
  179. typedef __UINT_LEAST8_TYPE__ yytype_uint8;
  180. #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
  181. && UINT_LEAST8_MAX <= INT_MAX)
  182. typedef uint_least8_t yytype_uint8;
  183. #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
  184. typedef unsigned char yytype_uint8;
  185. #else
  186. typedef short yytype_uint8;
  187. #endif
  188. #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
  189. typedef __UINT_LEAST16_TYPE__ yytype_uint16;
  190. #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
  191. && UINT_LEAST16_MAX <= INT_MAX)
  192. typedef uint_least16_t yytype_uint16;
  193. #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
  194. typedef unsigned short yytype_uint16;
  195. #else
  196. typedef int yytype_uint16;
  197. #endif
  198. #ifndef YYPTRDIFF_T
  199. # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
  200. # define YYPTRDIFF_T __PTRDIFF_TYPE__
  201. # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
  202. # elif defined PTRDIFF_MAX
  203. # ifndef ptrdiff_t
  204. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  205. # endif
  206. # define YYPTRDIFF_T ptrdiff_t
  207. # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
  208. # else
  209. # define YYPTRDIFF_T long
  210. # define YYPTRDIFF_MAXIMUM LONG_MAX
  211. # endif
  212. #endif
  213. #ifndef YYSIZE_T
  214. # ifdef __SIZE_TYPE__
  215. # define YYSIZE_T __SIZE_TYPE__
  216. # elif defined size_t
  217. # define YYSIZE_T size_t
  218. # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
  219. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  220. # define YYSIZE_T size_t
  221. # else
  222. # define YYSIZE_T unsigned
  223. # endif
  224. #endif
  225. #define YYSIZE_MAXIMUM \
  226. YY_CAST (YYPTRDIFF_T, \
  227. (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
  228. ? YYPTRDIFF_MAXIMUM \
  229. : YY_CAST (YYSIZE_T, -1)))
  230. #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
  231. /* Stored state numbers (used for stacks). */
  232. typedef yytype_int8 yy_state_t;
  233. /* State numbers in computations. */
  234. typedef int yy_state_fast_t;
  235. #ifndef YY_
  236. # if defined YYENABLE_NLS && YYENABLE_NLS
  237. # if ENABLE_NLS
  238. # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  239. # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
  240. # endif
  241. # endif
  242. # ifndef YY_
  243. # define YY_(Msgid) Msgid
  244. # endif
  245. #endif
  246. #ifndef YY_ATTRIBUTE_PURE
  247. # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
  248. # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
  249. # else
  250. # define YY_ATTRIBUTE_PURE
  251. # endif
  252. #endif
  253. #ifndef YY_ATTRIBUTE_UNUSED
  254. # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
  255. # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
  256. # else
  257. # define YY_ATTRIBUTE_UNUSED
  258. # endif
  259. #endif
  260. /* Suppress unused-variable warnings by "using" E. */
  261. #if ! defined lint || defined __GNUC__
  262. # define YYUSE(E) ((void) (E))
  263. #else
  264. # define YYUSE(E) /* empty */
  265. #endif
  266. #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  267. /* Suppress an incorrect diagnostic about yylval being uninitialized. */
  268. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
  269. _Pragma ("GCC diagnostic push") \
  270. _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
  271. _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  272. # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
  273. _Pragma ("GCC diagnostic pop")
  274. #else
  275. # define YY_INITIAL_VALUE(Value) Value
  276. #endif
  277. #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  278. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  279. # define YY_IGNORE_MAYBE_UNINITIALIZED_END
  280. #endif
  281. #ifndef YY_INITIAL_VALUE
  282. # define YY_INITIAL_VALUE(Value) /* Nothing. */
  283. #endif
  284. #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
  285. # define YY_IGNORE_USELESS_CAST_BEGIN \
  286. _Pragma ("GCC diagnostic push") \
  287. _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
  288. # define YY_IGNORE_USELESS_CAST_END \
  289. _Pragma ("GCC diagnostic pop")
  290. #endif
  291. #ifndef YY_IGNORE_USELESS_CAST_BEGIN
  292. # define YY_IGNORE_USELESS_CAST_BEGIN
  293. # define YY_IGNORE_USELESS_CAST_END
  294. #endif
  295. #define YY_ASSERT(E) ((void) (0 && (E)))
  296. #if ! defined yyoverflow || YYERROR_VERBOSE
  297. /* The parser invokes alloca or malloc; define the necessary symbols. */
  298. # ifdef YYSTACK_USE_ALLOCA
  299. # if YYSTACK_USE_ALLOCA
  300. # ifdef __GNUC__
  301. # define YYSTACK_ALLOC __builtin_alloca
  302. # elif defined __BUILTIN_VA_ARG_INCR
  303. # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  304. # elif defined _AIX
  305. # define YYSTACK_ALLOC __alloca
  306. # elif defined _MSC_VER
  307. # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  308. # define alloca _alloca
  309. # else
  310. # define YYSTACK_ALLOC alloca
  311. # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
  312. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  313. /* Use EXIT_SUCCESS as a witness for stdlib.h. */
  314. # ifndef EXIT_SUCCESS
  315. # define EXIT_SUCCESS 0
  316. # endif
  317. # endif
  318. # endif
  319. # endif
  320. # endif
  321. # ifdef YYSTACK_ALLOC
  322. /* Pacify GCC's 'empty if-body' warning. */
  323. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  324. # ifndef YYSTACK_ALLOC_MAXIMUM
  325. /* The OS might guarantee only one guard page at the bottom of the stack,
  326. and a page size can be as small as 4096 bytes. So we cannot safely
  327. invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
  328. to allow for a few compiler-allocated temporary stack slots. */
  329. # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  330. # endif
  331. # else
  332. # define YYSTACK_ALLOC YYMALLOC
  333. # define YYSTACK_FREE YYFREE
  334. # ifndef YYSTACK_ALLOC_MAXIMUM
  335. # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  336. # endif
  337. # if (defined __cplusplus && ! defined EXIT_SUCCESS \
  338. && ! ((defined YYMALLOC || defined malloc) \
  339. && (defined YYFREE || defined free)))
  340. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  341. # ifndef EXIT_SUCCESS
  342. # define EXIT_SUCCESS 0
  343. # endif
  344. # endif
  345. # ifndef YYMALLOC
  346. # define YYMALLOC malloc
  347. # if ! defined malloc && ! defined EXIT_SUCCESS
  348. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  349. # endif
  350. # endif
  351. # ifndef YYFREE
  352. # define YYFREE free
  353. # if ! defined free && ! defined EXIT_SUCCESS
  354. void free (void *); /* INFRINGES ON USER NAME SPACE */
  355. # endif
  356. # endif
  357. # endif
  358. #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  359. #if (! defined yyoverflow \
  360. && (! defined __cplusplus \
  361. || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  362. /* A type that is properly aligned for any stack member. */
  363. union yyalloc
  364. {
  365. yy_state_t yyss_alloc;
  366. YYSTYPE yyvs_alloc;
  367. };
  368. /* The size of the maximum gap between one aligned stack and the next. */
  369. # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
  370. /* The size of an array large to enough to hold all stacks, each with
  371. N elements. */
  372. # define YYSTACK_BYTES(N) \
  373. ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
  374. + YYSTACK_GAP_MAXIMUM)
  375. # define YYCOPY_NEEDED 1
  376. /* Relocate STACK from its old location to the new one. The
  377. local variables YYSIZE and YYSTACKSIZE give the old and new number of
  378. elements in the stack, and YYPTR gives the new location of the
  379. stack. Advance YYPTR to a properly aligned location for the next
  380. stack. */
  381. # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
  382. do \
  383. { \
  384. YYPTRDIFF_T yynewbytes; \
  385. YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
  386. Stack = &yyptr->Stack_alloc; \
  387. yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
  388. yyptr += yynewbytes / YYSIZEOF (*yyptr); \
  389. } \
  390. while (0)
  391. #endif
  392. #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
  393. /* Copy COUNT objects from SRC to DST. The source and destination do
  394. not overlap. */
  395. # ifndef YYCOPY
  396. # if defined __GNUC__ && 1 < __GNUC__
  397. # define YYCOPY(Dst, Src, Count) \
  398. __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
  399. # else
  400. # define YYCOPY(Dst, Src, Count) \
  401. do \
  402. { \
  403. YYPTRDIFF_T yyi; \
  404. for (yyi = 0; yyi < (Count); yyi++) \
  405. (Dst)[yyi] = (Src)[yyi]; \
  406. } \
  407. while (0)
  408. # endif
  409. # endif
  410. #endif /* !YYCOPY_NEEDED */
  411. /* YYFINAL -- State number of the termination state. */
  412. #define YYFINAL 4
  413. /* YYLAST -- Last index in YYTABLE. */
  414. #define YYLAST 119
  415. /* YYNTOKENS -- Number of terminals. */
  416. #define YYNTOKENS 31
  417. /* YYNNTS -- Number of nonterminals. */
  418. #define YYNNTS 22
  419. /* YYNRULES -- Number of rules. */
  420. #define YYNRULES 50
  421. /* YYNSTATES -- Number of states. */
  422. #define YYNSTATES 104
  423. #define YYUNDEFTOK 2
  424. #define YYMAXUTOK 285
  425. /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
  426. as returned by yylex, with out-of-bounds checking. */
  427. #define YYTRANSLATE(YYX) \
  428. (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  429. /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
  430. as returned by yylex. */
  431. static const yytype_int8 yytranslate[] =
  432. {
  433. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  434. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  435. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  436. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  437. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  438. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  439. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  440. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  441. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  442. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  443. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  444. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  445. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  446. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  447. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  448. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  449. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  450. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  451. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  452. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  453. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  454. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  455. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  456. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  457. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  458. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  459. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
  460. 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
  461. 25, 26, 27, 28, 29, 30
  462. };
  463. #if YYDEBUG
  464. /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
  465. static const yytype_uint8 yyrline[] =
  466. {
  467. 0, 49, 49, 51, 52, 53, 54, 55, 57, 60,
  468. 61, 62, 63, 64, 65, 66, 69, 70, 71, 72,
  469. 73, 75, 76, 77, 78, 81, 83, 85, 86, 87,
  470. 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
  471. 102, 104, 105, 107, 108, 109, 110, 112, 113, 114,
  472. 133
  473. };
  474. #endif
  475. #if YYDEBUG || YYERROR_VERBOSE || 0
  476. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  477. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  478. static const char *const yytname[] =
  479. {
  480. "$end", "error", "$undefined", "tMAIN", "tOBRACKET", "tCBRACKET",
  481. "tOBRACE", "tCBRACE", "tINT", "tCONST", "tPV", "tCOMA", "tMUL", "tDIV",
  482. "tADD", "tSUB", "tEQ", "tNB", "tNBEXP", "tID", "tPRINTF", "tERROR",
  483. "tIF", "tWHILE", "tELSE", "tLT", "tGT", "tEQCOND", "tAND", "tOR", "tNOT",
  484. "$accept", "Main", "Params", "Param", "SuiteParams", "Body",
  485. "Instructions", "Instruction", "If", "Else", "While", "Cond",
  486. "SuiteCond", "Aff", "E", "DeclType", "Decl", "SuiteDecl", "FinDecl",
  487. "SuiteDeclConst", "FinDeclConst", "Invocation", YY_NULLPTR
  488. };
  489. #endif
  490. # ifdef YYPRINT
  491. /* YYTOKNUM[NUM] -- (External) token number corresponding to the
  492. (internal) symbol number NUM (which must be that of a token). */
  493. static const yytype_int16 yytoknum[] =
  494. {
  495. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  496. 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
  497. 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
  498. 285
  499. };
  500. # endif
  501. #define YYPACT_NINF (-75)
  502. #define yypact_value_is_default(Yyn) \
  503. ((Yyn) == YYPACT_NINF)
  504. #define YYTABLE_NINF (-1)
  505. #define yytable_value_is_error(Yyn) \
  506. 0
  507. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  508. STATE-NUM. */
  509. static const yytype_int8 yypact[] =
  510. {
  511. -6, 23, 14, 27, -75, 38, -75, 22, 32, 40,
  512. 66, 38, -75, -75, 72, -75, 32, 38, 47, 73,
  513. 81, 87, 95, 72, -75, -75, -75, 82, -75, 92,
  514. -75, 84, 0, 85, 0, 0, -75, -75, 89, 21,
  515. -75, 90, 86, 0, 0, -75, -75, -75, 0, 59,
  516. -75, 100, 101, 39, 102, 0, -75, 82, -75, 0,
  517. -75, 84, -75, 35, 70, 63, -75, 0, 0, 0,
  518. 0, 0, 0, 0, -75, 66, 0, 0, -75, 66,
  519. 63, 21, 63, 86, -75, -75, -75, 70, 70, -5,
  520. -5, 43, 88, 39, 39, -75, -75, -75, -1, -75,
  521. -75, -75, -75, -75
  522. };
  523. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  524. Performed when YYTABLE does not specify something else to do. Zero
  525. means the default is an error. */
  526. static const yytype_int8 yydefact[] =
  527. {
  528. 0, 0, 0, 0, 1, 3, 40, 0, 7, 0,
  529. 0, 0, 4, 5, 10, 2, 7, 0, 0, 0,
  530. 0, 0, 0, 10, 14, 15, 11, 0, 12, 0,
  531. 6, 0, 0, 0, 0, 0, 8, 9, 43, 0,
  532. 13, 0, 0, 0, 0, 26, 27, 28, 0, 0,
  533. 33, 0, 0, 22, 0, 0, 45, 0, 41, 0,
  534. 48, 0, 42, 0, 35, 39, 25, 0, 0, 0,
  535. 0, 0, 0, 0, 50, 0, 0, 0, 21, 0,
  536. 44, 0, 47, 0, 34, 29, 30, 32, 31, 38,
  537. 37, 36, 19, 22, 22, 20, 46, 49, 0, 16,
  538. 23, 24, 18, 17
  539. };
  540. /* YYPGOTO[NTERM-NUM]. */
  541. static const yytype_int8 yypgoto[] =
  542. {
  543. -75, -75, -75, 99, 97, -74, 91, -75, 13, -75,
  544. -75, 80, 5, -75, -32, 11, -75, 60, 37, 55,
  545. 36, -10
  546. };
  547. /* YYDEFGOTO[NTERM-NUM]. */
  548. static const yytype_int8 yydefgoto[] =
  549. {
  550. -1, 2, 7, 8, 12, 15, 22, 23, 24, 99,
  551. 25, 52, 78, 26, 53, 9, 28, 39, 58, 42,
  552. 62, 50
  553. };
  554. /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
  555. positive, shift that token. If negative, reduce the rule whose
  556. number is the opposite. If YYTABLE_NINF, syntax error. */
  557. static const yytype_int8 yytable[] =
  558. {
  559. 49, 92, 1, 14, 29, 95, 43, 67, 68, 69,
  560. 70, 63, 64, 29, 4, 44, 65, 45, 46, 47,
  561. 19, 20, 73, 80, 102, 27, 3, 82, 31, 10,
  562. 48, 56, 57, 5, 27, 85, 86, 87, 88, 89,
  563. 90, 91, 84, 11, 93, 94, 6, 67, 68, 69,
  564. 70, 67, 68, 69, 70, 67, 68, 69, 70, 13,
  565. 71, 72, 73, 32, 71, 72, 73, 76, 77, 66,
  566. 14, 67, 68, 69, 70, 67, 68, 69, 70, 33,
  567. 6, 17, 67, 68, 71, 72, 73, 34, 71, 72,
  568. 73, 18, 19, 35, 20, 21, 60, 61, 100, 101,
  569. 36, 38, 40, 41, 51, 55, 59, 74, 75, 79,
  570. 16, 103, 98, 30, 37, 54, 83, 81, 96, 97
  571. };
  572. static const yytype_int8 yycheck[] =
  573. {
  574. 32, 75, 8, 4, 14, 79, 6, 12, 13, 14,
  575. 15, 43, 44, 23, 0, 15, 48, 17, 18, 19,
  576. 20, 22, 27, 55, 98, 14, 3, 59, 17, 7,
  577. 30, 10, 11, 6, 23, 67, 68, 69, 70, 71,
  578. 72, 73, 7, 11, 76, 77, 8, 12, 13, 14,
  579. 15, 12, 13, 14, 15, 12, 13, 14, 15, 19,
  580. 25, 26, 27, 16, 25, 26, 27, 28, 29, 10,
  581. 4, 12, 13, 14, 15, 12, 13, 14, 15, 6,
  582. 8, 9, 12, 13, 25, 26, 27, 6, 25, 26,
  583. 27, 19, 20, 6, 22, 23, 10, 11, 93, 94,
  584. 5, 19, 10, 19, 19, 16, 16, 7, 7, 7,
  585. 11, 98, 24, 16, 23, 35, 61, 57, 81, 83
  586. };
  587. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  588. symbol of state STATE-NUM. */
  589. static const yytype_int8 yystos[] =
  590. {
  591. 0, 8, 32, 3, 0, 6, 8, 33, 34, 46,
  592. 7, 11, 35, 19, 4, 36, 34, 9, 19, 20,
  593. 22, 23, 37, 38, 39, 41, 44, 46, 47, 52,
  594. 35, 46, 16, 6, 6, 6, 5, 37, 19, 48,
  595. 10, 19, 50, 6, 15, 17, 18, 19, 30, 45,
  596. 52, 19, 42, 45, 42, 16, 10, 11, 49, 16,
  597. 10, 11, 51, 45, 45, 45, 10, 12, 13, 14,
  598. 15, 25, 26, 27, 7, 7, 28, 29, 43, 7,
  599. 45, 48, 45, 50, 7, 45, 45, 45, 45, 45,
  600. 45, 45, 36, 45, 45, 36, 49, 51, 24, 40,
  601. 43, 43, 36, 39
  602. };
  603. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  604. static const yytype_int8 yyr1[] =
  605. {
  606. 0, 31, 32, 33, 33, 34, 35, 35, 36, 37,
  607. 37, 38, 38, 38, 38, 38, 39, 40, 40, 40,
  608. 41, 42, 43, 43, 43, 44, 45, 45, 45, 45,
  609. 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
  610. 46, 47, 47, 48, 48, 49, 49, 50, 51, 51,
  611. 52
  612. };
  613. /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
  614. static const yytype_int8 yyr2[] =
  615. {
  616. 0, 2, 6, 0, 2, 2, 3, 0, 3, 2,
  617. 0, 1, 1, 2, 1, 1, 6, 2, 2, 0,
  618. 5, 2, 0, 3, 3, 4, 1, 1, 1, 3,
  619. 3, 3, 3, 1, 3, 2, 3, 3, 3, 2,
  620. 1, 3, 4, 1, 3, 1, 3, 3, 1, 3,
  621. 4
  622. };
  623. #define yyerrok (yyerrstatus = 0)
  624. #define yyclearin (yychar = YYEMPTY)
  625. #define YYEMPTY (-2)
  626. #define YYEOF 0
  627. #define YYACCEPT goto yyacceptlab
  628. #define YYABORT goto yyabortlab
  629. #define YYERROR goto yyerrorlab
  630. #define YYRECOVERING() (!!yyerrstatus)
  631. #define YYBACKUP(Token, Value) \
  632. do \
  633. if (yychar == YYEMPTY) \
  634. { \
  635. yychar = (Token); \
  636. yylval = (Value); \
  637. YYPOPSTACK (yylen); \
  638. yystate = *yyssp; \
  639. goto yybackup; \
  640. } \
  641. else \
  642. { \
  643. yyerror (YY_("syntax error: cannot back up")); \
  644. YYERROR; \
  645. } \
  646. while (0)
  647. /* Error token number */
  648. #define YYTERROR 1
  649. #define YYERRCODE 256
  650. /* Enable debugging if requested. */
  651. #if YYDEBUG
  652. # ifndef YYFPRINTF
  653. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  654. # define YYFPRINTF fprintf
  655. # endif
  656. # define YYDPRINTF(Args) \
  657. do { \
  658. if (yydebug) \
  659. YYFPRINTF Args; \
  660. } while (0)
  661. /* This macro is provided for backward compatibility. */
  662. #ifndef YY_LOCATION_PRINT
  663. # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  664. #endif
  665. # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
  666. do { \
  667. if (yydebug) \
  668. { \
  669. YYFPRINTF (stderr, "%s ", Title); \
  670. yy_symbol_print (stderr, \
  671. Type, Value); \
  672. YYFPRINTF (stderr, "\n"); \
  673. } \
  674. } while (0)
  675. /*-----------------------------------.
  676. | Print this symbol's value on YYO. |
  677. `-----------------------------------*/
  678. static void
  679. yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
  680. {
  681. FILE *yyoutput = yyo;
  682. YYUSE (yyoutput);
  683. if (!yyvaluep)
  684. return;
  685. # ifdef YYPRINT
  686. if (yytype < YYNTOKENS)
  687. YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
  688. # endif
  689. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  690. YYUSE (yytype);
  691. YY_IGNORE_MAYBE_UNINITIALIZED_END
  692. }
  693. /*---------------------------.
  694. | Print this symbol on YYO. |
  695. `---------------------------*/
  696. static void
  697. yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
  698. {
  699. YYFPRINTF (yyo, "%s %s (",
  700. yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
  701. yy_symbol_value_print (yyo, yytype, yyvaluep);
  702. YYFPRINTF (yyo, ")");
  703. }
  704. /*------------------------------------------------------------------.
  705. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  706. | TOP (included). |
  707. `------------------------------------------------------------------*/
  708. static void
  709. yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
  710. {
  711. YYFPRINTF (stderr, "Stack now");
  712. for (; yybottom <= yytop; yybottom++)
  713. {
  714. int yybot = *yybottom;
  715. YYFPRINTF (stderr, " %d", yybot);
  716. }
  717. YYFPRINTF (stderr, "\n");
  718. }
  719. # define YY_STACK_PRINT(Bottom, Top) \
  720. do { \
  721. if (yydebug) \
  722. yy_stack_print ((Bottom), (Top)); \
  723. } while (0)
  724. /*------------------------------------------------.
  725. | Report that the YYRULE is going to be reduced. |
  726. `------------------------------------------------*/
  727. static void
  728. yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule)
  729. {
  730. int yylno = yyrline[yyrule];
  731. int yynrhs = yyr2[yyrule];
  732. int yyi;
  733. YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
  734. yyrule - 1, yylno);
  735. /* The symbols being reduced. */
  736. for (yyi = 0; yyi < yynrhs; yyi++)
  737. {
  738. YYFPRINTF (stderr, " $%d = ", yyi + 1);
  739. yy_symbol_print (stderr,
  740. yystos[+yyssp[yyi + 1 - yynrhs]],
  741. &yyvsp[(yyi + 1) - (yynrhs)]
  742. );
  743. YYFPRINTF (stderr, "\n");
  744. }
  745. }
  746. # define YY_REDUCE_PRINT(Rule) \
  747. do { \
  748. if (yydebug) \
  749. yy_reduce_print (yyssp, yyvsp, Rule); \
  750. } while (0)
  751. /* Nonzero means print parse trace. It is left uninitialized so that
  752. multiple parsers can coexist. */
  753. int yydebug;
  754. #else /* !YYDEBUG */
  755. # define YYDPRINTF(Args)
  756. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  757. # define YY_STACK_PRINT(Bottom, Top)
  758. # define YY_REDUCE_PRINT(Rule)
  759. #endif /* !YYDEBUG */
  760. /* YYINITDEPTH -- initial size of the parser's stacks. */
  761. #ifndef YYINITDEPTH
  762. # define YYINITDEPTH 200
  763. #endif
  764. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  765. if the built-in stack extension method is used).
  766. Do not make this value too large; the results are undefined if
  767. YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  768. evaluated with infinite-precision integer arithmetic. */
  769. #ifndef YYMAXDEPTH
  770. # define YYMAXDEPTH 10000
  771. #endif
  772. #if YYERROR_VERBOSE
  773. # ifndef yystrlen
  774. # if defined __GLIBC__ && defined _STRING_H
  775. # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
  776. # else
  777. /* Return the length of YYSTR. */
  778. static YYPTRDIFF_T
  779. yystrlen (const char *yystr)
  780. {
  781. YYPTRDIFF_T yylen;
  782. for (yylen = 0; yystr[yylen]; yylen++)
  783. continue;
  784. return yylen;
  785. }
  786. # endif
  787. # endif
  788. # ifndef yystpcpy
  789. # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  790. # define yystpcpy stpcpy
  791. # else
  792. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  793. YYDEST. */
  794. static char *
  795. yystpcpy (char *yydest, const char *yysrc)
  796. {
  797. char *yyd = yydest;
  798. const char *yys = yysrc;
  799. while ((*yyd++ = *yys++) != '\0')
  800. continue;
  801. return yyd - 1;
  802. }
  803. # endif
  804. # endif
  805. # ifndef yytnamerr
  806. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  807. quotes and backslashes, so that it's suitable for yyerror. The
  808. heuristic is that double-quoting is unnecessary unless the string
  809. contains an apostrophe, a comma, or backslash (other than
  810. backslash-backslash). YYSTR is taken from yytname. If YYRES is
  811. null, do not copy; instead, return the length of what the result
  812. would have been. */
  813. static YYPTRDIFF_T
  814. yytnamerr (char *yyres, const char *yystr)
  815. {
  816. if (*yystr == '"')
  817. {
  818. YYPTRDIFF_T yyn = 0;
  819. char const *yyp = yystr;
  820. for (;;)
  821. switch (*++yyp)
  822. {
  823. case '\'':
  824. case ',':
  825. goto do_not_strip_quotes;
  826. case '\\':
  827. if (*++yyp != '\\')
  828. goto do_not_strip_quotes;
  829. else
  830. goto append;
  831. append:
  832. default:
  833. if (yyres)
  834. yyres[yyn] = *yyp;
  835. yyn++;
  836. break;
  837. case '"':
  838. if (yyres)
  839. yyres[yyn] = '\0';
  840. return yyn;
  841. }
  842. do_not_strip_quotes: ;
  843. }
  844. if (yyres)
  845. return yystpcpy (yyres, yystr) - yyres;
  846. else
  847. return yystrlen (yystr);
  848. }
  849. # endif
  850. /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
  851. about the unexpected token YYTOKEN for the state stack whose top is
  852. YYSSP.
  853. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
  854. not large enough to hold the message. In that case, also set
  855. *YYMSG_ALLOC to the required number of bytes. Return 2 if the
  856. required number of bytes is too large to store. */
  857. static int
  858. yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
  859. yy_state_t *yyssp, int yytoken)
  860. {
  861. enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  862. /* Internationalized format string. */
  863. const char *yyformat = YY_NULLPTR;
  864. /* Arguments of yyformat: reported tokens (one for the "unexpected",
  865. one per "expected"). */
  866. char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  867. /* Actual size of YYARG. */
  868. int yycount = 0;
  869. /* Cumulated lengths of YYARG. */
  870. YYPTRDIFF_T yysize = 0;
  871. /* There are many possibilities here to consider:
  872. - If this state is a consistent state with a default action, then
  873. the only way this function was invoked is if the default action
  874. is an error action. In that case, don't check for expected
  875. tokens because there are none.
  876. - The only way there can be no lookahead present (in yychar) is if
  877. this state is a consistent state with a default action. Thus,
  878. detecting the absence of a lookahead is sufficient to determine
  879. that there is no unexpected or expected token to report. In that
  880. case, just report a simple "syntax error".
  881. - Don't assume there isn't a lookahead just because this state is a
  882. consistent state with a default action. There might have been a
  883. previous inconsistent state, consistent state with a non-default
  884. action, or user semantic action that manipulated yychar.
  885. - Of course, the expected token list depends on states to have
  886. correct lookahead information, and it depends on the parser not
  887. to perform extra reductions after fetching a lookahead from the
  888. scanner and before detecting a syntax error. Thus, state merging
  889. (from LALR or IELR) and default reductions corrupt the expected
  890. token list. However, the list is correct for canonical LR with
  891. one exception: it will still contain any token that will not be
  892. accepted due to an error action in a later state.
  893. */
  894. if (yytoken != YYEMPTY)
  895. {
  896. int yyn = yypact[+*yyssp];
  897. YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
  898. yysize = yysize0;
  899. yyarg[yycount++] = yytname[yytoken];
  900. if (!yypact_value_is_default (yyn))
  901. {
  902. /* Start YYX at -YYN if negative to avoid negative indexes in
  903. YYCHECK. In other words, skip the first -YYN actions for
  904. this state because they are default actions. */
  905. int yyxbegin = yyn < 0 ? -yyn : 0;
  906. /* Stay within bounds of both yycheck and yytname. */
  907. int yychecklim = YYLAST - yyn + 1;
  908. int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  909. int yyx;
  910. for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  911. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
  912. && !yytable_value_is_error (yytable[yyx + yyn]))
  913. {
  914. if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
  915. {
  916. yycount = 1;
  917. yysize = yysize0;
  918. break;
  919. }
  920. yyarg[yycount++] = yytname[yyx];
  921. {
  922. YYPTRDIFF_T yysize1
  923. = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
  924. if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
  925. yysize = yysize1;
  926. else
  927. return 2;
  928. }
  929. }
  930. }
  931. }
  932. switch (yycount)
  933. {
  934. # define YYCASE_(N, S) \
  935. case N: \
  936. yyformat = S; \
  937. break
  938. default: /* Avoid compiler warnings. */
  939. YYCASE_(0, YY_("syntax error"));
  940. YYCASE_(1, YY_("syntax error, unexpected %s"));
  941. YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
  942. YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
  943. YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
  944. YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
  945. # undef YYCASE_
  946. }
  947. {
  948. /* Don't count the "%s"s in the final size, but reserve room for
  949. the terminator. */
  950. YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
  951. if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
  952. yysize = yysize1;
  953. else
  954. return 2;
  955. }
  956. if (*yymsg_alloc < yysize)
  957. {
  958. *yymsg_alloc = 2 * yysize;
  959. if (! (yysize <= *yymsg_alloc
  960. && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
  961. *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
  962. return 1;
  963. }
  964. /* Avoid sprintf, as that infringes on the user's name space.
  965. Don't have undefined behavior even if the translation
  966. produced a string with the wrong number of "%s"s. */
  967. {
  968. char *yyp = *yymsg;
  969. int yyi = 0;
  970. while ((*yyp = *yyformat) != '\0')
  971. if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
  972. {
  973. yyp += yytnamerr (yyp, yyarg[yyi++]);
  974. yyformat += 2;
  975. }
  976. else
  977. {
  978. ++yyp;
  979. ++yyformat;
  980. }
  981. }
  982. return 0;
  983. }
  984. #endif /* YYERROR_VERBOSE */
  985. /*-----------------------------------------------.
  986. | Release the memory associated to this symbol. |
  987. `-----------------------------------------------*/
  988. static void
  989. yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
  990. {
  991. YYUSE (yyvaluep);
  992. if (!yymsg)
  993. yymsg = "Deleting";
  994. YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  995. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  996. YYUSE (yytype);
  997. YY_IGNORE_MAYBE_UNINITIALIZED_END
  998. }
  999. /* The lookahead symbol. */
  1000. int yychar;
  1001. /* The semantic value of the lookahead symbol. */
  1002. YYSTYPE yylval;
  1003. /* Number of syntax errors so far. */
  1004. int yynerrs;
  1005. /*----------.
  1006. | yyparse. |
  1007. `----------*/
  1008. int
  1009. yyparse (void)
  1010. {
  1011. yy_state_fast_t yystate;
  1012. /* Number of tokens to shift before error messages enabled. */
  1013. int yyerrstatus;
  1014. /* The stacks and their tools:
  1015. 'yyss': related to states.
  1016. 'yyvs': related to semantic values.
  1017. Refer to the stacks through separate pointers, to allow yyoverflow
  1018. to reallocate them elsewhere. */
  1019. /* The state stack. */
  1020. yy_state_t yyssa[YYINITDEPTH];
  1021. yy_state_t *yyss;
  1022. yy_state_t *yyssp;
  1023. /* The semantic value stack. */
  1024. YYSTYPE yyvsa[YYINITDEPTH];
  1025. YYSTYPE *yyvs;
  1026. YYSTYPE *yyvsp;
  1027. YYPTRDIFF_T yystacksize;
  1028. int yyn;
  1029. int yyresult;
  1030. /* Lookahead token as an internal (translated) token number. */
  1031. int yytoken = 0;
  1032. /* The variables used to return semantic value and location from the
  1033. action routines. */
  1034. YYSTYPE yyval;
  1035. #if YYERROR_VERBOSE
  1036. /* Buffer for error messages, and its allocated size. */
  1037. char yymsgbuf[128];
  1038. char *yymsg = yymsgbuf;
  1039. YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
  1040. #endif
  1041. #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
  1042. /* The number of symbols on the RHS of the reduced rule.
  1043. Keep to zero when no symbol should be popped. */
  1044. int yylen = 0;
  1045. yyssp = yyss = yyssa;
  1046. yyvsp = yyvs = yyvsa;
  1047. yystacksize = YYINITDEPTH;
  1048. YYDPRINTF ((stderr, "Starting parse\n"));
  1049. yystate = 0;
  1050. yyerrstatus = 0;
  1051. yynerrs = 0;
  1052. yychar = YYEMPTY; /* Cause a token to be read. */
  1053. goto yysetstate;
  1054. /*------------------------------------------------------------.
  1055. | yynewstate -- push a new state, which is found in yystate. |
  1056. `------------------------------------------------------------*/
  1057. yynewstate:
  1058. /* In all cases, when you get here, the value and location stacks
  1059. have just been pushed. So pushing a state here evens the stacks. */
  1060. yyssp++;
  1061. /*--------------------------------------------------------------------.
  1062. | yysetstate -- set current state (the top of the stack) to yystate. |
  1063. `--------------------------------------------------------------------*/
  1064. yysetstate:
  1065. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  1066. YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
  1067. YY_IGNORE_USELESS_CAST_BEGIN
  1068. *yyssp = YY_CAST (yy_state_t, yystate);
  1069. YY_IGNORE_USELESS_CAST_END
  1070. if (yyss + yystacksize - 1 <= yyssp)
  1071. #if !defined yyoverflow && !defined YYSTACK_RELOCATE
  1072. goto yyexhaustedlab;
  1073. #else
  1074. {
  1075. /* Get the current used size of the three stacks, in elements. */
  1076. YYPTRDIFF_T yysize = yyssp - yyss + 1;
  1077. # if defined yyoverflow
  1078. {
  1079. /* Give user a chance to reallocate the stack. Use copies of
  1080. these so that the &'s don't force the real ones into
  1081. memory. */
  1082. yy_state_t *yyss1 = yyss;
  1083. YYSTYPE *yyvs1 = yyvs;
  1084. /* Each stack pointer address is followed by the size of the
  1085. data in use in that stack, in bytes. This used to be a
  1086. conditional around just the two extra args, but that might
  1087. be undefined if yyoverflow is a macro. */
  1088. yyoverflow (YY_("memory exhausted"),
  1089. &yyss1, yysize * YYSIZEOF (*yyssp),
  1090. &yyvs1, yysize * YYSIZEOF (*yyvsp),
  1091. &yystacksize);
  1092. yyss = yyss1;
  1093. yyvs = yyvs1;
  1094. }
  1095. # else /* defined YYSTACK_RELOCATE */
  1096. /* Extend the stack our own way. */
  1097. if (YYMAXDEPTH <= yystacksize)
  1098. goto yyexhaustedlab;
  1099. yystacksize *= 2;
  1100. if (YYMAXDEPTH < yystacksize)
  1101. yystacksize = YYMAXDEPTH;
  1102. {
  1103. yy_state_t *yyss1 = yyss;
  1104. union yyalloc *yyptr =
  1105. YY_CAST (union yyalloc *,
  1106. YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
  1107. if (! yyptr)
  1108. goto yyexhaustedlab;
  1109. YYSTACK_RELOCATE (yyss_alloc, yyss);
  1110. YYSTACK_RELOCATE (yyvs_alloc, yyvs);
  1111. # undef YYSTACK_RELOCATE
  1112. if (yyss1 != yyssa)
  1113. YYSTACK_FREE (yyss1);
  1114. }
  1115. # endif
  1116. yyssp = yyss + yysize - 1;
  1117. yyvsp = yyvs + yysize - 1;
  1118. YY_IGNORE_USELESS_CAST_BEGIN
  1119. YYDPRINTF ((stderr, "Stack size increased to %ld\n",
  1120. YY_CAST (long, yystacksize)));
  1121. YY_IGNORE_USELESS_CAST_END
  1122. if (yyss + yystacksize - 1 <= yyssp)
  1123. YYABORT;
  1124. }
  1125. #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
  1126. if (yystate == YYFINAL)
  1127. YYACCEPT;
  1128. goto yybackup;
  1129. /*-----------.
  1130. | yybackup. |
  1131. `-----------*/
  1132. yybackup:
  1133. /* Do appropriate processing given the current state. Read a
  1134. lookahead token if we need one and don't already have one. */
  1135. /* First try to decide what to do without reference to lookahead token. */
  1136. yyn = yypact[yystate];
  1137. if (yypact_value_is_default (yyn))
  1138. goto yydefault;
  1139. /* Not known => get a lookahead token if don't already have one. */
  1140. /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
  1141. if (yychar == YYEMPTY)
  1142. {
  1143. YYDPRINTF ((stderr, "Reading a token: "));
  1144. yychar = yylex ();
  1145. }
  1146. if (yychar <= YYEOF)
  1147. {
  1148. yychar = yytoken = YYEOF;
  1149. YYDPRINTF ((stderr, "Now at end of input.\n"));
  1150. }
  1151. else
  1152. {
  1153. yytoken = YYTRANSLATE (yychar);
  1154. YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  1155. }
  1156. /* If the proper action on seeing token YYTOKEN is to reduce or to
  1157. detect an error, take that action. */
  1158. yyn += yytoken;
  1159. if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  1160. goto yydefault;
  1161. yyn = yytable[yyn];
  1162. if (yyn <= 0)
  1163. {
  1164. if (yytable_value_is_error (yyn))
  1165. goto yyerrlab;
  1166. yyn = -yyn;
  1167. goto yyreduce;
  1168. }
  1169. /* Count tokens shifted since error; after three, turn off error
  1170. status. */
  1171. if (yyerrstatus)
  1172. yyerrstatus--;
  1173. /* Shift the lookahead token. */
  1174. YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  1175. yystate = yyn;
  1176. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1177. *++yyvsp = yylval;
  1178. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1179. /* Discard the shifted token. */
  1180. yychar = YYEMPTY;
  1181. goto yynewstate;
  1182. /*-----------------------------------------------------------.
  1183. | yydefault -- do the default action for the current state. |
  1184. `-----------------------------------------------------------*/
  1185. yydefault:
  1186. yyn = yydefact[yystate];
  1187. if (yyn == 0)
  1188. goto yyerrlab;
  1189. goto yyreduce;
  1190. /*-----------------------------.
  1191. | yyreduce -- do a reduction. |
  1192. `-----------------------------*/
  1193. yyreduce:
  1194. /* yyn is the number of a rule to reduce with. */
  1195. yylen = yyr2[yyn];
  1196. /* If YYLEN is nonzero, implement the default value of the action:
  1197. '$$ = $1'.
  1198. Otherwise, the following line sets YYVAL to garbage.
  1199. This behavior is undocumented and Bison
  1200. users should not rely upon it. Assigning to YYVAL
  1201. unconditionally makes the parser a bit smaller, and it avoids a
  1202. GCC warning that YYVAL may be used uninitialized. */
  1203. yyval = yyvsp[1-yylen];
  1204. YY_REDUCE_PRINT (yyn);
  1205. switch (yyn)
  1206. {
  1207. case 2:
  1208. #line 49 "as.y"
  1209. { print(); create_asm();}
  1210. #line 1415 "as.tab.c"
  1211. break;
  1212. case 3:
  1213. #line 51 "as.y"
  1214. { printf("Sans Params\n"); }
  1215. #line 1421 "as.tab.c"
  1216. break;
  1217. case 5:
  1218. #line 53 "as.y"
  1219. { printf("Prametre : %s\n", (yyvsp[0].id)); }
  1220. #line 1427 "as.tab.c"
  1221. break;
  1222. case 8:
  1223. #line 57 "as.y"
  1224. { }
  1225. #line 1433 "as.tab.c"
  1226. break;
  1227. case 11:
  1228. #line 62 "as.y"
  1229. {reset_temp_vars();}
  1230. #line 1439 "as.tab.c"
  1231. break;
  1232. case 12:
  1233. #line 63 "as.y"
  1234. {reset_temp_vars();}
  1235. #line 1445 "as.tab.c"
  1236. break;
  1237. case 13:
  1238. #line 64 "as.y"
  1239. {reset_temp_vars();}
  1240. #line 1451 "as.tab.c"
  1241. break;
  1242. case 14:
  1243. #line 65 "as.y"
  1244. {reset_temp_vars();}
  1245. #line 1457 "as.tab.c"
  1246. break;
  1247. case 15:
  1248. #line 66 "as.y"
  1249. {reset_temp_vars();}
  1250. #line 1463 "as.tab.c"
  1251. break;
  1252. case 16:
  1253. #line 69 "as.y"
  1254. { printf("If reconnu\n"); }
  1255. #line 1469 "as.tab.c"
  1256. break;
  1257. case 17:
  1258. #line 70 "as.y"
  1259. { printf("Else if reconnu\n"); }
  1260. #line 1475 "as.tab.c"
  1261. break;
  1262. case 18:
  1263. #line 71 "as.y"
  1264. { printf("Else reconnu\n"); }
  1265. #line 1481 "as.tab.c"
  1266. break;
  1267. case 20:
  1268. #line 73 "as.y"
  1269. { printf("While reconnu\n"); }
  1270. #line 1487 "as.tab.c"
  1271. break;
  1272. case 25:
  1273. #line 81 "as.y"
  1274. { printf("%s prend une valeur\n", (yyvsp[-3].id));}
  1275. #line 1493 "as.tab.c"
  1276. break;
  1277. case 26:
  1278. #line 83 "as.y"
  1279. { int addr = allocate_mem_temp_var(INT); add_operation(AFC, addr,(yyvsp[0].nombre),0); (yyval.nombre) = addr;}
  1280. #line 1499 "as.tab.c"
  1281. break;
  1282. case 27:
  1283. #line 85 "as.y"
  1284. { printf("Nombre exp\n"); int addr = allocate_mem_temp_var(INT); add_operation(AFC, addr,(yyvsp[0].nombre),0); (yyval.nombre) = addr;}
  1285. #line 1505 "as.tab.c"
  1286. break;
  1287. case 28:
  1288. #line 86 "as.y"
  1289. { printf("Id\n"); /*Faire un get_address sur la pile*/}
  1290. #line 1511 "as.tab.c"
  1291. break;
  1292. case 29:
  1293. #line 87 "as.y"
  1294. { printf("Mul\n"); int addr = allocate_mem_temp_var(INT); add_operation(MUL, addr,(yyvsp[-2].nombre),(yyvsp[-1].nombre)); (yyval.nombre) = addr;}
  1295. #line 1517 "as.tab.c"
  1296. break;
  1297. case 30:
  1298. #line 88 "as.y"
  1299. { printf("Div\n"); int addr = allocate_mem_temp_var(INT); add_operation(DIV, addr,(yyvsp[-2].nombre),(yyvsp[-1].nombre)); (yyval.nombre) = addr;}
  1300. #line 1523 "as.tab.c"
  1301. break;
  1302. case 31:
  1303. #line 89 "as.y"
  1304. { printf("Sub\n"); int addr = allocate_mem_temp_var(INT); add_operation(SOU, addr,(yyvsp[-2].nombre),(yyvsp[-1].nombre)); (yyval.nombre) = addr;}
  1305. #line 1529 "as.tab.c"
  1306. break;
  1307. case 32:
  1308. #line 90 "as.y"
  1309. { printf("Add\n"); int addr = allocate_mem_temp_var(INT); add_operation(ADD, addr,(yyvsp[-2].nombre),(yyvsp[-1].nombre)); (yyval.nombre) = addr;}
  1310. #line 1535 "as.tab.c"
  1311. break;
  1312. case 33:
  1313. #line 91 "as.y"
  1314. { printf("Invoc\n"); int addr = allocate_mem_temp_var(INT); add_operation(AFC, addr,(yyvsp[0].nombre),0); (yyval.nombre) = addr;}
  1315. #line 1541 "as.tab.c"
  1316. break;
  1317. case 34:
  1318. #line 92 "as.y"
  1319. { printf("Parentheses\n"); (yyval.nombre)=(yyvsp[-1].nombre);}
  1320. #line 1547 "as.tab.c"
  1321. break;
  1322. case 35:
  1323. #line 93 "as.y"
  1324. { printf("Moins\n"); int addr = allocate_mem_temp_var(INT); add_operation(SOU, 0,addr,0); (yyval.nombre) = addr;}
  1325. #line 1553 "as.tab.c"
  1326. break;
  1327. case 36:
  1328. #line 94 "as.y"
  1329. { printf("==\n"); int addr = allocate_mem_temp_var(INT); add_operation(EQU, addr,(yyvsp[-2].nombre),(yyvsp[0].nombre)); (yyval.nombre) = addr;}
  1330. #line 1559 "as.tab.c"
  1331. break;
  1332. case 37:
  1333. #line 95 "as.y"
  1334. { printf(">\n"); int addr = allocate_mem_temp_var(INT); add_operation(SUP, addr,(yyvsp[-2].nombre),(yyvsp[0].nombre)); (yyval.nombre) = addr;}
  1335. #line 1565 "as.tab.c"
  1336. break;
  1337. case 38:
  1338. #line 96 "as.y"
  1339. { printf("<\n"); int addr = allocate_mem_temp_var(INT); add_operation(INF, addr,(yyvsp[-2].nombre),(yyvsp[0].nombre)); (yyval.nombre) = addr;}
  1340. #line 1571 "as.tab.c"
  1341. break;
  1342. case 39:
  1343. #line 97 "as.y"
  1344. { printf("!\n"); }
  1345. #line 1577 "as.tab.c"
  1346. break;
  1347. case 40:
  1348. #line 102 "as.y"
  1349. {type_courant = INT; printf("Type int\n");}
  1350. #line 1583 "as.tab.c"
  1351. break;
  1352. case 43:
  1353. #line 107 "as.y"
  1354. {push((yyvsp[0].id), 0, type_courant); printf("Suite Decl\n");}
  1355. #line 1589 "as.tab.c"
  1356. break;
  1357. case 44:
  1358. #line 108 "as.y"
  1359. {int addr = push((yyvsp[-2].id),1, type_courant); add_operation(AFC, addr,(yyvsp[0].nombre),0);}
  1360. #line 1595 "as.tab.c"
  1361. break;
  1362. case 45:
  1363. #line 109 "as.y"
  1364. { printf("Fin Decl\n");}
  1365. #line 1601 "as.tab.c"
  1366. break;
  1367. case 47:
  1368. #line 112 "as.y"
  1369. {int addr = push((yyvsp[-2].id),1, type_courant); add_operation(AFC, addr,(yyvsp[0].nombre),0);}
  1370. #line 1607 "as.tab.c"
  1371. break;
  1372. case 50:
  1373. #line 133 "as.y"
  1374. { printf("Appel de printf sur %s\n", (yyvsp[-1].id)); }
  1375. #line 1613 "as.tab.c"
  1376. break;
  1377. #line 1617 "as.tab.c"
  1378. default: break;
  1379. }
  1380. /* User semantic actions sometimes alter yychar, and that requires
  1381. that yytoken be updated with the new translation. We take the
  1382. approach of translating immediately before every use of yytoken.
  1383. One alternative is translating here after every semantic action,
  1384. but that translation would be missed if the semantic action invokes
  1385. YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
  1386. if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
  1387. incorrect destructor might then be invoked immediately. In the
  1388. case of YYERROR or YYBACKUP, subsequent parser actions might lead
  1389. to an incorrect destructor call or verbose syntax error message
  1390. before the lookahead is translated. */
  1391. YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  1392. YYPOPSTACK (yylen);
  1393. yylen = 0;
  1394. YY_STACK_PRINT (yyss, yyssp);
  1395. *++yyvsp = yyval;
  1396. /* Now 'shift' the result of the reduction. Determine what state
  1397. that goes to, based on the state we popped back to and the rule
  1398. number reduced by. */
  1399. {
  1400. const int yylhs = yyr1[yyn] - YYNTOKENS;
  1401. const int yyi = yypgoto[yylhs] + *yyssp;
  1402. yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
  1403. ? yytable[yyi]
  1404. : yydefgoto[yylhs]);
  1405. }
  1406. goto yynewstate;
  1407. /*--------------------------------------.
  1408. | yyerrlab -- here on detecting error. |
  1409. `--------------------------------------*/
  1410. yyerrlab:
  1411. /* Make sure we have latest lookahead translation. See comments at
  1412. user semantic actions for why this is necessary. */
  1413. yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
  1414. /* If not already recovering from an error, report this error. */
  1415. if (!yyerrstatus)
  1416. {
  1417. ++yynerrs;
  1418. #if ! YYERROR_VERBOSE
  1419. yyerror (YY_("syntax error"));
  1420. #else
  1421. # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
  1422. yyssp, yytoken)
  1423. {
  1424. char const *yymsgp = YY_("syntax error");
  1425. int yysyntax_error_status;
  1426. yysyntax_error_status = YYSYNTAX_ERROR;
  1427. if (yysyntax_error_status == 0)
  1428. yymsgp = yymsg;
  1429. else if (yysyntax_error_status == 1)
  1430. {
  1431. if (yymsg != yymsgbuf)
  1432. YYSTACK_FREE (yymsg);
  1433. yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
  1434. if (!yymsg)
  1435. {
  1436. yymsg = yymsgbuf;
  1437. yymsg_alloc = sizeof yymsgbuf;
  1438. yysyntax_error_status = 2;
  1439. }
  1440. else
  1441. {
  1442. yysyntax_error_status = YYSYNTAX_ERROR;
  1443. yymsgp = yymsg;
  1444. }
  1445. }
  1446. yyerror (yymsgp);
  1447. if (yysyntax_error_status == 2)
  1448. goto yyexhaustedlab;
  1449. }
  1450. # undef YYSYNTAX_ERROR
  1451. #endif
  1452. }
  1453. if (yyerrstatus == 3)
  1454. {
  1455. /* If just tried and failed to reuse lookahead token after an
  1456. error, discard it. */
  1457. if (yychar <= YYEOF)
  1458. {
  1459. /* Return failure if at end of input. */
  1460. if (yychar == YYEOF)
  1461. YYABORT;
  1462. }
  1463. else
  1464. {
  1465. yydestruct ("Error: discarding",
  1466. yytoken, &yylval);
  1467. yychar = YYEMPTY;
  1468. }
  1469. }
  1470. /* Else will try to reuse lookahead token after shifting the error
  1471. token. */
  1472. goto yyerrlab1;
  1473. /*---------------------------------------------------.
  1474. | yyerrorlab -- error raised explicitly by YYERROR. |
  1475. `---------------------------------------------------*/
  1476. yyerrorlab:
  1477. /* Pacify compilers when the user code never invokes YYERROR and the
  1478. label yyerrorlab therefore never appears in user code. */
  1479. if (0)
  1480. YYERROR;
  1481. /* Do not reclaim the symbols of the rule whose action triggered
  1482. this YYERROR. */
  1483. YYPOPSTACK (yylen);
  1484. yylen = 0;
  1485. YY_STACK_PRINT (yyss, yyssp);
  1486. yystate = *yyssp;
  1487. goto yyerrlab1;
  1488. /*-------------------------------------------------------------.
  1489. | yyerrlab1 -- common code for both syntax error and YYERROR. |
  1490. `-------------------------------------------------------------*/
  1491. yyerrlab1:
  1492. yyerrstatus = 3; /* Each real token shifted decrements this. */
  1493. for (;;)
  1494. {
  1495. yyn = yypact[yystate];
  1496. if (!yypact_value_is_default (yyn))
  1497. {
  1498. yyn += YYTERROR;
  1499. if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  1500. {
  1501. yyn = yytable[yyn];
  1502. if (0 < yyn)
  1503. break;
  1504. }
  1505. }
  1506. /* Pop the current state because it cannot handle the error token. */
  1507. if (yyssp == yyss)
  1508. YYABORT;
  1509. yydestruct ("Error: popping",
  1510. yystos[yystate], yyvsp);
  1511. YYPOPSTACK (1);
  1512. yystate = *yyssp;
  1513. YY_STACK_PRINT (yyss, yyssp);
  1514. }
  1515. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1516. *++yyvsp = yylval;
  1517. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1518. /* Shift the error token. */
  1519. YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  1520. yystate = yyn;
  1521. goto yynewstate;
  1522. /*-------------------------------------.
  1523. | yyacceptlab -- YYACCEPT comes here. |
  1524. `-------------------------------------*/
  1525. yyacceptlab:
  1526. yyresult = 0;
  1527. goto yyreturn;
  1528. /*-----------------------------------.
  1529. | yyabortlab -- YYABORT comes here. |
  1530. `-----------------------------------*/
  1531. yyabortlab:
  1532. yyresult = 1;
  1533. goto yyreturn;
  1534. #if !defined yyoverflow || YYERROR_VERBOSE
  1535. /*-------------------------------------------------.
  1536. | yyexhaustedlab -- memory exhaustion comes here. |
  1537. `-------------------------------------------------*/
  1538. yyexhaustedlab:
  1539. yyerror (YY_("memory exhausted"));
  1540. yyresult = 2;
  1541. /* Fall through. */
  1542. #endif
  1543. /*-----------------------------------------------------.
  1544. | yyreturn -- parsing is finished, return the result. |
  1545. `-----------------------------------------------------*/
  1546. yyreturn:
  1547. if (yychar != YYEMPTY)
  1548. {
  1549. /* Make sure we have latest lookahead translation. See comments at
  1550. user semantic actions for why this is necessary. */
  1551. yytoken = YYTRANSLATE (yychar);
  1552. yydestruct ("Cleanup: discarding lookahead",
  1553. yytoken, &yylval);
  1554. }
  1555. /* Do not reclaim the symbols of the rule whose action triggered
  1556. this YYABORT or YYACCEPT. */
  1557. YYPOPSTACK (yylen);
  1558. YY_STACK_PRINT (yyss, yyssp);
  1559. while (yyssp != yyss)
  1560. {
  1561. yydestruct ("Cleanup: popping",
  1562. yystos[+*yyssp], yyvsp);
  1563. YYPOPSTACK (1);
  1564. }
  1565. #ifndef yyoverflow
  1566. if (yyss != yyssa)
  1567. YYSTACK_FREE (yyss);
  1568. #endif
  1569. #if YYERROR_VERBOSE
  1570. if (yymsg != yymsgbuf)
  1571. YYSTACK_FREE (yymsg);
  1572. #endif
  1573. return yyresult;
  1574. }
  1575. #line 147 "as.y"
  1576. void main(void) {
  1577. init();
  1578. yyparse();
  1579. }