Skip to content
Snippets Groups Projects
Commit 4811c7c0 authored by viniciusmioto's avatar viniciusmioto
Browse files

fix: stack_t_custom

parent 967bf512
No related branches found
No related tags found
No related merge requests found
File deleted
File deleted
This diff is collapsed.
This diff is collapsed.
/* A Bison parser, made by GNU Bison 3.8.2. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 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
the Free Software Foundation, either version 3 of the License, 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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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 <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
especially those whose name start with YY_ or yy_. They are
private implementation details that can be changed or removed. */
#ifndef YY_YY_COMPILADOR_TAB_H_INCLUDED
# define YY_YY_COMPILADOR_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Token kinds. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
YYEMPTY = -2,
YYEOF = 0, /* "end of file" */
YYerror = 256, /* error */
YYUNDEF = 257, /* "invalid token" */
PROGRAM = 258, /* PROGRAM */
ABRE_PARENTESES = 259, /* ABRE_PARENTESES */
FECHA_PARENTESES = 260, /* FECHA_PARENTESES */
VIRGULA = 261, /* VIRGULA */
PONTO_E_VIRGULA = 262, /* PONTO_E_VIRGULA */
DOIS_PONTOS = 263, /* DOIS_PONTOS */
PONTO = 264, /* PONTO */
T_BEGIN = 265, /* T_BEGIN */
T_END = 266, /* T_END */
VAR = 267, /* VAR */
IDENT = 268, /* IDENT */
ATRIBUICAO = 269, /* ATRIBUICAO */
LABEL = 270, /* LABEL */
TYPE = 271, /* TYPE */
ARRAY = 272, /* ARRAY */
PROCEDURE = 273, /* PROCEDURE */
FUNCTION = 274, /* FUNCTION */
GOTO = 275, /* GOTO */
IF = 276, /* IF */
THEN = 277, /* THEN */
ELSE = 278, /* ELSE */
WHILE = 279, /* WHILE */
DO = 280, /* DO */
OR = 281, /* OR */
DIV = 282, /* DIV */
AND = 283, /* AND */
NOT = 284, /* NOT */
IGUAL = 285, /* IGUAL */
DIFERENTE = 286, /* DIFERENTE */
MENOR_IGUAL = 287, /* MENOR_IGUAL */
MAIOR_IGUAL = 288, /* MAIOR_IGUAL */
MENOR = 289, /* MENOR */
MAIOR = 290, /* MAIOR */
MAIS = 291, /* MAIS */
MENOS = 292, /* MENOS */
ASTERISCO = 293, /* ASTERISCO */
NUMERO = 294, /* NUMERO */
READ = 295, /* READ */
WRITE = 296, /* WRITE */
LOWER_THAN_ELSE = 297 /* LOWER_THAN_ELSE */
};
typedef enum yytokentype yytoken_kind_t;
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_COMPILADOR_TAB_H_INCLUDED */
...@@ -20,7 +20,7 @@ int destino_nivel; ...@@ -20,7 +20,7 @@ int destino_nivel;
int destino_desloc; int destino_desloc;
simb_t *l_elem; simb_t *l_elem;
int rot_id; int rot_id;
stack_t *rot; stack_t_custom *rot;
%} %}
...@@ -356,7 +356,7 @@ int main (int argc, char** argv) { ...@@ -356,7 +356,7 @@ int main (int argc, char** argv) {
desloc = 0; desloc = 0;
// Inicializa Rotulos // Inicializa Rotulos
rot = (stack_t *)malloc(sizeof(stack_t)); rot = (stack_t_custom *)malloc(sizeof(stack_t_custom));
inicializa_stack(rot); inicializa_stack(rot);
rot_id = 0; rot_id = 0;
......
This diff is collapsed.
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
#include <string.h> #include <string.h>
#include "stack.h" #include "stack.h"
void inicializa_stack(stack_t *stack) { void inicializa_stack(stack_t_custom *stack) {
stack->topo = NULL; stack->topo = NULL;
stack->tam = 0; stack->tam = 0;
} }
void empilha(char *item, stack_t *stack) { void empilha(char *item, stack_t_custom *stack) {
if (stack == NULL) { if (stack == NULL) {
return; return;
} }
...@@ -22,7 +22,7 @@ void empilha(char *item, stack_t *stack) { ...@@ -22,7 +22,7 @@ void empilha(char *item, stack_t *stack) {
stack->tam += 1; stack->tam += 1;
} }
void desempilha(char *item, stack_t *stack) { void desempilha(char *item, stack_t_custom *stack) {
if (stack == NULL || stack->topo == NULL) { if (stack == NULL || stack->topo == NULL) {
return; return;
} }
...@@ -36,7 +36,7 @@ void desempilha(char *item, stack_t *stack) { ...@@ -36,7 +36,7 @@ void desempilha(char *item, stack_t *stack) {
free(p); free(p);
} }
void mostra_stack(stack_t *stack) { void mostra_stack(stack_t_custom *stack) {
if (stack == NULL || stack->topo == NULL) { if (stack == NULL || stack->topo == NULL) {
printf("Pilha está vazia ou não inicializada.\n"); printf("Pilha está vazia ou não inicializada.\n");
return; return;
......
...@@ -9,14 +9,14 @@ typedef struct item_t { ...@@ -9,14 +9,14 @@ typedef struct item_t {
typedef struct stack_t { typedef struct stack_t {
item_t *topo; item_t *topo;
int tam; int tam;
} stack_t; } stack_t_custom;
void inicializa_stack(stack_t *stack); void inicializa_stack(stack_t_custom *stack);
void empilha(char *item, stack_t *stack); void empilha(char *item, stack_t_custom *stack);
void desempilha(char *item, stack_t *stack); void desempilha(char *item, stack_t_custom *stack);
void mostra_stack(stack_t *stack); void mostra_stack(stack_t_custom *stack);
#endif #endif
File deleted
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment