From c1191c888eddd02e3677f1d9c9c782e085917d9e Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Sun, 23 Feb 2025 13:15:35 -0500 Subject: [PATCH] fixed issues with the compilation process --- Makefile | 11 +++++++---- runner.c | 7 +------ runner.h | 1 + 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 2f53d61..05aff7a 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CC := gcc FLEX := flex LEX := lexicalStructure.lex EXE := alpha -CFLAGS := +CFLAGS := compiler: lex.yy.c runner.o runner @@ -12,8 +12,11 @@ lex.yy.c: lexicalStructure.lex runner.o: runner.c runner.h flex.h $(CC) $(CFLAGS) -o runner.o -c runner.c -runner: lex.yy.c runner.o - $(CC) $(CFLAGS) -o $(EXE) runner.o lex.yy.c +symbol.o: symbol_table.c symbol_table.h + $(CC) $(CFLAGS) -o symbol_table.o symbol_table.c + +runner: lex.yy.c runner.o symbol_table.o + $(CC) $(CFLAGS) -o $(EXE) runner.o lex.yy.c symbol_table.o bison: grammar.y bison -d grammar.y @@ -52,4 +55,4 @@ clean: rm -f *.tok rm -f grammar.tab.c rm -f grammar.tab.h - rm -f *.st \ No newline at end of file + rm -f *.st diff --git a/runner.c b/runner.c index ee872f4..93c9991 100644 --- a/runner.c +++ b/runner.c @@ -1,5 +1,4 @@ //#include "symbol_table.h" -#include "symbol_table.c" #include "runner.h" int main(int argc, char *argv[]) { @@ -88,7 +87,7 @@ int run(FILE *alpha) { if (st_flag != NULL) { //output symbol table, file pointer is - print_symbol_table(curr,st_flag); + print_symbol_table(top,st_flag); } if (yyin != NULL) { @@ -166,7 +165,3 @@ void exit_scope() { } curr = curr->Parent_Scope; } - - - - diff --git a/runner.h b/runner.h index 73c94f2..cd5167f 100644 --- a/runner.h +++ b/runner.h @@ -11,6 +11,7 @@ #include "flex.h" #include "typedefs.h" #include +#include "symbol_table.h" extern int line_number, column_number; extern char *yytext;