diff --git a/as.tab.c b/as.tab.c index 7128deb..bef2ea1 100644 --- a/as.tab.c +++ b/as.tab.c @@ -1,9 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.5.1. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, - Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. 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 @@ -41,14 +40,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Undocumented macros, especially those whose name start with YY_, - are private implementation details. Do not rely on them. */ - /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.5.1" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -65,25 +61,15 @@ +/* Copy the first part of user declarations. */ + +#line 67 "as.tab.c" /* yacc.c:339 */ -# ifndef YY_CAST -# ifdef __cplusplus -# define YY_CAST(Type, Val) static_cast (Val) -# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) -# else -# define YY_CAST(Type, Val) ((Type) (Val)) -# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) -# endif -# endif # ifndef YY_NULLPTR -# if defined __cplusplus -# if 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr # else -# define YY_NULLPTR ((void*)0) +# define YY_NULLPTR 0 # endif # endif @@ -95,8 +81,8 @@ # define YYERROR_VERBOSE 0 #endif -/* Use api.header.include to #include this header - instead of duplicating it here. */ +/* In a future release of Bison, this section will be replaced + by #include "as.tab.h". */ #ifndef YY_YY_AS_TAB_H_INCLUDED # define YY_YY_AS_TAB_H_INCLUDED /* Debug traces. */ @@ -137,15 +123,16 @@ extern int yydebug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + union YYSTYPE { -#line 1 "as.y" +#line 1 "as.y" /* yacc.c:355 */ int nombre; -#line 147 "as.tab.c" - +#line 134 "as.tab.c" /* yacc.c:355 */ }; + typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -158,92 +145,44 @@ int yyparse (void); #endif /* !YY_YY_AS_TAB_H_INCLUDED */ -/* Second part of user prologue. */ -#line 4 "as.y" +/* Copy the second part of user declarations. */ +#line 4 "as.y" /* yacc.c:358 */ #include "tables.h" -#include +#include FILE * file; FILE * file2; -#line 172 "as.tab.c" - +#line 159 "as.tab.c" /* yacc.c:358 */ #ifdef short # undef short #endif -/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure - and (if available) are included - so that the code can choose integer types of a good width. */ - -#ifndef __PTRDIFF_MAX__ -# include /* INFRINGES ON USER NAME SPACE */ -# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_STDINT_H -# endif +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; #endif -/* Narrow types that promote to a signed type and that can represent a - signed or unsigned integer of at least N bits. In tables they can - save space and decrease cache pressure. Promoting to a signed type - helps avoid bugs in integer arithmetic. */ - -#ifdef __INT_LEAST8_MAX__ -typedef __INT_LEAST8_TYPE__ yytype_int8; -#elif defined YY_STDINT_H -typedef int_least8_t yytype_int8; +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; #else typedef signed char yytype_int8; #endif -#ifdef __INT_LEAST16_MAX__ -typedef __INT_LEAST16_TYPE__ yytype_int16; -#elif defined YY_STDINT_H -typedef int_least16_t yytype_int16; +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; #else -typedef short yytype_int16; +typedef unsigned short int yytype_uint16; #endif -#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ -typedef __UINT_LEAST8_TYPE__ yytype_uint8; -#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ - && UINT_LEAST8_MAX <= INT_MAX) -typedef uint_least8_t yytype_uint8; -#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX -typedef unsigned char yytype_uint8; +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; #else -typedef short yytype_uint8; -#endif - -#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ -typedef __UINT_LEAST16_TYPE__ yytype_uint16; -#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ - && UINT_LEAST16_MAX <= INT_MAX) -typedef uint_least16_t yytype_uint16; -#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX -typedef unsigned short yytype_uint16; -#else -typedef int yytype_uint16; -#endif - -#ifndef YYPTRDIFF_T -# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ -# define YYPTRDIFF_T __PTRDIFF_TYPE__ -# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ -# elif defined PTRDIFF_MAX -# ifndef ptrdiff_t -# include /* INFRINGES ON USER NAME SPACE */ -# endif -# define YYPTRDIFF_T ptrdiff_t -# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX -# else -# define YYPTRDIFF_T long -# define YYPTRDIFF_MAXIMUM LONG_MAX -# endif +typedef short int yytype_int16; #endif #ifndef YYSIZE_T @@ -251,27 +190,15 @@ typedef int yytype_uint16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned +# define YYSIZE_T unsigned int # endif #endif -#define YYSIZE_MAXIMUM \ - YY_CAST (YYPTRDIFF_T, \ - (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ - ? YYPTRDIFF_MAXIMUM \ - : YY_CAST (YYSIZE_T, -1))) - -#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) - -/* Stored state numbers (used for stacks). */ -typedef yytype_int8 yy_state_t; - -/* State numbers in computations. */ -typedef int yy_state_fast_t; +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -285,19 +212,30 @@ typedef int yy_state_fast_t; # endif #endif -#ifndef YY_ATTRIBUTE_PURE -# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) -# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#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_PURE +# define YY_ATTRIBUTE(Spec) /* empty */ # endif #endif +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + #ifndef YY_ATTRIBUTE_UNUSED -# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) -# define YY_ATTRIBUTE_UNUSED __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 YY_ATTRIBUTE_UNUSED +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif @@ -308,13 +246,13 @@ typedef int yy_state_fast_t; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#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\"") \ +# 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 \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -327,20 +265,6 @@ typedef int yy_state_fast_t; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif -#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ -# define YY_IGNORE_USELESS_CAST_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") -# define YY_IGNORE_USELESS_CAST_END \ - _Pragma ("GCC diagnostic pop") -#endif -#ifndef YY_IGNORE_USELESS_CAST_BEGIN -# define YY_IGNORE_USELESS_CAST_BEGIN -# define YY_IGNORE_USELESS_CAST_END -#endif - - -#define YY_ASSERT(E) ((void) (0 && (E))) #if ! defined yyoverflow || YYERROR_VERBOSE @@ -417,17 +341,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yy_state_t yyss_alloc; + yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -440,11 +364,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYPTRDIFF_T yynewbytes; \ + YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / YYSIZEOF (*yyptr); \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) @@ -456,12 +380,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYPTRDIFF_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -484,18 +408,17 @@ union yyalloc /* YYNSTATES -- Number of states. */ #define YYNSTATES 63 +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 277 - -/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex. */ -static const yytype_int8 yytranslate[] = + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -532,8 +455,8 @@ static const yytype_int8 yytranslate[] = static const yytype_uint8 yyrline[] = { 0, 24, 24, 25, 27, 34, 41, 48, 55, 62, - 69, 78, 83, 89, 97, 100, 108, 114, 122, 127, - 134, 140, 145 + 69, 78, 83, 89, 98, 101, 109, 115, 123, 128, + 135, 141, 146 }; #endif @@ -552,7 +475,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ -static const yytype_int16 yytoknum[] = +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, @@ -560,14 +483,14 @@ static const yytype_int16 yytoknum[] = }; # endif -#define YYPACT_NINF (-4) +#define YYPACT_NINF -4 -#define yypact_value_is_default(Yyn) \ - ((Yyn) == YYPACT_NINF) +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-4))) -#define YYTABLE_NINF (-1) +#define YYTABLE_NINF -1 -#define yytable_value_is_error(Yyn) \ +#define yytable_value_is_error(Yytable_value) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing @@ -586,14 +509,14 @@ static const yytype_int8 yypact[] = /* 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. */ -static const yytype_int8 yydefact[] = +static const yytype_uint8 yydefact[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 18, 19, 0, 22, 1, 2, 0, 0, 0, 0, 0, 0, 0, 11, - 12, 13, 17, 16, 15, 20, 4, 6, 5, 7, + 12, 13, 16, 17, 15, 20, 4, 6, 5, 7, 8, 9, 10 }; @@ -612,7 +535,7 @@ static const yytype_int8 yydefgoto[] = /* 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. */ -static const yytype_int8 yytable[] = +static const yytype_uint8 yytable[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 40, @@ -636,7 +559,7 @@ static const yytype_int8 yycheck[] = /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_int8 yystos[] = +static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, @@ -648,7 +571,7 @@ static const yytype_int8 yystos[] = }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_int8 yyr1[] = +static const yytype_uint8 yyr1[] = { 0, 23, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, @@ -656,7 +579,7 @@ static const yytype_int8 yyr1[] = }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_int8 yyr2[] = +static const yytype_uint8 yyr2[] = { 0, 2, 2, 1, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 2, 3, 3, 3, 2, 2, @@ -676,22 +599,22 @@ static const yytype_int8 yyr2[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ - do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ - while (0) +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) /* Error token number */ #define YYTERROR 1 @@ -731,39 +654,37 @@ do { \ } while (0) -/*-----------------------------------. -| Print this symbol's value on YYO. | -`-----------------------------------*/ +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ static void -yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { - FILE *yyoutput = yyo; - YYUSE (yyoutput); + FILE *yyo = yyoutput; + YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) - YYPRINT (yyo, yytoknum[yytype], *yyvaluep); + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*---------------------------. -| Print this symbol on YYO. | -`---------------------------*/ +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ static void -yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { - YYFPRINTF (yyo, "%s %s (", + YYFPRINTF (yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyo, yytype, yyvaluep); - YYFPRINTF (yyo, ")"); + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. @@ -772,7 +693,7 @@ yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) `------------------------------------------------------------------*/ static void -yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -795,20 +716,20 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { - int yylno = yyrline[yyrule]; + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 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)] + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } @@ -852,13 +773,13 @@ int yydebug; # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H -# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) +# define yystrlen strlen # else /* Return the length of YYSTR. */ -static YYPTRDIFF_T +static YYSIZE_T yystrlen (const char *yystr) { - YYPTRDIFF_T yylen; + YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; @@ -894,12 +815,12 @@ yystpcpy (char *yydest, const char *yysrc) backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ -static YYPTRDIFF_T +static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - YYPTRDIFF_T yyn = 0; + YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) @@ -912,10 +833,7 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - else - goto append; - - append: + /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; @@ -930,10 +848,10 @@ yytnamerr (char *yyres, const char *yystr) do_not_strip_quotes: ; } - if (yyres) - return yystpcpy (yyres, yystr) - yyres; - else + if (! yyres) return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; } # endif @@ -946,19 +864,19 @@ yytnamerr (char *yyres, const char *yystr) *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 (YYPTRDIFF_T *yymsg_alloc, char **yymsg, - yy_state_t *yyssp, int yytoken) +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) { + 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: reported tokens (one for the "unexpected", - one per "expected"). */ + /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Actual size of YYARG. */ + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ int yycount = 0; - /* Cumulated lengths of YYARG. */ - YYPTRDIFF_T yysize = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then @@ -985,9 +903,7 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, */ if (yytoken != YYEMPTY) { - int yyn = yypact[+*yyssp]; - YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - yysize = yysize0; + int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { @@ -1012,12 +928,11 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYPTRDIFF_T yysize1 - = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; + yysize = yysize1; } } } @@ -1029,7 +944,6 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, case N: \ yyformat = S; \ break - default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); @@ -1040,13 +954,10 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, } { - /* Don't count the "%s"s in the final size, but reserve room for - the terminator. */ - YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; + yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -1072,8 +983,8 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, } else { - ++yyp; - ++yyformat; + yyp++; + yyformat++; } } return 0; @@ -1116,7 +1027,7 @@ int yynerrs; int yyparse (void) { - yy_state_fast_t yystate; + int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -1128,16 +1039,16 @@ yyparse (void) to reallocate them elsewhere. */ /* The state stack. */ - yy_state_t yyssa[YYINITDEPTH]; - yy_state_t *yyss; - yy_state_t *yyssp; + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; - YYPTRDIFF_T yystacksize; + YYSIZE_T yystacksize; int yyn; int yyresult; @@ -1151,7 +1062,7 @@ yyparse (void) /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; - YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1172,54 +1083,46 @@ yyparse (void) yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; - /*------------------------------------------------------------. -| yynewstate -- push a new state, which is found in yystate. | +| yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ -yynewstate: + yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - -/*--------------------------------------------------------------------. -| yysetstate -- set current state (the top of the stack) to yystate. | -`--------------------------------------------------------------------*/ -yysetstate: - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - YY_ASSERT (0 <= yystate && yystate < YYNSTATES); - YY_IGNORE_USELESS_CAST_BEGIN - *yyssp = YY_CAST (yy_state_t, yystate); - YY_IGNORE_USELESS_CAST_END + yysetstate: + *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) -#if !defined yyoverflow && !defined YYSTACK_RELOCATE - goto yyexhaustedlab; -#else { /* Get the current used size of the three stacks, in elements. */ - YYPTRDIFF_T yysize = yyssp - yyss + 1; + YYSIZE_T yysize = yyssp - yyss + 1; -# if defined yyoverflow +#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. */ - yy_state_t *yyss1 = yyss; 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 * YYSIZEOF (*yyssp), - &yyvs1, yysize * YYSIZEOF (*yyvsp), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); + yyss = yyss1; yyvs = yyvs1; } -# else /* defined YYSTACK_RELOCATE */ +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -1228,43 +1131,42 @@ yysetstate: yystacksize = YYMAXDEPTH; { - yy_state_t *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = - YY_CAST (union yyalloc *, - YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif +#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YY_IGNORE_USELESS_CAST_BEGIN - YYDPRINTF ((stderr, "Stack size increased to %ld\n", - YY_CAST (long, yystacksize))); - YY_IGNORE_USELESS_CAST_END + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } -#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; - /*-----------. | yybackup. | `-----------*/ yybackup: + /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1314,13 +1216,15 @@ yybackup: /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END - /* Discard the shifted token. */ - yychar = YYEMPTY; goto yynewstate; @@ -1335,7 +1239,7 @@ yydefault: /*-----------------------------. -| yyreduce -- do a reduction. | +| yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1355,215 +1259,215 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 4: -#line 27 "as.y" - {increment_time(); + case 4: +#line 27 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_src1 = get_reg_read((yyvsp[-1].nombre), &added_instruction); int reg_src2 = get_reg_read((yyvsp[0].nombre), &added_instruction); int reg_dest = get_reg_write((yyvsp[-2].nombre), &added_instruction); add_instruction(MUL, reg_dest, reg_src1, reg_src2); new_instruction(added_instruction + 1);} -#line 1368 "as.tab.c" +#line 1272 "as.tab.c" /* yacc.c:1646 */ break; case 5: -#line 34 "as.y" - {increment_time(); +#line 34 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_src1 = get_reg_read((yyvsp[-1].nombre), &added_instruction); int reg_src2 = get_reg_read((yyvsp[0].nombre), &added_instruction); int reg_dest = get_reg_write((yyvsp[-2].nombre), &added_instruction); add_instruction(ADD, reg_dest, reg_src1, reg_src2); new_instruction(added_instruction + 1);} -#line 1380 "as.tab.c" +#line 1284 "as.tab.c" /* yacc.c:1646 */ break; case 6: -#line 41 "as.y" - {increment_time(); +#line 41 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_src1 = get_reg_read((yyvsp[-1].nombre), &added_instruction); int reg_src2 = get_reg_read((yyvsp[0].nombre), &added_instruction); int reg_dest = get_reg_write((yyvsp[-2].nombre), &added_instruction); add_instruction(DIV, reg_dest, reg_src1, reg_src2); new_instruction(added_instruction + 1);} -#line 1392 "as.tab.c" +#line 1296 "as.tab.c" /* yacc.c:1646 */ break; case 7: -#line 48 "as.y" - {increment_time(); +#line 48 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_src1 = get_reg_read((yyvsp[-1].nombre), &added_instruction); int reg_src2 = get_reg_read((yyvsp[0].nombre), &added_instruction); int reg_dest = get_reg_write((yyvsp[-2].nombre), &added_instruction); add_instruction(SUB, reg_dest, reg_src1, reg_src2); new_instruction(added_instruction + 1);} -#line 1404 "as.tab.c" +#line 1308 "as.tab.c" /* yacc.c:1646 */ break; case 8: -#line 55 "as.y" - {increment_time(); +#line 55 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_src1 = get_reg_read((yyvsp[-1].nombre), &added_instruction); int reg_src2 = get_reg_read((yyvsp[0].nombre), &added_instruction); int reg_dest = get_reg_write((yyvsp[-2].nombre), &added_instruction); add_instruction(INF, reg_dest, reg_src1, reg_src2); new_instruction(added_instruction + 1);} -#line 1416 "as.tab.c" +#line 1320 "as.tab.c" /* yacc.c:1646 */ break; case 9: -#line 62 "as.y" - {increment_time(); +#line 62 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_src1 = get_reg_read((yyvsp[-1].nombre), &added_instruction); int reg_src2 = get_reg_read((yyvsp[0].nombre), &added_instruction); int reg_dest = get_reg_write((yyvsp[-2].nombre), &added_instruction); add_instruction(SUP, reg_dest, reg_src1, reg_src2); new_instruction(added_instruction + 1);} -#line 1428 "as.tab.c" +#line 1332 "as.tab.c" /* yacc.c:1646 */ break; case 10: -#line 69 "as.y" - {increment_time(); +#line 69 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_src1 = get_reg_read((yyvsp[-1].nombre), &added_instruction); int reg_src2 = get_reg_read((yyvsp[0].nombre), &added_instruction); int reg_dest = get_reg_write((yyvsp[-2].nombre), &added_instruction); add_instruction(EQU, reg_dest, reg_src1, reg_src2); new_instruction(added_instruction + 1);} -#line 1440 "as.tab.c" +#line 1344 "as.tab.c" /* yacc.c:1646 */ break; case 11: -#line 78 "as.y" - {increment_time(); +#line 78 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_dest = get_reg_write((yyvsp[-1].nombre), &added_instruction); add_instruction(AFC, reg_dest, (yyvsp[0].nombre), 0); new_instruction(added_instruction + 1);} -#line 1450 "as.tab.c" +#line 1354 "as.tab.c" /* yacc.c:1646 */ break; case 12: -#line 83 "as.y" - {increment_time(); +#line 83 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_src = get_reg_read((yyvsp[0].nombre), &added_instruction); int reg_dest = get_reg_write((yyvsp[-1].nombre), &added_instruction); add_instruction(CPY, reg_dest, reg_src, 0); new_instruction(added_instruction + 1);} -#line 1461 "as.tab.c" +#line 1365 "as.tab.c" /* yacc.c:1646 */ break; case 13: -#line 89 "as.y" - {increment_time(); +#line 89 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_aux = get_reg_write(-1, &added_instruction); add_instruction(AFC, reg_aux, (yyvsp[0].nombre), 0); add_instruction(STOREA, (yyvsp[-1].nombre), reg_aux, 0); + unlink((yyvsp[-1].nombre)); new_instruction(added_instruction + 2);} -#line 1472 "as.tab.c" +#line 1377 "as.tab.c" /* yacc.c:1646 */ break; case 14: -#line 97 "as.y" - {increment_time(); +#line 98 "as.y" /* yacc.c:1646 */ + {increment_time(); add_instruction(JMP, (yyvsp[0].nombre), 0, 0); new_instruction(1);} -#line 1480 "as.tab.c" +#line 1385 "as.tab.c" /* yacc.c:1646 */ break; case 15: -#line 100 "as.y" - {increment_time(); +#line 101 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_src = get_reg_read((yyvsp[-1].nombre), &added_instruction); int reg_aux = get_reg_write(-1, &added_instruction); add_instruction(SUB, reg_aux, reg_aux, reg_src); add_instruction(JMZ, (yyvsp[0].nombre), 0, 0); new_instruction(added_instruction + 2);} -#line 1492 "as.tab.c" +#line 1397 "as.tab.c" /* yacc.c:1646 */ break; case 16: -#line 108 "as.y" - {increment_time(); +#line 109 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_addr = get_reg_read((yyvsp[0].nombre), &added_instruction); int reg_dest = get_reg_write((yyvsp[-1].nombre), &added_instruction); add_instruction(LOADI, reg_dest, reg_addr, 0); new_instruction(added_instruction + 1);} -#line 1503 "as.tab.c" +#line 1408 "as.tab.c" /* yacc.c:1646 */ break; case 17: -#line 114 "as.y" - {increment_time(); +#line 115 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_addr = get_reg_read((yyvsp[-1].nombre), &added_instruction); int reg_value = get_reg_read((yyvsp[0].nombre), &added_instruction); add_instruction(STOREI, reg_addr, reg_value, 0); new_instruction(added_instruction + 1);} -#line 1514 "as.tab.c" +#line 1419 "as.tab.c" /* yacc.c:1646 */ break; case 18: -#line 122 "as.y" - {increment_time(); +#line 123 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_dest = get_reg_write((yyvsp[0].nombre), &added_instruction); add_instruction(GET, reg_dest, 0, 0); new_instruction(added_instruction + 1);} -#line 1524 "as.tab.c" +#line 1429 "as.tab.c" /* yacc.c:1646 */ break; case 19: -#line 127 "as.y" - {increment_time(); +#line 128 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = 0; int reg_src = get_reg_read((yyvsp[0].nombre), &added_instruction); add_instruction(PRI, reg_src, 0, 0); new_instruction(added_instruction + 1);} -#line 1534 "as.tab.c" +#line 1439 "as.tab.c" /* yacc.c:1646 */ break; case 20: -#line 134 "as.y" - {increment_time(); +#line 135 "as.y" /* yacc.c:1646 */ + {increment_time(); print(); int added_instruction = flush_and_init(file); print(); add_instruction(CALL, (yyvsp[-1].nombre), (yyvsp[0].nombre), 0); new_instruction(added_instruction + 1);} -#line 1545 "as.tab.c" +#line 1450 "as.tab.c" /* yacc.c:1646 */ break; case 21: -#line 140 "as.y" - {increment_time(); +#line 141 "as.y" /* yacc.c:1646 */ + {increment_time(); int added_instruction = flush_and_init(file); add_instruction(RET, 0, 0, 0); new_instruction(added_instruction + 1);} -#line 1554 "as.tab.c" +#line 1459 "as.tab.c" /* yacc.c:1646 */ break; case 22: -#line 145 "as.y" - {increment_time(); +#line 146 "as.y" /* yacc.c:1646 */ + {increment_time(); add_instruction(STOP, (yyvsp[0].nombre), 0, 0); new_instruction(1);} -#line 1562 "as.tab.c" +#line 1467 "as.tab.c" /* yacc.c:1646 */ break; -#line 1566 "as.tab.c" - +#line 1471 "as.tab.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1588,13 +1492,14 @@ yyreduce: /* 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. */ - { - const int yylhs = yyr1[yyn] - YYNTOKENS; - const int yyi = yypgoto[yylhs] + *yyssp; - yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp - ? yytable[yyi] - : yydefgoto[yylhs]); - } + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; @@ -1626,7 +1531,7 @@ yyerrlab: { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; @@ -1677,10 +1582,12 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - /* Pacify compilers when the user code never invokes YYERROR and the - label yyerrorlab therefore never appears in user code. */ - if (0) - YYERROR; + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -1742,7 +1649,6 @@ yyacceptlab: yyresult = 0; goto yyreturn; - /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -1750,7 +1656,6 @@ yyabortlab: yyresult = 1; goto yyreturn; - #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | @@ -1761,10 +1666,6 @@ yyexhaustedlab: /* Fall through. */ #endif - -/*-----------------------------------------------------. -| yyreturn -- parsing is finished, return the result. | -`-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -1781,7 +1682,7 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[+*yyssp], yyvsp); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -1794,7 +1695,7 @@ yyreturn: #endif return yyresult; } -#line 149 "as.y" +#line 150 "as.y" /* yacc.c:1906 */ int main(void) { diff --git a/as.tab.h b/as.tab.h index 166abd1..bd925a8 100644 --- a/as.tab.h +++ b/as.tab.h @@ -1,9 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.5.1. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, - Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. 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 @@ -31,9 +30,6 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -/* Undocumented macros, especially those whose name start with YY_, - are private implementation details. Do not rely on them. */ - #ifndef YY_YY_AS_TAB_H_INCLUDED # define YY_YY_AS_TAB_H_INCLUDED /* Debug traces. */ @@ -74,15 +70,16 @@ extern int yydebug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + union YYSTYPE { -#line 1 "as.y" +#line 1 "as.y" /* yacc.c:1909 */ int nombre; -#line 84 "as.tab.h" - +#line 81 "as.tab.h" /* yacc.c:1909 */ }; + typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 diff --git a/as.tab.o b/as.tab.o index 5d530ef..a3caabd 100644 Binary files a/as.tab.o and b/as.tab.o differ diff --git a/as.y b/as.y index a9df224..d938ea7 100644 --- a/as.y +++ b/as.y @@ -91,6 +91,7 @@ Instruction : tAFCA tNB tNB {increment_time(); int reg_aux = get_reg_write(-1, &added_instruction); add_instruction(AFC, reg_aux, $3, 0); add_instruction(STOREA, $2, reg_aux, 0); + unlink($2); new_instruction(added_instruction + 2);}; diff --git a/lex.yy.o b/lex.yy.o index 64eb151..d4b21f1 100644 Binary files a/lex.yy.o and b/lex.yy.o differ diff --git a/output.bin b/output.bin index 8d2e012..a214a39 100644 --- a/output.bin +++ b/output.bin @@ -1 +1 @@ -"00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "10101000000000000000000000000" & "10001000000110000000000000000" & "01101000000110000001100000000" & "00001000000110000000000000011" & "00010000000110000000100000011" & "01001000000010000000100000000" & "01110000001010000000100000000" & "01001000000010000000000000000" & "01011000001100000000100000000" & "01001000000110000000000000000" & "01100000000100000000000000000" & "01001000000000000110000000000" & "01011000000100000000000000000" & "00001000000100000001100000010" & "00010000000100000000100000010" & "01001000000010000000100000000" & "01110000001000000000100000000" & "01001000000010000000000000000" & "01011000001010000000100000000" & "01001000000100000000100000000" & "01100000000000000001100000000" & "01001000000110000000100000000" & "00001000000000000001000000000" & "01010000000100000001100000000" & "00010000000000000000100000000" & "01001000000010000000100000000" & "01110000000110000000100000000" & "01001000000010000000000000000" & "01001000000000000000000000000" & "01111000000010000000000000000" & \ No newline at end of file +"00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "10101000000000000000000000000" & "10001000000000000000000000000" & "01100000000000000000000000000" & "00001000000000000001000000000" & "01010000000100000010100000000" & "00010000000000000000100000000" & "01001000000010000000100000000" & "01110000001010000000100000000" & "01001000000010000000000000000" & "01001000000000000000000000000" & "10011000101110000010000000000" & "01011000001010000001100000000" & "01011000000110000001000000000" & "01110000001000000000100000000" & "01001000000010000000000000000" & "01011000001100000000100000000" & "01101000000100000001100000000" & "01001000000110000110000000000" & "00001000000100000000000000010" & "01010000000000000010000000000" & "01011000000100000000000000000" & "00010000000100000000100000010" & "01001000000010000000100000000" & "01110000001000000000100000000" & "01001000000010000000000000000" & "01011000001010000000100000000" & "01001000000100000000100000000" & "01101000000000000001100000000" & "01001000000110000000100000000" & "00001000000000000001000000000" & "01010000000100000001100000000" & "00010000000000000000100000000" & "01001000000010000000100000000" & "01110000000110000000100000000" & "01001000000010000000000000000" & "01001000000000000000000000000" & "10100000000000000000000000000" & "01011000000010000000000000000" & "01011000000000000000100000000" & "01000000000010000000000000000" & "01001000000000000000100000000" & "10011000000010000000100000000" & "01011000000110000001100000000" & "01011000000100000001000000000" & "01011000000010000000000000000" & "01000000000000000000100000000" & "01101000000000000001000000000" & "01001000000100000101000000000" & "00001000000000000001000000000" & "00010000000000000001100000000" & "01001000000110000000100000000" & "01000000000100000000100000000" & "01001000000000000000100000000" & "10001000000000000000000000000" & "01100000000000000000000000000" & "00001000000000000001000000000" & "00010000000000000001100000000" & "01001000000110000000100000000" & "01000000000100000000100000000" & "01010000000010000000000000000" & "01001000000000000000000000000" & "10100000000000000000000000000" & "01011000000110000001100000000" & "01011000000100000001000000000" & "01011000000010000000000000000" & "01011000000000000000100000000" & "01000000000010000000000000000" & "01001000000000000001000000000" & "01101000000000000001000000000" & "01001000000100000111000000000" & "00001000000000000001000000000" & "00010000000000000001100000000" & "01001000000110000000100000000" & "01000000000100000000100000000" & "01001000000000000000000000000" & "10001000000000000000000000000" & "01100000000000000000000000000" & "00001000000000000001000000000" & "00010000000000000001100000000" & "01001000000110000000100000000" & "01000000000100000000100000000" & "01010000000010000000000000000" & "01001000000000000000100000000" & "01111001100000000000000000000" & \ No newline at end of file diff --git a/rondoudou_cross_assembleur b/rondoudou_cross_assembleur index 67016b9..1f084e3 100755 Binary files a/rondoudou_cross_assembleur and b/rondoudou_cross_assembleur differ diff --git a/tables.c b/tables.c index 29667bc..e272fb6 100644 --- a/tables.c +++ b/tables.c @@ -282,6 +282,9 @@ int get_reg_read(int adresse, int * added_instruction) { } } +void unlink(int adresse) { + set_registre(adresse, -1); +} int flush_and_init() { int i; diff --git a/tables.h b/tables.h index 3f93738..43a62d1 100644 --- a/tables.h +++ b/tables.h @@ -25,6 +25,7 @@ void print(); void increment_time(); int get_reg_read(int adresse, int * added_instruction); int get_reg_write(int adresse, int * added_instruction); +void unlink(int adresse); int flush_and_init(); void new_instruction(int nb_inst); void write_asm(FILE * file); diff --git a/tables.o b/tables.o index 405ee37..1d4ba25 100644 Binary files a/tables.o and b/tables.o differ diff --git a/toto.asm b/toto.asm index beb22ea..346d766 100644 --- a/toto.asm +++ b/toto.asm @@ -1,4 +1,40 @@ -JMP 1 +JMP 37 +AFC 1 1 +COP 2 0 +AFC 3 1 +MUL 1 3 1 +ADD 1 2 1 +READ 1 1 +PRI 1 +AFC 1 0 +COP 2 0 +AFC 3 1 +MUL 1 3 1 +ADD 1 2 1 +AFC 2 14 +WR 1 2 +AFC 1 2 +COP 0 1 +RET +AFC 1 0 +COP 2 0 +AFC 3 1 +MUL 1 3 1 +ADD 1 2 1 +READ 1 1 +PRI 1 +AFC 1 1 +COP 2 0 +AFC 3 1 +MUL 1 3 1 +ADD 1 2 1 +AFC 2 10 +WR 1 2 +COP 1 0 +CALL 1 1 +AFC 1 1 +COP 0 1 +RET AFC 2 0 AFCA 3 0 AFC 5 1 @@ -13,6 +49,8 @@ MUL 3 6 3 ADD 3 4 3 AFC 5 12 WR 3 5 +AFCA 4 0 +CALL 18 4 AFC 4 0 AFCA 5 0 AFC 6 1 @@ -21,3 +59,4 @@ ADD 4 5 4 READ 4 4 PRI 4 STOP 0 +