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.

analyse_syntaxique.tab.c 55KB

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