From c363024e17555f5e43a8169ee87870c4c941f6ff Mon Sep 17 00:00:00 2001 From: Nahom Date: Fri, 30 Apr 2021 17:08:29 +0200 Subject: [PATCH] pointeur et fonction OK --- a.out | Bin 42264 -> 47580 bytes analyse_lexicale.lex | 2 + analyse_syntaxique.output | 2262 +++++++++++++++++++++---------------- analyse_syntaxique.tab.c | 2097 +++++++++++++++++++--------------- analyse_syntaxique.tab.h | 161 +-- analyse_syntaxique.y | 105 +- gen_assembleur.c | 45 +- gen_assembleur.h | 12 +- instructions.txt | 31 +- lex.yy.c | 547 +++++---- script.sh | 19 +- table_fonctions.c | 59 + table_fonctions.h | 35 + table_symboles.c | 50 +- table_symboles.h | 10 +- 15 files changed, 3143 insertions(+), 2292 deletions(-) create mode 100644 table_fonctions.c create mode 100644 table_fonctions.h diff --git a/a.out b/a.out index 2a3c0d43cc71d7b43afd30233ca31bcd594bc0cc..a7cd74de3143246ee0cce7e8a2e39d43fbbc96f2 100755 GIT binary patch literal 47580 zcmeHw3w%`7)$g7pLmn_p5TZN;#>iX1gm-{wf*F`#0^t#h&q+uo5DiI8CJ1UYI7D(7 zMxz2^wKn#{O4Zt^K+!5BNJ+4$skN21)GsR4GnQ&psz~{q`(JDCGcy^2_Pby2{oUX1 zW|Do@UVE>-_S$Q&z4qgrGxOG&zkeGmgeh7G5rvS5(9}nWdSOFMh#?3L1gA4EbAkOj z`_jdf+Wlkdj`oNVpK++b>0EAKvAjD8m#^!dCKPT)G6jglAE(ppTIW^>KqS9{0cZ@; z|GZ4n5FQgEC!{VMbvmovH7l!wNs;{Kx+K3wMPcAZfjGr4Bp>l}u6C7Gx~f1F$?vG* z$3h~XaMFA5bB=sP)$Xd&@>Po99DXHIz6t0=`Wyuw{^`aW8BS+WMR|2dfsy<~x#ag8 z^u{0H-SnrD4d8Uvl;2ibUhFI_FR4IcB){gnB|owu`Vbx|lgyDCDPpp6R@5 z@uFqYTIwVpHc%o3&L1*Ze8_&oZP@8tRS|0C`T33G(zw*g@&-!%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Im4bDXJv5T`j9qi@`eT)@TzG@bJ8Q~QZ*iDuXkHo#+02H z(WonvH9T8aX{os>z*0t#pCJl;a7CUM*->J(!~FEQ@>=ew&MMa#weF-^mtzrmNmZ>? z9l0a*2YRF(67&M1uz?zaJ6TzH5^pVZx}Dcl@u4a7@H!J7sfz4$uByU7CoH2bM>QbJ zg{iH+##!#FF2#&cg0~y%;1%JyNO`w-A2Q6lGo~?T{vv3GlR3Tg&^x>bFA5l=tQ^kx zI9-N!5vpsfy3u+xiT2RRkAV0{(4j66 z^gv5a&Xx6i_{ID|O^V{d;TSoNtX${H8jq)@imjzzF`yqWz;IN9=7Iyk$*TA~R8|?P z5>^H~EuF`#j%GlYr=}v@4rGg|ShgI@Kv%VRdbNA4$ggZ|9e%wbJh{_}F-#5PG`RIR zv^6xWt#j3)BC7C)hbkY92hU|Jor{KNyzFqDB|Bb8NC6+NX`m7443}bQ zs6LF>pq@HG%T(zvIkA((~*5=-NQLmI8zAXLK#%QSbn zT&tCrLWzorq+-#=cnTG!RFoGKaJ%S@8w6kqV*P}eop zeON_@Ta=Tm`8Wp=ETxU~>VB=FHnT9oYG0?|3QE}p=>VCJPwNf#qKMSWd{jI>LUS&4MeR1_%4W%(3*7o;1pDVh{ z;;>0lnWA@E(%a;QQc-2EvO&carG2|Oe|4Qg(Us(&rbFecpkEgpGoCBxB*(;Il~-{^-+@dbPL*EWH|qLtrvDIW$$pjIcuqlGc(jz?23hm*IU?k{ zM*2pZV9N^@ounLx@^59g@`LT*ne$iAJ#=p1$ykz1FJhtkP. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -44,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.4" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -52,26 +55,97 @@ /* Pure parsers. */ #define YYPURE 0 -/* Push parsers. */ -#define YYPUSH 0 +/* Using locations. */ +#define YYLSP_NEEDED 0 -/* Pull parsers. */ -#define YYPULL 1 + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + tENTIER = 258, + tENTIEREXP = 259, + tADD = 260, + tSUB = 261, + tMUL = 262, + tDIV = 263, + tPO = 264, + tPF = 265, + tAO = 266, + tAF = 267, + tERROR = 268, + tAPPERSAND = 269, + tPV = 270, + tVIRGULE = 271, + tAFFECTATION = 272, + tEGAL = 273, + tDIFF = 274, + tLT = 275, + tGT = 276, + tGTE = 277, + tLTE = 278, + tMAIN = 279, + tINT = 280, + tPRINT = 281, + tRETURN = 282, + tOR = 283, + tAND = 284, + tIF = 285, + tELSE = 286, + tWHILE = 287, + tCONST = 288, + tVAR = 289, + tNOT = 290 + }; +#endif +/* Tokens. */ +#define tENTIER 258 +#define tENTIEREXP 259 +#define tADD 260 +#define tSUB 261 +#define tMUL 262 +#define tDIV 263 +#define tPO 264 +#define tPF 265 +#define tAO 266 +#define tAF 267 +#define tERROR 268 +#define tAPPERSAND 269 +#define tPV 270 +#define tVIRGULE 271 +#define tAFFECTATION 272 +#define tEGAL 273 +#define tDIFF 274 +#define tLT 275 +#define tGT 276 +#define tGTE 277 +#define tLTE 278 +#define tMAIN 279 +#define tINT 280 +#define tPRINT 281 +#define tRETURN 282 +#define tOR 283 +#define tAND 284 +#define tIF 285 +#define tELSE 286 +#define tWHILE 287 +#define tCONST 288 +#define tVAR 289 +#define tNOT 290 /* Copy the first part of user declarations. */ -#line 67 "analyse_syntaxique.tab.c" /* yacc.c:339 */ -# ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif -# endif +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -81,97 +155,48 @@ # define YYERROR_VERBOSE 0 #endif -/* In a future release of Bison, this section will be replaced - by #include "analyse_syntaxique.tab.h". */ -#ifndef YY_YY_ANALYSE_SYNTAXIQUE_TAB_H_INCLUDED -# define YY_YY_ANALYSE_SYNTAXIQUE_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -#if YYDEBUG -extern int yydebug; +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 #endif -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - tENTIER = 258, - tENTIEREXP = 259, - tADD = 260, - tSUB = 261, - tMUL = 262, - tDIV = 263, - tPO = 264, - tPF = 265, - tAO = 266, - tAF = 267, - tERROR = 268, - tPV = 269, - tVIRGULE = 270, - tAFFECTATION = 271, - tEGAL = 272, - tDIFF = 273, - tLT = 274, - tGT = 275, - tGTE = 276, - tLTE = 277, - tMAIN = 278, - tINT = 279, - tPRINT = 280, - tRETURN = 281, - tOR = 282, - tAND = 283, - tIF = 284, - tELSE = 285, - tWHILE = 286, - tCONST = 287, - tVAR = 288, - tNOT = 289 - }; -#endif - -/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - -union YYSTYPE +typedef union YYSTYPE +#line 1 "analyse_syntaxique.y" { -#line 1 "analyse_syntaxique.y" /* yacc.c:355 */ - int nombre; char id[30]; - -#line 147 "analyse_syntaxique.tab.c" /* yacc.c:355 */ -}; - -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 +} +/* Line 193 of yacc.c. */ +#line 172 "analyse_syntaxique.tab.c" + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif -extern YYSTYPE yylval; - -int yyparse (void); - -#endif /* !YY_YY_ANALYSE_SYNTAXIQUE_TAB_H_INCLUDED */ /* Copy the second part of user declarations. */ -#line 6 "analyse_syntaxique.y" /* yacc.c:358 */ +#line 6 "analyse_syntaxique.y" #include #include "table_symboles.h" +#include "table_fonctions.h" #include "gen_assembleur.h" enum Initialised_Variable init; enum Symbole_Type type; +enum Return_Type return_type; Table_Symboles table; +Table_Fonctions table_fonctions; instructions_array array; int whileCondition; +int return_value; -#line 175 "analyse_syntaxique.tab.c" /* yacc.c:358 */ + +/* Line 216 of yacc.c. */ +#line 200 "analyse_syntaxique.tab.c" #ifdef short # undef short @@ -185,8 +210,11 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#else +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; +#else +typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -206,7 +234,8 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -220,67 +249,38 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YYUSE(e) ((void) (e)) #else -# define YYUSE(E) /* empty */ +# define YYUSE(e) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) #else -# define YY_INITIAL_VALUE(Value) Value +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int i) +#else +static int +YYID (i) + int i; #endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END +{ + return i; +} #endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - #if ! defined yyoverflow || YYERROR_VERBOSE @@ -299,11 +299,11 @@ typedef short int yytype_int16; # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 +# ifndef _STDLIB_H +# define _STDLIB_H 1 # endif # endif # endif @@ -311,8 +311,8 @@ typedef short int yytype_int16; # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -326,23 +326,25 @@ typedef short int yytype_int16; # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ +# if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 +# ifndef _STDLIB_H +# define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -352,14 +354,14 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; + yytype_int16 yyss; + YYSTYPE yyvs; + }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -370,70 +372,64 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -# define YYCOPY_NEEDED 1 +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) #endif -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 4 +#define YYFINAL 9 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 140 +#define YYLAST 156 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 35 +#define YYNTOKENS 36 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 28 +#define YYNNTS 44 /* YYNRULES -- Number of rules. */ -#define YYNRULES 60 -/* YYNSTATES -- Number of states. */ -#define YYNSTATES 130 +#define YYNRULES 83 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 156 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 289 +#define YYMAXUTOK 290 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -464,236 +460,353 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35 }; #if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 5, 7, 10, 11, 19, 20, 28, + 30, 33, 34, 37, 40, 42, 45, 49, 50, 55, + 58, 59, 61, 63, 65, 67, 69, 72, 77, 81, + 82, 84, 87, 90, 91, 96, 98, 103, 109, 111, + 113, 117, 121, 125, 129, 132, 134, 138, 141, 144, + 145, 146, 147, 148, 149, 163, 164, 165, 172, 173, + 176, 177, 178, 179, 180, 192, 196, 200, 204, 208, + 212, 216, 220, 224, 227, 229, 230, 236, 239, 240, + 242, 246, 247, 253 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 37, 0, -1, 38, -1, 39, -1, 41, 38, -1, + -1, 25, 24, 40, 9, 44, 10, 48, -1, -1, + 43, 34, 42, 9, 44, 10, 48, -1, 25, -1, + 25, 7, -1, -1, 45, 47, -1, 46, 34, -1, + 25, -1, 25, 7, -1, 16, 45, 47, -1, -1, + 11, 49, 79, 12, -1, 50, 49, -1, -1, 56, + -1, 58, -1, 67, -1, 78, -1, 51, -1, 73, + 15, -1, 53, 54, 52, 15, -1, 16, 54, 52, + -1, -1, 25, -1, 33, 25, -1, 25, 7, -1, + -1, 34, 55, 17, 57, -1, 34, -1, 34, 17, + 57, 15, -1, 7, 34, 17, 57, 15, -1, 3, + -1, 34, -1, 57, 5, 57, -1, 57, 7, 57, + -1, 57, 6, 57, -1, 57, 8, 57, -1, 6, + 57, -1, 73, -1, 9, 57, 10, -1, 14, 34, + -1, 7, 34, -1, -1, -1, -1, -1, -1, 30, + 9, 72, 10, 59, 11, 60, 49, 61, 12, 62, + 63, 64, -1, -1, -1, 31, 11, 65, 49, 12, + 66, -1, -1, 31, 58, -1, -1, -1, -1, -1, + 32, 9, 68, 72, 10, 69, 11, 70, 49, 12, + 71, -1, 57, 18, 57, -1, 57, 19, 57, -1, + 57, 20, 57, -1, 57, 21, 57, -1, 57, 23, + 57, -1, 57, 22, 57, -1, 57, 29, 57, -1, + 57, 28, 57, -1, 35, 72, -1, 57, -1, -1, + 34, 9, 74, 75, 10, -1, 76, 77, -1, -1, + 57, -1, 16, 76, 77, -1, -1, 26, 9, 57, + 10, 15, -1, 27, 57, 15, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 78, 78, 80, 81, 83, 86, 87, 90, 92, - 93, 95, 96, 97, 98, 99, 100, 102, 104, 105, - 107, 108, 110, 110, 111, 114, 117, 119, 121, 122, - 123, 124, 125, 126, 127, 130, 131, 133, 134, 136, - 143, 136, 149, 150, 151, 153, 155, 153, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 183, 186, - 189 + 0, 83, 83, 85, 86, 89, 89, 90, 90, 92, + 93, 95, 96, 98, 100, 101, 103, 104, 107, 109, + 110, 112, 113, 114, 115, 116, 117, 119, 121, 122, + 124, 125, 126, 128, 128, 129, 132, 133, 136, 137, + 138, 139, 140, 141, 142, 143, 149, 150, 151, 154, + 160, 160, 160, 161, 154, 167, 167, 167, 168, 169, + 171, 173, 179, 179, 171, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 197, 197, 204, 205, 206, + 207, 208, 210, 212 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 0 +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "tENTIER", "tENTIEREXP", "tADD", "tSUB", - "tMUL", "tDIV", "tPO", "tPF", "tAO", "tAF", "tERROR", "tPV", "tVIRGULE", - "tAFFECTATION", "tEGAL", "tDIFF", "tLT", "tGT", "tGTE", "tLTE", "tMAIN", - "tINT", "tPRINT", "tRETURN", "tOR", "tAND", "tIF", "tELSE", "tWHILE", - "tCONST", "tVAR", "tNOT", "$accept", "Main", "Params", "Param", - "SuiteParams", "Body", "Instructions", "Instruction", "Decl", - "SuiteDecl", "Type", "Valeur", "$@1", "Aff", "E", "Args", "SuiteArgs", - "If", "$@2", "$@3", "Else", "While", "$@4", "$@5", "Cond", "Invocation", - "Print", "Return", YY_NULLPTR + "tMUL", "tDIV", "tPO", "tPF", "tAO", "tAF", "tERROR", "tAPPERSAND", + "tPV", "tVIRGULE", "tAFFECTATION", "tEGAL", "tDIFF", "tLT", "tGT", + "tGTE", "tLTE", "tMAIN", "tINT", "tPRINT", "tRETURN", "tOR", "tAND", + "tIF", "tELSE", "tWHILE", "tCONST", "tVAR", "tNOT", "$accept", "C", + "Fonctions", "Main", "@1", "Fonction", "@2", "Function_type", "Params", + "Param", "Param_type", "SuiteParams", "Body", "Instructions", + "Instruction", "Decl", "SuiteDecl", "Type", "Valeur", "@3", "Aff", "E", + "If", "@4", "@5", "@6", "@7", "@8", "Else", "@9", "@10", "While", "@11", + "@12", "@13", "@14", "Cond", "Invocation", "@15", "Args", "Arg", + "SuiteArgs", "Print", "Return", 0 }; #endif # ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289 + 285, 286, 287, 288, 289, 290 }; # endif -#define YYPACT_NINF -50 - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-50))) - -#define YYTABLE_NINF -23 - -#define yytable_value_is_error(Yytable_value) \ - 0 - - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int8 yypact[] = +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = { - -20, -16, 11, 10, -50, -8, -6, 25, 47, -50, - 30, -8, -50, 56, -50, 47, -50, 63, 65, 73, - 59, 55, 58, 56, -50, 72, -50, -50, -50, 84, - -50, 93, 19, 17, -50, -50, 75, 19, 19, 97, - -50, 94, 96, -50, -50, -50, 19, 19, 103, 53, - -50, 17, 48, 104, 17, 100, 106, 7, 26, -50, - 101, 72, 105, 22, 86, 19, 19, 19, 19, 107, - -50, 19, 19, 19, 19, 19, 19, 19, 19, -50, - 108, 87, -50, -50, -50, -50, 19, 96, -50, -50, - 71, 22, 114, -50, -50, 95, 95, 95, 95, 95, - 95, 95, 95, 112, -50, 100, 95, -50, 56, 113, - -50, 115, 56, -50, 116, 99, -50, -5, -50, 56, - 117, 118, 17, -50, 121, 122, 56, 120, 99, -50 + 0, 36, 37, 38, 38, 40, 39, 42, 41, 43, + 43, 44, 44, 45, 46, 46, 47, 47, 48, 49, + 49, 50, 50, 50, 50, 50, 50, 51, 52, 52, + 53, 53, 53, 55, 54, 54, 56, 56, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 59, + 60, 61, 62, 63, 58, 65, 66, 64, 64, 64, + 68, 69, 70, 71, 67, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 74, 73, 75, 75, 76, + 77, 77, 78, 79 }; - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 2, 0, 7, 0, 7, 1, + 2, 0, 2, 2, 1, 2, 3, 0, 4, 2, + 0, 1, 1, 1, 1, 1, 2, 4, 3, 0, + 1, 2, 2, 0, 4, 1, 4, 5, 1, 1, + 3, 3, 3, 3, 2, 1, 3, 2, 2, 0, + 0, 0, 0, 0, 13, 0, 0, 6, 0, 2, + 0, 0, 0, 0, 11, 3, 3, 3, 3, 3, + 3, 3, 3, 2, 1, 0, 5, 2, 0, 1, + 3, 0, 5, 3 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 0, 0, 0, 1, 3, 0, 0, 7, 5, - 0, 0, 4, 10, 2, 7, 20, 0, 0, 0, - 0, 0, 0, 10, 15, 0, 11, 12, 13, 0, - 14, 0, 0, 0, 45, 21, 36, 0, 0, 0, - 9, 24, 19, 16, 6, 26, 0, 0, 27, 0, - 33, 0, 57, 0, 0, 38, 0, 0, 0, 8, - 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, - 56, 0, 0, 0, 0, 0, 0, 0, 0, 39, - 0, 0, 35, 58, 25, 60, 0, 19, 17, 34, - 28, 30, 29, 31, 59, 48, 49, 50, 51, 53, - 52, 55, 54, 0, 46, 38, 23, 18, 10, 0, - 37, 0, 10, 40, 0, 43, 47, 0, 41, 10, - 0, 0, 0, 42, 0, 0, 10, 0, 43, 44 + 0, 9, 0, 2, 3, 0, 0, 10, 5, 1, + 4, 7, 0, 0, 11, 11, 14, 0, 17, 0, + 0, 15, 0, 0, 12, 13, 0, 20, 6, 17, + 8, 0, 30, 0, 0, 0, 0, 0, 0, 20, + 25, 0, 21, 22, 23, 0, 24, 16, 0, 32, + 0, 0, 60, 31, 75, 0, 0, 0, 19, 35, + 29, 26, 0, 38, 0, 0, 0, 0, 39, 0, + 45, 0, 74, 0, 0, 78, 0, 0, 18, 0, + 0, 0, 0, 44, 48, 0, 47, 0, 0, 0, + 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, + 0, 49, 0, 79, 0, 81, 36, 83, 0, 29, + 27, 37, 46, 40, 42, 41, 43, 82, 65, 66, + 67, 68, 70, 69, 72, 71, 0, 61, 76, 0, + 77, 34, 28, 50, 0, 81, 20, 62, 80, 51, + 20, 0, 0, 52, 63, 53, 64, 58, 0, 54, + 55, 59, 20, 0, 56, 57 }; - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = { - -50, -50, -50, 123, 110, -50, -22, -50, -50, 49, - -50, 74, -50, -50, -29, -50, 32, -50, -50, -50, - 12, -50, -50, -50, -49, -13, -50, -50 + -1, 2, 3, 4, 12, 5, 13, 6, 17, 18, + 19, 24, 28, 38, 39, 40, 81, 41, 60, 79, + 42, 72, 43, 126, 136, 141, 145, 147, 149, 152, + 155, 44, 74, 134, 140, 146, 73, 70, 75, 104, + 105, 130, 46, 57 }; - /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -62 +static const yytype_int16 yypact[] = { - -1, 2, 7, 8, 12, 14, 22, 23, 24, 62, - 25, 42, 60, 26, 52, 56, 82, 27, 103, 115, - 118, 28, 54, 109, 53, 50, 30, 39 + -14, -4, 15, -62, -62, -14, -15, -62, -62, -62, + -62, -62, 12, 25, -1, -1, 30, 34, 39, 22, + 48, -62, 51, -1, -62, -62, 51, 50, -62, 39, + -62, 27, 52, 64, 68, 70, 47, 0, 66, 50, + -62, 62, -62, -62, -62, 82, -62, -62, 83, -62, + 29, 19, -62, -62, -62, 29, 29, 87, -62, 90, + 85, -62, 29, -62, 29, 74, 29, 76, 102, 84, + -62, 19, 98, 105, 19, 29, 59, 63, -62, 95, + 62, 107, 80, -2, -62, 123, -62, 29, 29, 29, + 29, 108, -62, 29, 29, 29, 29, 29, 29, 29, + 29, -62, 114, 129, 122, 124, -62, -62, 29, 85, + -62, -62, -62, 23, -2, 130, -62, -62, 129, 129, + 129, 129, 129, 129, 129, 129, 128, -62, -62, 29, + -62, 129, -62, -62, 131, 124, 50, -62, -62, -62, + 50, 132, 133, -62, -62, -62, -62, 110, -7, -62, + -62, -62, 50, 134, -62, -62 }; - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -62, -62, 138, -62, -62, -62, -62, -62, 135, 125, + -62, 118, 126, -38, -62, -62, 40, -62, 71, -62, + -62, -48, 5, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -61, -27, -62, -62, + 26, 21, -62, -62 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -34 static const yytype_int16 yytable[] = { - 29, 40, 70, 49, 1, 80, 119, 3, 57, 58, - 29, 4, 65, 66, 67, 68, 6, 63, 64, 5, - 45, 84, 45, 46, 120, 46, 47, 9, 47, 67, - 68, 65, 66, 67, 68, 10, 90, 91, 92, 93, - 85, 13, 95, 96, 97, 98, 99, 100, 101, 102, - 48, 51, 48, 65, 66, 67, 68, 106, 65, 66, - 67, 68, 11, 69, 36, 71, 72, 73, 74, 75, - 76, 37, 32, 124, 33, 77, 78, 66, 67, 68, - 16, 17, 34, 35, 38, 18, 111, 19, 20, 21, - 114, 65, 66, 67, 68, 29, 89, 121, 43, 29, - 65, 66, 67, 68, 127, 41, 29, 44, 55, 59, - -22, 61, 36, 29, 79, 81, 83, 86, 104, 88, - 105, 94, 68, 108, 112, 31, 122, 113, 116, 117, - 123, 125, 128, 126, 15, 87, 107, 110, 0, 0, - 129 + 45, 58, 69, 7, 150, 89, 90, 76, 77, 54, + 92, 1, 45, 102, 82, 9, 83, 55, 85, 11, + 8, 14, 63, 34, 16, 64, 65, 103, 66, 88, + 89, 90, 63, 67, 15, 64, 65, 21, 66, 113, + 114, 115, 116, 67, 22, 118, 119, 120, 121, 122, + 123, 124, 125, 68, 71, 23, 25, 31, 26, 49, + 131, 48, 27, 68, 87, 88, 89, 90, 87, 88, + 89, 90, 53, 50, 106, 32, 33, 51, 107, 52, + 34, 103, 35, 36, 37, 87, 88, 89, 90, 87, + 88, 89, 90, 56, 91, 111, 59, 61, 139, 78, + 62, 80, 142, 87, 88, 89, 90, -33, 84, 45, + 86, 54, 108, 45, 153, 101, 93, 94, 95, 96, + 97, 98, 110, 117, 127, 45, 99, 100, 87, 88, + 89, 90, 128, 112, 87, 88, 89, 90, 90, 133, + 129, 148, 137, 10, 143, 144, 154, 47, 29, 132, + 20, 109, 30, 151, 0, 135, 138 }; static const yytype_int16 yycheck[] = { - 13, 23, 51, 32, 24, 54, 11, 23, 37, 38, - 23, 0, 5, 6, 7, 8, 24, 46, 47, 9, - 3, 14, 3, 6, 29, 6, 9, 33, 9, 7, - 8, 5, 6, 7, 8, 10, 65, 66, 67, 68, - 14, 11, 71, 72, 73, 74, 75, 76, 77, 78, - 33, 34, 33, 5, 6, 7, 8, 86, 5, 6, - 7, 8, 15, 10, 9, 17, 18, 19, 20, 21, - 22, 16, 9, 122, 9, 27, 28, 6, 7, 8, - 24, 25, 9, 24, 26, 29, 108, 31, 32, 33, - 112, 5, 6, 7, 8, 108, 10, 119, 14, 112, - 5, 6, 7, 8, 126, 33, 119, 14, 33, 12, - 16, 15, 9, 126, 10, 15, 10, 16, 10, 14, - 33, 14, 8, 11, 11, 15, 9, 12, 12, 30, - 12, 10, 12, 11, 11, 61, 87, 105, -1, -1, - 128 + 27, 39, 50, 7, 11, 7, 8, 55, 56, 9, + 71, 25, 39, 74, 62, 0, 64, 17, 66, 34, + 24, 9, 3, 30, 25, 6, 7, 75, 9, 6, + 7, 8, 3, 14, 9, 6, 7, 7, 9, 87, + 88, 89, 90, 14, 10, 93, 94, 95, 96, 97, + 98, 99, 100, 34, 35, 16, 34, 7, 10, 7, + 108, 34, 11, 34, 5, 6, 7, 8, 5, 6, + 7, 8, 25, 9, 15, 25, 26, 9, 15, 9, + 30, 129, 32, 33, 34, 5, 6, 7, 8, 5, + 6, 7, 8, 27, 10, 15, 34, 15, 136, 12, + 17, 16, 140, 5, 6, 7, 8, 17, 34, 136, + 34, 9, 17, 140, 152, 10, 18, 19, 20, 21, + 22, 23, 15, 15, 10, 152, 28, 29, 5, 6, + 7, 8, 10, 10, 5, 6, 7, 8, 8, 11, + 16, 31, 11, 5, 12, 12, 12, 29, 23, 109, + 15, 80, 26, 148, -1, 129, 135 }; - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 24, 36, 23, 0, 9, 24, 37, 38, 33, - 10, 15, 39, 11, 40, 38, 24, 25, 29, 31, - 32, 33, 41, 42, 43, 45, 48, 52, 56, 60, - 61, 39, 9, 9, 9, 24, 9, 16, 26, 62, - 41, 33, 46, 14, 14, 3, 6, 9, 33, 49, - 60, 34, 49, 59, 57, 33, 50, 49, 49, 12, - 47, 15, 44, 49, 49, 5, 6, 7, 8, 10, - 59, 17, 18, 19, 20, 21, 22, 27, 28, 10, - 59, 15, 51, 10, 14, 14, 16, 46, 14, 10, - 49, 49, 49, 49, 14, 49, 49, 49, 49, 49, - 49, 49, 49, 53, 10, 33, 49, 44, 11, 58, - 51, 41, 11, 12, 41, 54, 12, 30, 55, 11, - 29, 41, 9, 12, 59, 10, 11, 41, 12, 55 + 0, 25, 37, 38, 39, 41, 43, 7, 24, 0, + 38, 34, 40, 42, 9, 9, 25, 44, 45, 46, + 44, 7, 10, 16, 47, 34, 10, 11, 48, 45, + 48, 7, 25, 26, 30, 32, 33, 34, 49, 50, + 51, 53, 56, 58, 67, 73, 78, 47, 34, 7, + 9, 9, 9, 25, 9, 17, 27, 79, 49, 34, + 54, 15, 17, 3, 6, 7, 9, 14, 34, 57, + 73, 35, 57, 72, 68, 74, 57, 57, 12, 55, + 16, 52, 57, 57, 34, 57, 34, 5, 6, 7, + 8, 10, 72, 18, 19, 20, 21, 22, 23, 28, + 29, 10, 72, 57, 75, 76, 15, 15, 17, 54, + 15, 15, 10, 57, 57, 57, 57, 15, 57, 57, + 57, 57, 57, 57, 57, 57, 59, 10, 10, 16, + 77, 57, 52, 11, 69, 76, 60, 11, 77, 49, + 70, 61, 49, 12, 12, 62, 71, 63, 31, 64, + 11, 58, 65, 49, 12, 66 }; - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 35, 36, 37, 37, 38, 39, 39, 40, 41, - 41, 42, 42, 42, 42, 42, 42, 43, 44, 44, - 45, 45, 47, 46, 46, 48, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 50, 50, 51, 51, 53, - 54, 52, 55, 55, 55, 57, 58, 56, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 60, 61, - 62 -}; +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 6, 0, 2, 2, 4, 0, 4, 2, - 0, 1, 1, 1, 1, 1, 2, 4, 3, 0, - 1, 2, 0, 4, 1, 4, 1, 1, 3, 3, - 3, 3, 2, 1, 3, 2, 0, 3, 0, 0, - 0, 10, 4, 0, 9, 0, 0, 9, 3, 3, - 3, 3, 3, 3, 3, 3, 2, 1, 4, 5, - 3 -}; +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 + YYERROR; \ + } \ +while (YYID (0)) +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -703,46 +816,54 @@ while (0) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - - -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif { - FILE *yyo = yyoutput; - YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); # endif - YYUSE (yytype); + switch (yytype) + { + default: + break; + } } @@ -750,11 +871,22 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue | Print this symbol on YYOUTPUT. | `--------------------------------*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif { - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); @@ -765,54 +897,66 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) | TOP (included). | `------------------------------------------------------------------*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +#else +static void +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; +#endif { YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif { - unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; + unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + fprintf (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, Rule); \ -} while (0) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -826,7 +970,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -841,6 +985,7 @@ int yydebug; # define YYMAXDEPTH 10000 #endif + #if YYERROR_VERBOSE @@ -849,8 +994,15 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -866,8 +1018,16 @@ yystrlen (const char *yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif { char *yyd = yydest; const char *yys = yysrc; @@ -897,27 +1057,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -928,209 +1088,211 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) { - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; + int yyn = yypact[yystate]; - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; } #endif /* YYERROR_VERBOSE */ + /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif { YYUSE (yyvaluep); + if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END + switch (yytype) + { + + default: + break; + } } + + +/* Prevent warnings from -Wmissing-prototypes. */ + +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ - -/* The lookahead symbol. */ +/* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; + /* Number of syntax errors so far. */ int yynerrs; + /*----------. | yyparse. | `----------*/ +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) int yyparse (void) +#else +int +yyparse () + +#endif +#endif { - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - + + int yystate; int yyn; int yyresult; - /* Lookahead token as an internal (translated) token number. */ + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1138,22 +1300,54 @@ yyparse (void) YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss; + yyvsp = yyvs; + goto yysetstate; /*------------------------------------------------------------. @@ -1174,23 +1368,25 @@ yyparse (void) #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - yyss = yyss1; - yyvs = yyvs1; + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -1198,22 +1394,23 @@ yyparse (void) # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1221,18 +1418,16 @@ yyparse (void) yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; + YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) - YYACCEPT; - goto yybackup; /*-----------. @@ -1241,20 +1436,20 @@ yyparse (void) yybackup: /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ + look-ahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) + if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = yylex (); + yychar = YYLEX; } if (yychar <= YYEOF) @@ -1276,27 +1471,29 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yytable_value_is_error (yyn)) - goto yyerrlab; + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; yyn = -yyn; goto yyreduce; } + if (yyn == YYFINAL) + YYACCEPT; + /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the lookahead token. */ + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token. */ - yychar = YYEMPTY; + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1319,7 +1516,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. + `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1332,281 +1529,355 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: -#line 78 "analyse_syntaxique.y" /* yacc.c:1646 */ - {} -#line 1339 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ + case 5: +#line 89 "analyse_syntaxique.y" + {add_function(&table_fonctions, "Main", RET_INT, array.index); table.depth++;;} break; - case 3: -#line 80 "analyse_syntaxique.y" /* yacc.c:1646 */ - {printf("Sans params\n");} -#line 1345 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ + case 6: +#line 89 "analyse_syntaxique.y" + {print_table(&table);remove_symboles(&table); table.depth--;;} break; - case 5: -#line 83 "analyse_syntaxique.y" /* yacc.c:1646 */ - {printf("Parametre : %s\n", (yyvsp[0].id));} -#line 1351 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ + case 7: +#line 90 "analyse_syntaxique.y" + {{add_function(&table_fonctions, (yyvsp[(2) - (2)].id), return_type, array.index); table.depth++;};} break; case 8: -#line 90 "analyse_syntaxique.y" /* yacc.c:1646 */ - {printf("Dans body\n");} -#line 1357 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 90 "analyse_syntaxique.y" + {generate_instruction_0(&array, RET_FUN); print_table(&table);remove_symboles(&table); table.depth--;;} + break; + + case 9: +#line 92 "analyse_syntaxique.y" + {type = TYPE_INT;;} + break; + + case 10: +#line 93 "analyse_syntaxique.y" + {type = TYPE_INT_PTR;;} + break; + + case 11: +#line 95 "analyse_syntaxique.y" + {;} + break; + + case 13: +#line 98 "analyse_syntaxique.y" + {add_symbole_top(&table, (yyvsp[(2) - (2)].id), type, INITIALISED, table.depth);;} + break; + + case 14: +#line 100 "analyse_syntaxique.y" + {type = TYPE_INT;;} + break; + + case 15: +#line 101 "analyse_syntaxique.y" + {type = TYPE_INT_PTR;;} + break; + + case 18: +#line 107 "analyse_syntaxique.y" + {;} + break; + + case 19: +#line 109 "analyse_syntaxique.y" + {(yyval.nombre) = array.index;;} break; case 20: -#line 107 "analyse_syntaxique.y" /* yacc.c:1646 */ - {type = TYPE_INT;} -#line 1363 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ - break; - - case 21: -#line 108 "analyse_syntaxique.y" /* yacc.c:1646 */ - {type = TYPE_CONST_INT;} -#line 1369 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ - break; - - case 22: -#line 110 "analyse_syntaxique.y" /* yacc.c:1646 */ - {add_symbole_top(&table, (yyvsp[0].id), type, INITIALISED, table.depth);} -#line 1375 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ - break; - - case 23: -#line 110 "analyse_syntaxique.y" /* yacc.c:1646 */ - {int varAddr = variable_exists(&table, (yyvsp[-3].id)); generate_instruction_2(&array, COP, (yyvsp[0].nombre), varAddr); free_temp(&table);} -#line 1381 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ - break; - - case 24: -#line 111 "analyse_syntaxique.y" /* yacc.c:1646 */ - {add_symbole_top(&table, (yyvsp[0].id), type, NOT_INITIALISED, table.depth);} -#line 1387 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ - break; - - case 25: -#line 114 "analyse_syntaxique.y" /* yacc.c:1646 */ - {int varAddr = variable_exists(&table, (yyvsp[-3].id)); generate_instruction_2(&array, COP, (yyvsp[-1].nombre), varAddr); free_temp(&table);} -#line 1393 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ - break; - - case 26: -#line 117 "analyse_syntaxique.y" /* yacc.c:1646 */ - {int vt = new_temp(&table); generate_instruction_2(&array, AFC, vt, (yyvsp[0].nombre)); (yyval.nombre) = vt;} -#line 1399 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ - break; - - case 27: -#line 119 "analyse_syntaxique.y" /* yacc.c:1646 */ - {int vt = new_temp(&table); int varAddr = variable_exists(&table, (yyvsp[0].id)); generate_instruction_2(&array, COP, varAddr, vt); (yyval.nombre) = vt;} -#line 1405 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ - break; - - case 28: -#line 121 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_3(&array, ADD, (yyvsp[-2].nombre), (yyvsp[-2].nombre), (yyvsp[0].nombre)); free_temp(&table); (yyval.nombre) = (yyvsp[-2].nombre);} -#line 1411 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ - break; - - case 29: -#line 122 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_3(&array, MUL, (yyvsp[-2].nombre), (yyvsp[-2].nombre), (yyvsp[0].nombre)); free_temp(&table); (yyval.nombre) = (yyvsp[-2].nombre);} -#line 1417 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 110 "analyse_syntaxique.y" + {(yyval.nombre) = array.index;;} break; case 30: -#line 123 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_3(&array, SOU, (yyvsp[-2].nombre), (yyvsp[-2].nombre), (yyvsp[0].nombre)); free_temp(&table); (yyval.nombre) = (yyvsp[-2].nombre);} -#line 1423 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 124 "analyse_syntaxique.y" + {type = TYPE_INT;;} break; case 31: -#line 124 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_3(&array, DIV, (yyvsp[-2].nombre), (yyvsp[-2].nombre), (yyvsp[0].nombre)); free_temp(&table); (yyval.nombre) = (yyvsp[-2].nombre);} -#line 1429 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 125 "analyse_syntaxique.y" + {type = TYPE_CONST_INT;;} break; case 32: -#line 125 "analyse_syntaxique.y" /* yacc.c:1646 */ - {printf("Variable negative\n");} -#line 1435 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 126 "analyse_syntaxique.y" + {type = TYPE_INT_PTR;;} break; case 33: -#line 126 "analyse_syntaxique.y" /* yacc.c:1646 */ - {(yyval.nombre) = 1234;} -#line 1441 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 128 "analyse_syntaxique.y" + {add_symbole_top(&table, (yyvsp[(1) - (1)].id), type, INITIALISED, table.depth);;} break; case 34: -#line 127 "analyse_syntaxique.y" /* yacc.c:1646 */ - {printf("Parenthèse\n"); (yyval.nombre) = (yyvsp[-1].nombre); } -#line 1447 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 128 "analyse_syntaxique.y" + {int varAddr = variable_exists(&table, (yyvsp[(1) - (4)].id)); generate_instruction_2(&array, COP, varAddr, (yyvsp[(4) - (4)].nombre)); free_temp(&table);;} + break; + + case 35: +#line 129 "analyse_syntaxique.y" + {add_symbole_top(&table, (yyvsp[(1) - (1)].id), type, NOT_INITIALISED, table.depth);;} + break; + + case 36: +#line 132 "analyse_syntaxique.y" + {int varAddr = variable_exists(&table, (yyvsp[(1) - (4)].id)); generate_instruction_2(&array, COP, varAddr, (yyvsp[(3) - (4)].nombre)); free_temp(&table);;} + break; + + case 37: +#line 133 "analyse_syntaxique.y" + {int varAddr = variable_exists(&table, (yyvsp[(2) - (5)].id)); generate_instruction_2(&array, COP_STR, varAddr, (yyvsp[(4) - (5)].nombre)); free_temp(&table);;} + break; + + case 38: +#line 136 "analyse_syntaxique.y" + {int vt = new_temp(&table); generate_instruction_2(&array, AFC, vt, (yyvsp[(1) - (1)].nombre)); (yyval.nombre) = vt;;} break; case 39: -#line 136 "analyse_syntaxique.y" /* yacc.c:1646 */ - { - //gen_jmpf(&table, &array, $3, -1); - generate_instruction_2(&array, JMF, (yyvsp[-1].nombre), -1); - free_temp(&table); - (yyvsp[-3].nombre) = array.index; -} -#line 1458 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 137 "analyse_syntaxique.y" + {int vt = new_temp(&table); int varAddr = variable_exists(&table, (yyvsp[(1) - (1)].id)); generate_instruction_2(&array, COP, vt, varAddr); (yyval.nombre) = vt;;} break; case 40: -#line 143 "analyse_syntaxique.y" /* yacc.c:1646 */ - { - int adr_jmp = array.index; - update_jmf(&array, (yyvsp[-7].nombre), adr_jmp); -} -#line 1467 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 138 "analyse_syntaxique.y" + {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);;} break; case 41: -#line 147 "analyse_syntaxique.y" /* yacc.c:1646 */ - {} -#line 1473 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 139 "analyse_syntaxique.y" + {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);;} break; case 42: -#line 149 "analyse_syntaxique.y" /* yacc.c:1646 */ - {printf("else\n");} -#line 1479 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 140 "analyse_syntaxique.y" + {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);;} + break; + + case 43: +#line 141 "analyse_syntaxique.y" + {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);;} break; case 44: -#line 151 "analyse_syntaxique.y" /* yacc.c:1646 */ - {printf("elsif\n");} -#line 1485 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 142 "analyse_syntaxique.y" + {printf("Variable negative\n");;} break; case 45: -#line 153 "analyse_syntaxique.y" /* yacc.c:1646 */ +#line 143 "analyse_syntaxique.y" { - (yyvsp[0].nombre) = array.index ; -} -#line 1493 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ + int vt = new_temp(&table); + generate_instruction_2(&array, COP, vt, (yyvsp[(1) - (1)].nombre)); + remove_symboles(&table); + table.depth--; + (yyval.nombre) = vt;;} break; case 46: -#line 155 "analyse_syntaxique.y" /* yacc.c:1646 */ - { - //gen_jmpf(&table, &array, $4, -1); - generate_instruction_2(&array, JMF, (yyvsp[-1].nombre), -1); - free_temp(&table); - (yyvsp[-4].nombre) = array.index; -} -#line 1504 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 149 "analyse_syntaxique.y" + {printf("Parenthèse\n"); (yyval.nombre) = (yyvsp[(2) - (3)].nombre); ;} break; case 47: -#line 161 "analyse_syntaxique.y" /* yacc.c:1646 */ - { - int adr_jmp = array.index; - update_jmf(&array, (yyvsp[-8].nombre), adr_jmp); - //gen_jmpf(&table, &array, $1, $2); - generate_instruction_1(&array, JMP, (yyvsp[-7].nombre)); -} -#line 1515 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 150 "analyse_syntaxique.y" + {int vt = new_temp(&table); int varAddr = variable_exists(&table, (yyvsp[(2) - (2)].id)); generate_instruction_2(&array, LEA, vt, varAddr); (yyval.nombre) = vt;;} break; case 48: -#line 169 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_3(&array, EQ, (yyvsp[-2].nombre), (yyvsp[-2].nombre), (yyvsp[0].nombre)); free_temp(&table); (yyval.nombre) = (yyvsp[0].nombre);} -#line 1521 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 151 "analyse_syntaxique.y" + {int vt = new_temp(&table); int varAddr = variable_exists(&table, (yyvsp[(2) - (2)].id)); generate_instruction_2(&array, COP, vt, varAddr); generate_instruction_2(&array, COP_LD, vt, vt); (yyval.nombre) = vt;;} break; case 49: -#line 170 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_3(&array, NEQ, (yyvsp[-2].nombre), (yyvsp[-2].nombre), (yyvsp[0].nombre)); free_temp(&table); (yyval.nombre) = (yyvsp[0].nombre);} -#line 1527 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 154 "analyse_syntaxique.y" + { + //gen_jmpf(&table, &array, $3, -1); + generate_instruction_2(&array, JMF, (yyvsp[(3) - (4)].nombre), -1); + free_temp(&table); + (yyvsp[(1) - (4)].nombre) = array.index; +;} break; case 50: -#line 171 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_3(&array, LT, (yyvsp[-2].nombre), (yyvsp[-2].nombre), (yyvsp[0].nombre)); free_temp(&table); (yyval.nombre) = (yyvsp[0].nombre);} -#line 1533 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 160 "analyse_syntaxique.y" + {table.depth++;;} break; case 51: -#line 172 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_3(&array, GT, (yyvsp[-2].nombre), (yyvsp[-2].nombre), (yyvsp[0].nombre)); free_temp(&table); (yyval.nombre) = (yyvsp[0].nombre);} -#line 1539 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 160 "analyse_syntaxique.y" + {generate_instruction_1(&array, JMP, -1);} break; case 52: -#line 173 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_3(&array, LTE, (yyvsp[-2].nombre), (yyvsp[-2].nombre), (yyvsp[0].nombre)); free_temp(&table); (yyval.nombre) = (yyvsp[0].nombre);} -#line 1545 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 160 "analyse_syntaxique.y" + {remove_symboles(&table); table.depth--;;} break; case 53: -#line 174 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_3(&array, GTE, (yyvsp[-2].nombre), (yyvsp[-2].nombre), (yyvsp[0].nombre)); free_temp(&table); (yyval.nombre) = (yyvsp[0].nombre);} -#line 1551 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 161 "analyse_syntaxique.y" + { + int adr_jmp = array.index; + update_jmf(&array, (yyvsp[(1) - (11)].nombre), adr_jmp); +;} break; case 54: -#line 175 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_3(&array, AND, (yyvsp[-2].nombre), (yyvsp[-2].nombre), (yyvsp[0].nombre)); free_temp(&table); (yyval.nombre) = (yyvsp[0].nombre);} -#line 1557 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 165 "analyse_syntaxique.y" + {printf("updating jump\n"); update_jmp(&array, (yyvsp[(8) - (13)].nombre), (yyvsp[(13) - (13)].nombre));;} break; case 55: -#line 176 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_3(&array, OR, (yyvsp[-2].nombre), (yyvsp[-2].nombre), (yyvsp[0].nombre)); free_temp(&table); (yyval.nombre) = (yyvsp[0].nombre);} -#line 1563 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 167 "analyse_syntaxique.y" + {table.depth++;;} break; case 56: -#line 177 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_2(&array, NOT, (yyvsp[0].nombre), (yyvsp[0].nombre)); (yyval.nombre) = (yyvsp[0].nombre);} -#line 1569 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 167 "analyse_syntaxique.y" + {remove_symboles(&table); table.depth--;;} break; case 57: -#line 178 "analyse_syntaxique.y" /* yacc.c:1646 */ - {(yyval.nombre) = (yyvsp[0].nombre); } -#line 1575 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 167 "analyse_syntaxique.y" + {(yyval.nombre) = array.index;;} break; case 58: -#line 183 "analyse_syntaxique.y" /* yacc.c:1646 */ - {printf("Dans invocation\n");} -#line 1581 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 168 "analyse_syntaxique.y" + {(yyval.nombre) = array.index;;} break; case 59: -#line 186 "analyse_syntaxique.y" /* yacc.c:1646 */ - {generate_instruction_1(&array, PRI, (yyvsp[-2].nombre)); free_temp(&table);} -#line 1587 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 169 "analyse_syntaxique.y" + {(yyval.nombre) = array.index;;} break; case 60: -#line 189 "analyse_syntaxique.y" /* yacc.c:1646 */ - {(yyval.nombre) = generate_instruction_1(&array, RET, (yyvsp[-1].nombre)); free_temp(&table);} -#line 1593 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +#line 171 "analyse_syntaxique.y" + { + (yyvsp[(2) - (2)].nombre) = array.index ; +;} + break; + + case 61: +#line 173 "analyse_syntaxique.y" + { + //gen_jmpf(&table, &array, $4, -1); + generate_instruction_2(&array, JMF, (yyvsp[(4) - (5)].nombre), -1); + free_temp(&table); + (yyvsp[(1) - (5)].nombre) = array.index; +;} + break; + + case 62: +#line 179 "analyse_syntaxique.y" + {table.depth++;;} + break; + + case 63: +#line 179 "analyse_syntaxique.y" + {remove_symboles(&table); table.depth--;;} + break; + + case 64: +#line 179 "analyse_syntaxique.y" + { + int adr_jmp = array.index; + update_jmf(&array, (yyvsp[(1) - (11)].nombre), adr_jmp); + //gen_jmpf(&table, &array, $1, $2); + generate_instruction_1(&array, JMP, (yyvsp[(2) - (11)].nombre)); +;} + break; + + case 65: +#line 186 "analyse_syntaxique.y" + {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);;} + break; + + case 66: +#line 187 "analyse_syntaxique.y" + {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);;} + break; + + case 67: +#line 188 "analyse_syntaxique.y" + {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);;} + break; + + case 68: +#line 189 "analyse_syntaxique.y" + {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);;} + break; + + case 69: +#line 190 "analyse_syntaxique.y" + {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);;} + break; + + case 70: +#line 191 "analyse_syntaxique.y" + {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);;} + break; + + case 71: +#line 192 "analyse_syntaxique.y" + {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);;} + break; + + case 72: +#line 193 "analyse_syntaxique.y" + {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);;} + break; + + case 73: +#line 194 "analyse_syntaxique.y" + {generate_instruction_2(&array, NOT, (yyvsp[(2) - (2)].nombre), (yyvsp[(2) - (2)].nombre)); (yyval.nombre) = (yyvsp[(2) - (2)].nombre);;} + break; + + case 74: +#line 195 "analyse_syntaxique.y" + {(yyval.nombre) = (yyvsp[(1) - (1)].nombre); ;} + break; + + case 75: +#line 197 "analyse_syntaxique.y" + {table.depth++; prepare_function_call(&table); return_value = (table.indexAvailableTop - 1);;} + break; + + case 76: +#line 198 "analyse_syntaxique.y" + {int function_index = function_exists(&table_fonctions, (yyvsp[(1) - (5)].id)); + int jmp_addr = (table_fonctions.array[function_index]).start_addr; + generate_instruction_2(&array, CALL, jmp_addr, (array.index + 1)); + (yyval.nombre) = return_value; + ;} + break; + + case 79: +#line 206 "analyse_syntaxique.y" + {int arg_addr = prepare_argument_push(&table); generate_instruction_2(&array, COP, arg_addr, (yyvsp[(1) - (1)].nombre)); free_temp(&table);} + break; + + case 82: +#line 210 "analyse_syntaxique.y" + {generate_instruction_1(&array, PRI, (yyvsp[(3) - (5)].nombre)); free_temp(&table);;} + break; + + case 83: +#line 212 "analyse_syntaxique.y" + {(yyval.nombre) = generate_instruction_1(&array, RET, (yyvsp[(2) - (3)].nombre)); free_temp(&table);;} break; -#line 1597 "analyse_syntaxique.tab.c" /* yacc.c:1646 */ +/* Line 1267 of yacc.c. */ +#line 1879 "analyse_syntaxique.tab.c" default: break; } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -1615,7 +1886,8 @@ yyreduce: *++yyvsp = yyval; - /* Now 'shift' the result of the reduction. Determine what state + + /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1630,14 +1902,10 @@ yyreduce: goto yynewstate; -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -1645,36 +1913,37 @@ yyerrlab: #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } } -# undef YYSYNTAX_ERROR #endif } @@ -1682,24 +1951,24 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -1715,7 +1984,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule whose action triggered + /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -1728,37 +1997,38 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + if (yyn == YYFINAL) + YYACCEPT; + *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -1782,7 +2052,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined yyoverflow || YYERROR_VERBOSE +#ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1793,22 +2063,17 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - } - /* Do not reclaim the symbols of the rule whose action triggered + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -1819,19 +2084,27 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - return yyresult; + /* Make sure YYID is used. */ + return YYID (yyresult); } -#line 191 "analyse_syntaxique.y" /* yacc.c:1906 */ + + +#line 214 "analyse_syntaxique.y" #include void main(void){ //TODO: rajouter gestion des erreurs initialise_table(&table); + initialise_function_table(&table_fonctions); initialise_asm(&array); yyparse(); print_table(&table); + printf("\n"); + print_fonction_table(&table_fonctions); + //remove_symboles(&table, 0); //print_table(&table); exportInstructions(&array); } + diff --git a/analyse_syntaxique.tab.h b/analyse_syntaxique.tab.h index dd14b4a..5f12a7d 100644 --- a/analyse_syntaxique.tab.h +++ b/analyse_syntaxique.tab.h @@ -1,13 +1,14 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Bison interface for Yacc-like parsers in C +/* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + the Free Software Foundation; either version 2, or (at your option) + any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,7 +16,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -30,77 +33,99 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -#ifndef YY_YY_ANALYSE_SYNTAXIQUE_TAB_H_INCLUDED -# define YY_YY_ANALYSE_SYNTAXIQUE_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -#if YYDEBUG -extern int yydebug; -#endif - -/* Token type. */ +/* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - enum yytokentype - { - tENTIER = 258, - tENTIEREXP = 259, - tADD = 260, - tSUB = 261, - tMUL = 262, - tDIV = 263, - tPO = 264, - tPF = 265, - tAO = 266, - tAF = 267, - tERROR = 268, - tPV = 269, - tVIRGULE = 270, - tAFFECTATION = 271, - tEGAL = 272, - tDIFF = 273, - tLT = 274, - tGT = 275, - tGTE = 276, - tLTE = 277, - tMAIN = 278, - tINT = 279, - tPRINT = 280, - tRETURN = 281, - tOR = 282, - tAND = 283, - tIF = 284, - tELSE = 285, - tWHILE = 286, - tCONST = 287, - tVAR = 288, - tNOT = 289 - }; + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + tENTIER = 258, + tENTIEREXP = 259, + tADD = 260, + tSUB = 261, + tMUL = 262, + tDIV = 263, + tPO = 264, + tPF = 265, + tAO = 266, + tAF = 267, + tERROR = 268, + tAPPERSAND = 269, + tPV = 270, + tVIRGULE = 271, + tAFFECTATION = 272, + tEGAL = 273, + tDIFF = 274, + tLT = 275, + tGT = 276, + tGTE = 277, + tLTE = 278, + tMAIN = 279, + tINT = 280, + tPRINT = 281, + tRETURN = 282, + tOR = 283, + tAND = 284, + tIF = 285, + tELSE = 286, + tWHILE = 287, + tCONST = 288, + tVAR = 289, + tNOT = 290 + }; #endif +/* Tokens. */ +#define tENTIER 258 +#define tENTIEREXP 259 +#define tADD 260 +#define tSUB 261 +#define tMUL 262 +#define tDIV 263 +#define tPO 264 +#define tPF 265 +#define tAO 266 +#define tAF 267 +#define tERROR 268 +#define tAPPERSAND 269 +#define tPV 270 +#define tVIRGULE 271 +#define tAFFECTATION 272 +#define tEGAL 273 +#define tDIFF 274 +#define tLT 275 +#define tGT 276 +#define tGTE 277 +#define tLTE 278 +#define tMAIN 279 +#define tINT 280 +#define tPRINT 281 +#define tRETURN 282 +#define tOR 283 +#define tAND 284 +#define tIF 285 +#define tELSE 286 +#define tWHILE 287 +#define tCONST 288 +#define tVAR 289 +#define tNOT 290 + + + -/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - -union YYSTYPE +typedef union YYSTYPE +#line 1 "analyse_syntaxique.y" { -#line 1 "analyse_syntaxique.y" /* yacc.c:1909 */ - int nombre; char id[30]; - -#line 94 "analyse_syntaxique.tab.h" /* yacc.c:1909 */ -}; - -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 +} +/* Line 1529 of yacc.c. */ +#line 124 "analyse_syntaxique.tab.h" + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif - extern YYSTYPE yylval; -int yyparse (void); - -#endif /* !YY_YY_ANALYSE_SYNTAXIQUE_TAB_H_INCLUDED */ diff --git a/analyse_syntaxique.y b/analyse_syntaxique.y index 4473a35..71f4f67 100644 --- a/analyse_syntaxique.y +++ b/analyse_syntaxique.y @@ -6,13 +6,17 @@ char id[30]; %{ #include #include "table_symboles.h" +#include "table_fonctions.h" #include "gen_assembleur.h" enum Initialised_Variable init; enum Symbole_Type type; +enum Return_Type return_type; Table_Symboles table; +Table_Fonctions table_fonctions; instructions_array array; int whileCondition; +int return_value; %} @@ -20,10 +24,9 @@ int whileCondition; %token tENTIEREXP %type E -%type Return +%type Return Instructions %type Cond -%type While - +%type While Else Invocation %token tADD @@ -38,6 +41,7 @@ int whileCondition; %token tERROR +%token tAPPERSAND %token tPV %token tVIRGULE %token tAFFECTATION @@ -69,28 +73,41 @@ int whileCondition; %% -//C : Fonctions Main ; +/*C : Fonctions Main ; -//Fonctions : Fonction Fonctions | ; -//Fonction : tINT tVAR tPO Params tPF Body; +Fonctions : ; +Fonctions : Fonction Fonctions ; + +Fonction : tINT tVAR tPO Params tPF Body;*/ + +C : Fonctions; + +Fonctions: Main; +Fonctions: Fonction Fonctions; -Main : tINT tMAIN tPO Params tPF Body {}; +Main : tINT tMAIN {add_function(&table_fonctions, "Main", RET_INT, array.index); table.depth++;} tPO Params tPF Body {print_table(&table);remove_symboles(&table); table.depth--;}; +Fonction : Function_type tVAR {{add_function(&table_fonctions, $2, return_type, array.index); table.depth++;}} tPO Params tPF Body {generate_instruction_0(&array, RET_FUN); print_table(&table);remove_symboles(&table); table.depth--;}; -Params : {printf("Sans params\n");} ; +Function_type: tINT {type = TYPE_INT;} ; +Function_type: tINT tMUL {type = TYPE_INT_PTR;}; + +Params : {} ; Params : Param SuiteParams ; -Param : tINT tVAR {printf("Parametre : %s\n", $2);} ; +Param : Param_type tVAR {add_symbole_top(&table, $2, type, INITIALISED, table.depth);} ; +Param_type: tINT {type = TYPE_INT;} ; +Param_type: tINT tMUL {type = TYPE_INT_PTR;}; -SuiteParams : tVIRGULE Param SuiteParams tPV ; +SuiteParams : tVIRGULE Param SuiteParams ; SuiteParams : ; -Body : tAO Instructions Return tAF {printf("Dans body\n");} ; +Body : tAO Instructions Return tAF {} ; -Instructions : Instruction Instructions ; -Instructions : ; +Instructions : Instruction Instructions {$$ = array.index;}; +Instructions : {$$ = array.index;}; Instruction : Aff ; Instruction : If ; @@ -104,51 +121,52 @@ Decl : Type Valeur SuiteDecl tPV ; SuiteDecl: tVIRGULE Valeur SuiteDecl ; SuiteDecl: ; -Type : tINT {type = TYPE_INT;} ; +Type : tINT {type = TYPE_INT;} ; Type : tCONST tINT {type = TYPE_CONST_INT;} ; +Type : tINT tMUL {type = TYPE_INT_PTR;}; -Valeur : tVAR {add_symbole_top(&table, $1, type, INITIALISED, table.depth);} tAFFECTATION E {int varAddr = variable_exists(&table, $1); generate_instruction_2(&array, COP, $4, varAddr); free_temp(&table);}; +Valeur : tVAR {add_symbole_top(&table, $1, type, INITIALISED, table.depth);} tAFFECTATION E {int varAddr = variable_exists(&table, $1); generate_instruction_2(&array, COP, varAddr, $4); free_temp(&table);}; Valeur : tVAR {add_symbole_top(&table, $1, type, NOT_INITIALISED, table.depth);}; -Aff : tVAR tAFFECTATION E tPV {int varAddr = variable_exists(&table, $1); generate_instruction_2(&array, COP, $3, varAddr); free_temp(&table);}; +Aff : tVAR tAFFECTATION E tPV {int varAddr = variable_exists(&table, $1); generate_instruction_2(&array, COP, varAddr, $3); free_temp(&table);}; +Aff : tMUL tVAR tAFFECTATION E tPV {int varAddr = variable_exists(&table, $2); generate_instruction_2(&array, COP_STR, varAddr, $4); free_temp(&table);}; + -//E : tENTIER {int vt = gen_entier(&table, &array, $1); $$ = vt;}; E : tENTIER {int vt = new_temp(&table); generate_instruction_2(&array, AFC, vt, $1); $$ = vt;}; -//E : tVAR {int vt = gen_var(&table, &array, $1); $$ = vt;}; -E : tVAR {int vt = new_temp(&table); int varAddr = variable_exists(&table, $1); generate_instruction_2(&array, COP, varAddr, vt); $$ = vt;}; -//E : E tADD E {gen_arithmetique(&array, ADD, $1, $3); free_temp(&table); $$ = $1;} ; +E : tVAR {int vt = new_temp(&table); int varAddr = variable_exists(&table, $1); generate_instruction_2(&array, COP, vt, varAddr); $$ = vt;}; E : E tADD E {generate_instruction_3(&array, ADD, $1, $1, $3); free_temp(&table); $$ = $1;} ; E : E tMUL E {generate_instruction_3(&array, MUL, $1, $1, $3); free_temp(&table); $$ = $1;} ; E : E tSUB E {generate_instruction_3(&array, SOU, $1, $1, $3); free_temp(&table); $$ = $1;} ; E : E tDIV E {generate_instruction_3(&array, DIV, $1, $1, $3); free_temp(&table); $$ = $1;} ; E : tSUB E {printf("Variable negative\n");} ; -E : Invocation {$$ = 1234;}; +E : Invocation { + int vt = new_temp(&table); + generate_instruction_2(&array, COP, vt, $1); + remove_symboles(&table); + table.depth--; + $$ = vt;}; E : tPO E tPF {printf("Parenthèse\n"); $$ = $2; } ; +E : tAPPERSAND tVAR {int vt = new_temp(&table); int varAddr = variable_exists(&table, $2); generate_instruction_2(&array, LEA, vt, varAddr); $$ = vt;}; +E : tMUL tVAR {int vt = new_temp(&table); int varAddr = variable_exists(&table, $2); generate_instruction_2(&array, COP, vt, varAddr); generate_instruction_2(&array, COP_LD, vt, vt); $$ = vt;}; -Args : tVAR SuiteArgs ; -Args : ; - -SuiteArgs : tVIRGULE tVAR SuiteArgs ; -SuiteArgs : ; - If : tIF tPO Cond tPF { //gen_jmpf(&table, &array, $3, -1); generate_instruction_2(&array, JMF, $3, -1); free_temp(&table); $1 = array.index; } -tAO Instructions tAF +tAO {table.depth++;} Instructions {generate_instruction_1(&array, JMP, -1)} tAF {remove_symboles(&table); table.depth--;} { int adr_jmp = array.index; update_jmf(&array, $1, adr_jmp); } -Else {}; +Else {printf("updating jump\n"); update_jmp(&array, $8, $13);}; -Else : tELSE tAO Instructions tAF {printf("else\n");} ; -Else : ; -Else : tELSE tIF tPO Cond tPF tAO Instructions tAF Else {printf("elsif\n");} ; +Else : tELSE tAO {table.depth++;} Instructions tAF {remove_symboles(&table); table.depth--;} {$$ = array.index;} ; +Else : {$$ = array.index;}; +Else : tELSE If {$$ = array.index;} ; While : tWHILE tPO { $2 = array.index ; @@ -158,14 +176,13 @@ While : tWHILE tPO { free_temp(&table); $1 = array.index; } -tAO Instructions tAF { +tAO {table.depth++;} Instructions tAF {remove_symboles(&table); table.depth--;} { int adr_jmp = array.index; update_jmf(&array, $1, adr_jmp); //gen_jmpf(&table, &array, $1, $2); generate_instruction_1(&array, JMP, $2); }; -//Cond : E tEGAL E {int vt = gen_condition(&table, &array, EQ, $1, $3); $$ = vt;} ; Cond : E tEGAL E {generate_instruction_3(&array, EQ, $1, $1, $3); free_temp(&table); $$ = $3;}; Cond : E tDIFF E {generate_instruction_3(&array, NEQ, $1, $1, $3); free_temp(&table); $$ = $3;} ; Cond : E tLT E {generate_instruction_3(&array, LT, $1, $1, $3); free_temp(&table); $$ = $3;} ; @@ -177,15 +194,21 @@ Cond : E tOR E {generate_instruction_3(&array, OR, $1, $1, $3); free_temp(&table Cond : tNOT Cond {generate_instruction_2(&array, NOT, $2, $2); $$ = $2;} ; Cond : E {$$ = $1; }; +Invocation : tVAR tPO {table.depth++; prepare_function_call(&table); return_value = (table.indexAvailableTop - 1);} Args tPF + {int function_index = function_exists(&table_fonctions, $1); + int jmp_addr = (table_fonctions.array[function_index]).start_addr; + generate_instruction_2(&array, CALL, jmp_addr, (array.index + 1)); + $$ = return_value; + }; +Args : Arg SuiteArgs ; +Args : +Arg : E {int arg_addr = prepare_argument_push(&table); generate_instruction_2(&array, COP, arg_addr, $1); free_temp(&table)}; +SuiteArgs : tVIRGULE Arg SuiteArgs ; +SuiteArgs : ; - -Invocation : tVAR tPO Args tPF {printf("Dans invocation\n");}; - -//Print : tPRINT tPO E tPF tPV {gen_print(&table, &array, $3);}; Print : tPRINT tPO E tPF tPV {generate_instruction_1(&array, PRI, $3); free_temp(&table);}; -//Return : tRETURN E tPV {$$ = gen_return(&table, &array, $2);}; Return : tRETURN E tPV {$$ = generate_instruction_1(&array, RET, $2); free_temp(&table);}; %% @@ -193,9 +216,13 @@ Return : tRETURN E tPV {$$ = generate_instruction_1(&array, RET, $2); free_temp( void main(void){ //TODO: rajouter gestion des erreurs initialise_table(&table); + initialise_function_table(&table_fonctions); initialise_asm(&array); yyparse(); print_table(&table); + printf("\n"); + print_fonction_table(&table_fonctions); + //remove_symboles(&table, 0); //print_table(&table); exportInstructions(&array); diff --git a/gen_assembleur.c b/gen_assembleur.c index de1e83e..7d32bff 100644 --- a/gen_assembleur.c +++ b/gen_assembleur.c @@ -33,7 +33,7 @@ char * operationName(enum operation op){ case JMF: return "JPF"; case JMP: - return "JPM"; + return "JMP"; case AND: return "AND"; case OR: @@ -42,6 +42,16 @@ char * operationName(enum operation op){ return "NOT"; case PRI: return "PRI"; + case LEA: + return "LEA"; + case COP_LD: + return "COP_LD"; + case COP_STR: + return "COP_STR"; + case RET_FUN: + return "RET_FUN"; + case CALL: + return "CALL"; default: break; } @@ -71,6 +81,22 @@ int new_temp(Table_Symboles * table){ return ret_addr; } +int generate_instruction_0(instructions_array * array, enum operation op){ + instruction instru; + char * opName = operationName(op); + + instru.operation = op; + + printf("%d\t %s\n", array->index, opName); + + if (add_instruction(array, &instru) != 0){ + //TODO: Error handling + exit(1); + } + + return 0; +} + int generate_instruction_1(instructions_array * array, enum operation op, int arg1){ instruction instru; char * opName = operationName(op); @@ -130,6 +156,11 @@ void update_jmf(instructions_array * array, int instru_index, int adr_jmp){ printf("%d\t JMP %d %d\n", (instru_index - 1), array->array[instru_index].reg1, array->array[instru_index].reg2); } +void update_jmp(instructions_array * array, int instru_index, int adr_jmp){ + array->array[instru_index].reg1 = adr_jmp; + printf("%d\t JMP %d\n", (instru_index - 1), array->array[instru_index].reg1); +} + void exportInstructions(instructions_array * array){ FILE *file; file = fopen("instructions.txt", "w"); @@ -140,6 +171,10 @@ void exportInstructions(instructions_array * array){ instru = array->array[i]; op = instru.operation; switch (op) { + //0 parameters + case RET_FUN: + fprintf(file, "%d\t %s\n", i, operationName(op)); + break; //1 parameter case JMP: case PRI: @@ -151,8 +186,16 @@ void exportInstructions(instructions_array * array){ case NOT: case AFC: case COP: + case LEA: + case CALL: fprintf(file, "%d\t %s %d %d\n", i, operationName(op), instru.reg1, instru.reg2); break; + case COP_LD: + fprintf(file, "%d\t %s %d [%d]\n", i, operationName(op), instru.reg1, instru.reg2); + break; + case COP_STR: + fprintf(file, "%d\t %s [%d] %d\n", i, operationName(op), instru.reg1, instru.reg2); + break; //3 parameters case ADD: case SOU: diff --git a/gen_assembleur.h b/gen_assembleur.h index 7a1172f..8028c89 100644 --- a/gen_assembleur.h +++ b/gen_assembleur.h @@ -5,7 +5,8 @@ #include "table_symboles.h" -enum operation{ADD, SOU, MUL, DIV, COP, AFC, RET, JMF, JMP, EQ, NEQ, LT, GT, LTE, GTE, AND, OR, NOT, PRI}; +enum operation{ADD, SOU, MUL, DIV, COP, AFC, RET, JMF, JMP, EQ, NEQ, LT, GT, LTE, + GTE, AND, OR, NOT, PRI, LEA, COP_LD, COP_STR, CALL, RET_FUN}; typedef struct instruction{ enum operation operation; @@ -49,6 +50,14 @@ int new_temp(Table_Symboles * table); */ int add_instruction(instructions_array * array, instruction * intru); +/** + * Generates intruction with no parameter + * @param array + * @param op + * @return + */ +int generate_instruction_0(instructions_array * array, enum operation op); + /** * Generates intruction with one parameter * @param array @@ -87,6 +96,7 @@ int generate_instruction_3(instructions_array * array, enum operation op, int ar */ void update_jmf(instructions_array * array, int instru_index, int adr_jmp); +void update_jmp(instructions_array * array, int instru_index, int adr_jmp); diff --git a/instructions.txt b/instructions.txt index 2716664..ce1db7c 100644 --- a/instructions.txt +++ b/instructions.txt @@ -1,22 +1,11 @@ -0 AFC 49 1 -1 COP 49 0 -2 AFC 49 2 -3 COP 49 1 +0 AFC 49 2 +1 COP 0 49 +2 LEA 49 0 +3 COP 1 49 4 AFC 49 2 -5 AFC 48 3 -6 ADD 49 49 48 -7 COP 49 1 -8 COP 1 49 -9 NOT 49 49 -10 JPF 49 15 -11 AFC 49 1 -12 COP 49 1 -13 AFC 49 4 -14 COP 49 2 -15 AFC 49 4 -16 AFC 48 2 -17 COP 48 0 -18 COP 1 48 -19 PRI 48 -20 AFC 48 5 -21 RET 48 +5 COP_STR [1] 49 +6 COP 49 1 +7 COP_LD 49 [49] +8 COP 2 49 +9 AFC 49 0 +10 RET 49 diff --git a/lex.yy.c b/lex.yy.c index e880035..1beb0b1 100644 --- a/lex.yy.c +++ b/lex.yy.c @@ -7,8 +7,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 4 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -46,6 +46,7 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; +typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -53,6 +54,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -83,61 +85,63 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) -#endif - -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ -/* begin standard C++ headers. */ +#ifdef __cplusplus -/* TODO: this is always defined, so inline it */ +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST #define yyconst const - -#if defined(__GNUC__) && __GNUC__ >= 3 -#define yynoreturn __attribute__((__noreturn__)) #else -#define yynoreturn +#define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an - * integer in range [0..255] for use as an array index. +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. */ -#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * + /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START + /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) +#define YY_NEW_FILE yyrestart(yyin ) + #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -154,16 +158,15 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern int yyleng; +extern yy_size_t yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) - #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -178,6 +181,7 @@ extern FILE *yyin, *yyout; YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) + #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -192,12 +196,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - int yy_buf_size; + yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -220,7 +224,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -248,7 +252,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -259,6 +263,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) + /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ @@ -266,11 +271,11 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = NULL; +static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ @@ -279,80 +284,84 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void yyrestart ( FILE *input_file ); -void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); -void yy_delete_buffer ( YY_BUFFER_STATE b ); -void yy_flush_buffer ( YY_BUFFER_STATE b ); -void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state ( void ); +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); -static void yyensure_buffer_stack ( void ); -static void yy_load_buffer_state ( void ); -static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); -#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); -YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); -YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) -void *yyalloc ( yy_size_t ); -void *yyrealloc ( void *, yy_size_t ); -void yyfree ( void * ); +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); #define yy_new_buffer yy_create_buffer + #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } + #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } + #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -typedef flex_uint8_t YY_CHAR; -FILE *yyin = NULL, *yyout = NULL; +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern int yylineno; + int yylineno = 1; extern char *yytext; -#ifdef yytext_ptr -#undef yytext_ptr -#endif #define yytext_ptr yytext -static yy_state_type yy_get_previous_state ( void ); -static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); -static int yy_get_next_buffer ( void ); -static void yynoreturn yy_fatal_error ( const char* msg ); +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ + yyleng = (yy_size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 34 -#define YY_END_OF_BUFFER 35 + +#define YY_NUM_RULES 35 +#define YY_END_OF_BUFFER 36 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -360,18 +369,18 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[70] = +static yyconst flex_int16_t yy_accept[70] = { 0, - 0, 0, 35, 34, 10, 11, 20, 34, 5, 6, - 3, 1, 12, 2, 4, 31, 9, 16, 13, 17, - 33, 33, 33, 33, 33, 33, 33, 33, 7, 34, - 8, 15, 26, 31, 33, 33, 18, 14, 19, 33, - 33, 27, 33, 33, 33, 33, 33, 25, 32, 33, - 33, 22, 33, 33, 33, 33, 33, 28, 21, 33, - 33, 33, 30, 33, 33, 29, 23, 24, 0 + 0, 0, 36, 35, 10, 11, 20, 30, 5, 6, + 3, 1, 12, 2, 4, 32, 9, 16, 13, 17, + 34, 34, 34, 34, 34, 34, 34, 34, 7, 35, + 8, 15, 26, 32, 34, 34, 18, 14, 19, 34, + 34, 27, 34, 34, 34, 34, 34, 25, 33, 34, + 34, 22, 34, 34, 34, 34, 34, 28, 21, 34, + 34, 34, 31, 34, 34, 29, 23, 24, 0 } ; -static const YY_CHAR yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -403,7 +412,7 @@ static const YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static const YY_CHAR yy_meta[39] = +static yyconst flex_int32_t yy_meta[39] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, @@ -411,7 +420,7 @@ static const YY_CHAR yy_meta[39] = 2, 2, 2, 2, 2, 1, 1, 1 } ; -static const flex_int16_t yy_base[71] = +static yyconst flex_int16_t yy_base[71] = { 0, 0, 0, 79, 80, 80, 80, 61, 71, 80, 80, 80, 80, 80, 80, 80, 25, 80, 59, 58, 57, @@ -422,7 +431,7 @@ static const flex_int16_t yy_base[71] = 17, 24, 0, 21, 15, 0, 0, 0, 80, 40 } ; -static const flex_int16_t yy_def[71] = +static yyconst flex_int16_t yy_def[71] = { 0, 69, 1, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 69, 69, 69, 69, @@ -433,7 +442,7 @@ static const flex_int16_t yy_def[71] = 70, 70, 70, 70, 70, 70, 70, 70, 0, 69 } ; -static const flex_int16_t yy_nxt[119] = +static yyconst flex_int16_t yy_nxt[119] = { 0, 4, 5, 6, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, @@ -450,7 +459,7 @@ static const flex_int16_t yy_nxt[119] = 69, 69, 69, 69, 69, 69, 69, 69 } ; -static const flex_int16_t yy_chk[119] = +static yyconst flex_int16_t yy_chk[119] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -488,8 +497,7 @@ int yywrap(void){ return 1; } -#line 492 "lex.yy.c" -#line 493 "lex.yy.c" +#line 501 "lex.yy.c" #define INITIAL 0 @@ -505,36 +513,36 @@ int yywrap(void){ #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals ( void ); +static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy ( void ); +int yylex_destroy (void ); -int yyget_debug ( void ); +int yyget_debug (void ); -void yyset_debug ( int debug_flag ); +void yyset_debug (int debug_flag ); -YY_EXTRA_TYPE yyget_extra ( void ); +YY_EXTRA_TYPE yyget_extra (void ); -void yyset_extra ( YY_EXTRA_TYPE user_defined ); +void yyset_extra (YY_EXTRA_TYPE user_defined ); -FILE *yyget_in ( void ); +FILE *yyget_in (void ); -void yyset_in ( FILE * _in_str ); +void yyset_in (FILE * in_str ); -FILE *yyget_out ( void ); +FILE *yyget_out (void ); -void yyset_out ( FILE * _out_str ); +void yyset_out (FILE * out_str ); - int yyget_leng ( void ); +yy_size_t yyget_leng (void ); -char *yyget_text ( void ); +char *yyget_text (void ); -int yyget_lineno ( void ); +int yyget_lineno (void ); -void yyset_lineno ( int _line_number ); +void yyset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -542,43 +550,35 @@ void yyset_lineno ( int _line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap ( void ); +extern "C" int yywrap (void ); #else -extern int yywrap ( void ); +extern int yywrap (void ); #endif #endif -#ifndef YY_NO_UNPUT + static void yyunput (int c,char *buf_ptr ); - static void yyunput ( int c, char *buf_ptr ); - -#endif - #ifndef yytext_ptr -static void yy_flex_strncpy ( char *, const char *, int ); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen ( const char * ); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT + #ifdef __cplusplus -static int yyinput ( void ); +static int yyinput (void ); #else -static int input ( void ); +static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -586,7 +586,7 @@ static int input ( void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -597,7 +597,7 @@ static int input ( void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - int n; \ + yy_size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -610,7 +610,7 @@ static int input ( void ); else \ { \ errno=0; \ - while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -665,7 +665,7 @@ extern int yylex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK /*LINTED*/break; +#define YY_BREAK break; #endif #define YY_RULE_SETUP \ @@ -675,10 +675,15 @@ extern int yylex (void); */ YY_DECL { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; +#line 54 "analyse_lexicale.lex" + + +#line 686 "lex.yy.c" + if ( !(yy_init) ) { (yy_init) = 1; @@ -699,19 +704,13 @@ YY_DECL if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); + yy_create_buffer(yyin,YY_BUF_SIZE ); } - yy_load_buffer_state( ); + yy_load_buffer_state( ); } - { -#line 53 "analyse_lexicale.lex" - - -#line 713 "lex.yy.c" - - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -727,7 +726,7 @@ YY_DECL yy_match: do { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -737,9 +736,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 70 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 80 ); @@ -768,176 +767,181 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 55 "analyse_lexicale.lex" +#line 56 "analyse_lexicale.lex" {return tADD ;} YY_BREAK case 2: YY_RULE_SETUP -#line 56 "analyse_lexicale.lex" +#line 57 "analyse_lexicale.lex" {return tSUB ;} YY_BREAK case 3: YY_RULE_SETUP -#line 57 "analyse_lexicale.lex" +#line 58 "analyse_lexicale.lex" {return tMUL ;} YY_BREAK case 4: YY_RULE_SETUP -#line 58 "analyse_lexicale.lex" +#line 59 "analyse_lexicale.lex" {return tDIV ;} YY_BREAK case 5: YY_RULE_SETUP -#line 60 "analyse_lexicale.lex" +#line 61 "analyse_lexicale.lex" {return tPO ;} YY_BREAK case 6: YY_RULE_SETUP -#line 61 "analyse_lexicale.lex" +#line 62 "analyse_lexicale.lex" {return tPF ;} YY_BREAK case 7: YY_RULE_SETUP -#line 62 "analyse_lexicale.lex" +#line 63 "analyse_lexicale.lex" {return tAO ;} YY_BREAK case 8: YY_RULE_SETUP -#line 63 "analyse_lexicale.lex" +#line 64 "analyse_lexicale.lex" {return tAF ;} YY_BREAK case 9: YY_RULE_SETUP -#line 65 "analyse_lexicale.lex" +#line 66 "analyse_lexicale.lex" {return tPV ;} YY_BREAK case 10: YY_RULE_SETUP -#line 66 "analyse_lexicale.lex" +#line 67 "analyse_lexicale.lex" {} YY_BREAK case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 67 "analyse_lexicale.lex" +#line 68 "analyse_lexicale.lex" {} YY_BREAK case 12: YY_RULE_SETUP -#line 68 "analyse_lexicale.lex" +#line 69 "analyse_lexicale.lex" {return tVIRGULE ;} YY_BREAK case 13: YY_RULE_SETUP -#line 70 "analyse_lexicale.lex" +#line 71 "analyse_lexicale.lex" {return tAFFECTATION ;} YY_BREAK case 14: YY_RULE_SETUP -#line 72 "analyse_lexicale.lex" +#line 73 "analyse_lexicale.lex" {return tEGAL ;} YY_BREAK case 15: YY_RULE_SETUP -#line 73 "analyse_lexicale.lex" +#line 74 "analyse_lexicale.lex" {return tDIFF ;} YY_BREAK case 16: YY_RULE_SETUP -#line 74 "analyse_lexicale.lex" +#line 75 "analyse_lexicale.lex" {return tLT ;} YY_BREAK case 17: YY_RULE_SETUP -#line 75 "analyse_lexicale.lex" +#line 76 "analyse_lexicale.lex" {return tGT ;} YY_BREAK case 18: YY_RULE_SETUP -#line 76 "analyse_lexicale.lex" +#line 77 "analyse_lexicale.lex" {return tLTE ;} YY_BREAK case 19: YY_RULE_SETUP -#line 77 "analyse_lexicale.lex" +#line 78 "analyse_lexicale.lex" {return tGTE ;} YY_BREAK case 20: YY_RULE_SETUP -#line 78 "analyse_lexicale.lex" +#line 79 "analyse_lexicale.lex" {return tNOT ;} YY_BREAK case 21: YY_RULE_SETUP -#line 81 "analyse_lexicale.lex" +#line 82 "analyse_lexicale.lex" {return tMAIN ;} YY_BREAK case 22: YY_RULE_SETUP -#line 82 "analyse_lexicale.lex" +#line 83 "analyse_lexicale.lex" {return tINT ;} YY_BREAK case 23: YY_RULE_SETUP -#line 83 "analyse_lexicale.lex" +#line 84 "analyse_lexicale.lex" {return tPRINT ;} YY_BREAK case 24: YY_RULE_SETUP -#line 84 "analyse_lexicale.lex" +#line 85 "analyse_lexicale.lex" {return tRETURN ;} YY_BREAK case 25: YY_RULE_SETUP -#line 86 "analyse_lexicale.lex" +#line 87 "analyse_lexicale.lex" {return tOR ;} YY_BREAK case 26: YY_RULE_SETUP -#line 87 "analyse_lexicale.lex" +#line 88 "analyse_lexicale.lex" {return tAND ;} YY_BREAK case 27: YY_RULE_SETUP -#line 89 "analyse_lexicale.lex" +#line 90 "analyse_lexicale.lex" {return tIF ;} YY_BREAK case 28: YY_RULE_SETUP -#line 90 "analyse_lexicale.lex" +#line 91 "analyse_lexicale.lex" {return tELSE ;} YY_BREAK case 29: YY_RULE_SETUP -#line 91 "analyse_lexicale.lex" +#line 92 "analyse_lexicale.lex" {return tWHILE ;} YY_BREAK case 30: YY_RULE_SETUP -#line 93 "analyse_lexicale.lex" -{return tCONST ;} +#line 94 "analyse_lexicale.lex" +{return tAPPERSAND;} YY_BREAK case 31: YY_RULE_SETUP -#line 94 "analyse_lexicale.lex" -{yylval.nombre = atoi(yytext); return tENTIER ;} +#line 95 "analyse_lexicale.lex" +{return tCONST ;} YY_BREAK case 32: YY_RULE_SETUP -#line 95 "analyse_lexicale.lex" -{yylval.nombre = -1; return tENTIEREXP;} +#line 96 "analyse_lexicale.lex" +{yylval.nombre = atoi(yytext); return tENTIER ;} YY_BREAK case 33: YY_RULE_SETUP -#line 96 "analyse_lexicale.lex" -{strcpy(yylval.id, yytext); return tVAR ;} +#line 97 "analyse_lexicale.lex" +{yylval.nombre = -1; return tENTIEREXP;} YY_BREAK case 34: YY_RULE_SETUP #line 98 "analyse_lexicale.lex" +{strcpy(yylval.id, yytext); return tVAR ;} + YY_BREAK +case 35: +YY_RULE_SETUP +#line 100 "analyse_lexicale.lex" ECHO; YY_BREAK -#line 941 "lex.yy.c" +#line 945 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1015,7 +1019,7 @@ case YY_STATE_EOF(INITIAL): { (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -1068,7 +1072,6 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1080,9 +1083,9 @@ case YY_STATE_EOF(INITIAL): */ static int yy_get_next_buffer (void) { - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - int number_to_move, i; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1111,7 +1114,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1124,21 +1127,21 @@ static int yy_get_next_buffer (void) else { - int num_to_read = + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { - int new_size = b->yy_buf_size * 2; + yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1147,12 +1150,11 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yyrealloc( (void *) b->yy_ch_buf, - (yy_size_t) (b->yy_buf_size + 2) ); + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = NULL; + b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1180,7 +1182,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + yyrestart(yyin ); } else @@ -1194,15 +1196,12 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( - (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - /* "- 2" to take care of EOB's */ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -1218,14 +1217,14 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - yy_state_type yy_current_state; - char *yy_cp; + register yy_state_type yy_current_state; + register char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1235,9 +1234,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 70 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; @@ -1250,10 +1249,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - int yy_is_jam; - char *yy_cp = (yy_c_buf_p); + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); - YY_CHAR yy_c = 1; + register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1263,19 +1262,17 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 70 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 69); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) + static void yyunput (int c, register char * yy_bp ) { - char *yy_cp; + register char *yy_cp; yy_cp = (yy_c_buf_p); @@ -1285,10 +1282,10 @@ static int yy_get_next_buffer (void) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + register yy_size_t number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = + register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -1297,7 +1294,7 @@ static int yy_get_next_buffer (void) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -1310,8 +1307,6 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = yy_cp; } -#endif - #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1336,7 +1331,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1353,13 +1348,13 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - yyrestart( yyin ); + yyrestart(yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap( ) ) + if ( yywrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) @@ -1397,11 +1392,11 @@ static int yy_get_next_buffer (void) if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); + yy_create_buffer(yyin,YY_BUF_SIZE ); } - yy_init_buffer( YY_CURRENT_BUFFER, input_file ); - yy_load_buffer_state( ); + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. @@ -1429,7 +1424,7 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag @@ -1457,7 +1452,7 @@ static void yy_load_buffer_state (void) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -1466,13 +1461,13 @@ static void yy_load_buffer_state (void) /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + yy_init_buffer(b,file ); return b; } @@ -1491,11 +1486,15 @@ static void yy_load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yyfree( (void *) b->yy_ch_buf ); + yyfree((void *) b->yy_ch_buf ); - yyfree( (void *) b ); + yyfree((void *) b ); } +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. @@ -1505,7 +1504,7 @@ static void yy_load_buffer_state (void) { int oerrno = errno; - yy_flush_buffer( b ); + yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; @@ -1548,7 +1547,7 @@ static void yy_load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -1579,7 +1578,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -1598,7 +1597,7 @@ void yypop_buffer_state (void) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -1616,15 +1615,15 @@ static void yyensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -1633,7 +1632,7 @@ static void yyensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; + int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc @@ -1653,7 +1652,7 @@ static void yyensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { @@ -1663,23 +1662,23 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return NULL; + return 0; - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = NULL; + b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + yy_switch_to_buffer(b ); return b; } @@ -1692,29 +1691,28 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ -YY_BUFFER_STATE yy_scan_string (const char * yystr ) +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { - return yy_scan_bytes( yystr, (int) strlen(yystr) ); + return yy_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; - yy_size_t n; - int i; + yy_size_t n, i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = (yy_size_t) (_yybytes_len + 2); - buf = (char *) yyalloc( n ); + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); @@ -1723,7 +1721,7 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); + b = yy_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); @@ -1739,9 +1737,9 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) #define YY_EXIT_FAILURE 2 #endif -static void yynoreturn yy_fatal_error (const char* msg ) +static void yy_fatal_error (yyconst char* msg ) { - fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -1769,7 +1767,7 @@ static void yynoreturn yy_fatal_error (const char* msg ) */ int yyget_lineno (void) { - + return yylineno; } @@ -1792,7 +1790,7 @@ FILE *yyget_out (void) /** Get the length of the current token. * */ -int yyget_leng (void) +yy_size_t yyget_leng (void) { return yyleng; } @@ -1807,29 +1805,29 @@ char *yyget_text (void) } /** Set the current line number. - * @param _line_number line number + * @param line_number * */ -void yyset_lineno (int _line_number ) +void yyset_lineno (int line_number ) { - yylineno = _line_number; + yylineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param _in_str A readable stream. + * @param in_str A readable stream. * * @see yy_switch_to_buffer */ -void yyset_in (FILE * _in_str ) +void yyset_in (FILE * in_str ) { - yyin = _in_str ; + yyin = in_str ; } -void yyset_out (FILE * _out_str ) +void yyset_out (FILE * out_str ) { - yyout = _out_str ; + yyout = out_str ; } int yyget_debug (void) @@ -1837,9 +1835,9 @@ int yyget_debug (void) return yy_flex_debug; } -void yyset_debug (int _bdebug ) +void yyset_debug (int bdebug ) { - yy_flex_debug = _bdebug ; + yy_flex_debug = bdebug ; } static int yy_init_globals (void) @@ -1848,10 +1846,10 @@ static int yy_init_globals (void) * This function is called from yylex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = NULL; + (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = NULL; + (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; @@ -1860,8 +1858,8 @@ static int yy_init_globals (void) yyin = stdin; yyout = stdout; #else - yyin = NULL; - yyout = NULL; + yyin = (FILE *) 0; + yyout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by @@ -1876,7 +1874,7 @@ int yylex_destroy (void) /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - yy_delete_buffer( YY_CURRENT_BUFFER ); + yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } @@ -1897,19 +1895,18 @@ int yylex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, const char * s2, int n ) +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - - int i; + register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (const char * s ) +static int yy_flex_strlen (yyconst char * s ) { - int n; + register int n; for ( n = 0; s[n]; ++n ) ; @@ -1919,12 +1916,11 @@ static int yy_flex_strlen (const char * s ) void *yyalloc (yy_size_t size ) { - return malloc(size); + return (void *) malloc( size ); } void *yyrealloc (void * ptr, yy_size_t size ) { - /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -1932,17 +1928,18 @@ void *yyrealloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return realloc(ptr, size); + return (void *) realloc( (char *) ptr, size ); } void yyfree (void * ptr ) { - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 98 "analyse_lexicale.lex" +#line 100 "analyse_lexicale.lex" + //int main(void){ diff --git a/script.sh b/script.sh index 2c0b6eb..9071497 100755 --- a/script.sh +++ b/script.sh @@ -3,17 +3,12 @@ flex analyse_lexicale.lex gcc -w *.c -ly echo " int main(){ - int var1 = 1; - int var2 = 2; - var2 = 2 + 3; - int var3; - if (!var2){ - var2 = 1; - var3 = 4; - } else { - var1 = 2; - } - printf(var2); - return 5; + int c = 2; + int * p; + p = &c; + *p = 2; + int b = *p; + + return 0; } " | ./a.out \ No newline at end of file diff --git a/table_fonctions.c b/table_fonctions.c new file mode 100644 index 0000000..1671275 --- /dev/null +++ b/table_fonctions.c @@ -0,0 +1,59 @@ +#include "table_fonctions.h" +#include +#include + +void initialise_function_table(Table_Fonctions * table){ + table->depth = 1; +} + +void add_function(Table_Fonctions * table, char * function_name, enum Return_Type return_type, int start_addr){ + Fonction fonction; + strcpy(fonction.function_name,function_name); + fonction.start_addr = start_addr; + fonction.type = return_type; + fonction.function_depth = table->depth; + table->array[table->depth] = fonction; + table->depth++; +} + +void print_function(Fonction * fonction){ + char * function_name = fonction->function_name; + int start_addr = fonction->start_addr; + int depth = fonction->function_depth; + int return_type = fonction->type; + char typeStr[20]; + if (return_type == RET_INT){ + strcpy(typeStr, "INT"); + } else if (return_type == RET_INT_PTR){ + strcpy(typeStr, "INT_PTR"); + } + printf("%-20s\t\t %-12s\t\t %-12d\t %-12d\n", function_name, typeStr, start_addr, depth); +} + +void print_fonction_table(Table_Fonctions * table) { + printf("%-20s\t\t %-12s\t\t %-12s\t %-20s\n", "Function Name", "Return Type", "Start Address", "Depth"); + Fonction fonction; + for (int i = 1; i < table->depth; i++) { + fonction = table->array[i]; + print_function(&fonction); + } +} + +int function_exists(Table_Fonctions * table, char * func_name){ + for (int i = 0; i < table->depth; i++){ + if (strcmp(table->array[i].function_name, func_name) == 0){ + return i; + } + } + return -1; +} + +/* +int main(){ + Table_Fonctions table; + initialise_function_table(&table); + add_function(&table, "Fonction1", 0, 7); + add_function(&table, "Fonction2", 1, 23); + print_fonction_table(&table); + return 1; +}*/ diff --git a/table_fonctions.h b/table_fonctions.h new file mode 100644 index 0000000..2c77e2c --- /dev/null +++ b/table_fonctions.h @@ -0,0 +1,35 @@ +// +// Created by Nahom Belay on 29/04/2021. +// + +#ifndef PROJET_SYSTEME_TABLE_FONCTIONS_H +#define PROJET_SYSTEME_TABLE_FONCTIONS_H + +#define FUNCTION_TABLE_SIZE 50 +#define FUNCTION_NAME_SIZE 30 + +enum Return_Type {RET_INT , RET_INT_PTR}; + +typedef struct Fonction { + char function_name[FUNCTION_NAME_SIZE]; + int start_addr ; + enum Return_Type type; + int function_depth; +} Fonction; + +typedef struct Table_Fonctions { + Fonction array[FUNCTION_TABLE_SIZE]; + int depth; +} Table_Fonctions; + +void initialise_function_table(Table_Fonctions * table); + +void add_function(Table_Fonctions * table, char * function_name, enum Return_Type return_type, int start_addr); + +void print_fonction_table(Table_Fonctions * table); + +int function_exists(Table_Fonctions * table, char * func_name); + + + +#endif //PROJET_SYSTEME_TABLE_FONCTIONS_H diff --git a/table_symboles.c b/table_symboles.c index 88fb82f..b9e58e5 100644 --- a/table_symboles.c +++ b/table_symboles.c @@ -54,25 +54,47 @@ int add_symbole_bottom(Table_Symboles * table){ return 0; } -int remove_symboles(Table_Symboles * table, int depth){ - int index; - if (depth < table->depth){ - return -1; - } else { - index = table->indexAvailableTop; - while(table->array[index].symbole_depth == depth && index >=0){ - //remove - table->indexAvailableTop--; - index--; +int remove_symboles(Table_Symboles * table){ + if (table->indexAvailableTop > 0){ + while(table->indexAvailableTop > 0){ + if (table->array[table->indexAvailableTop-1].symbole_depth == table->depth){ + table->indexAvailableTop--; + } else { + break; + } + } + } + //TODO: vérifier qu'il n'y a pas de varaibles temporarires au moment de changement de profondeur - } return 0; } void free_temp(Table_Symboles * table){ table->indexAvailableBottom++; + if (table->indexAvailableBottom >= TABLE_SIZE){ + printf("Huge error\n"); + table->indexAvailableBottom--; + } +} + +int prepare_function_call(Table_Symboles * table){ + prepare_argument_push(table); + prepare_argument_push(table); + prepare_argument_push(table); +} + +int prepare_argument_push(Table_Symboles * table){ + Symbole symbole; + symbole.addr = table->indexAvailableTop; + symbole.symbole_depth = table->depth; + if (table->indexAvailableTop < table->indexAvailableBottom){ + table->array[table->indexAvailableTop] = symbole; + table->indexAvailableTop++; + return (table->indexAvailableTop) - 1 ; + } + } int initialise_symbole(Table_Symboles * table, char * varName){ @@ -91,8 +113,12 @@ void print_symbole(Symbole * symbole){ char typeStr[20]; if (type == TYPE_INT){ strcpy(typeStr, "INT"); - } else{ + } else if (type == TYPE_CONST_INT){ strcpy(typeStr, "CONST_INT"); + } else if (type == TYPE_INT_PTR) { + strcpy(typeStr, "INT_PTR"); + } else { + strcpy(typeStr, "Error type"); } enum Initialised_Variable init = symbole->init; char initStr[20]; diff --git a/table_symboles.h b/table_symboles.h index acdc1fc..e03b52a 100644 --- a/table_symboles.h +++ b/table_symboles.h @@ -4,7 +4,7 @@ #define TABLE_SIZE 50 #define VARIABLE_SIZE 30 -enum Symbole_Type {TYPE_INT , TYPE_CONST_INT}; +enum Symbole_Type {TYPE_INT , TYPE_CONST_INT, TYPE_INT_PTR}; enum Initialised_Variable{INITIALISED , NOT_INITIALISED}; typedef struct Symboles { @@ -58,14 +58,18 @@ int variable_exists(Table_Symboles * table, char * varName); /** * Removes symbole from table having certain depth * @param table - * @param depth * @return -1 if the symbole isn't in the table, 0 otherwise */ -int remove_symboles(Table_Symboles * table, int depth); +int remove_symboles(Table_Symboles * table); void free_temp(Table_Symboles * table); +int prepare_function_call(Table_Symboles * table); + +int prepare_argument_push(Table_Symboles * table); + + /** * Initialises an already exisiting symbole * @param table