fixed issues with the compilation process
This commit is contained in:
11
Makefile
11
Makefile
@ -2,7 +2,7 @@ CC := gcc
|
|||||||
FLEX := flex
|
FLEX := flex
|
||||||
LEX := lexicalStructure.lex
|
LEX := lexicalStructure.lex
|
||||||
EXE := alpha
|
EXE := alpha
|
||||||
CFLAGS :=
|
CFLAGS :=
|
||||||
|
|
||||||
compiler: lex.yy.c runner.o runner
|
compiler: lex.yy.c runner.o runner
|
||||||
|
|
||||||
@ -12,8 +12,11 @@ lex.yy.c: lexicalStructure.lex
|
|||||||
runner.o: runner.c runner.h flex.h
|
runner.o: runner.c runner.h flex.h
|
||||||
$(CC) $(CFLAGS) -o runner.o -c runner.c
|
$(CC) $(CFLAGS) -o runner.o -c runner.c
|
||||||
|
|
||||||
runner: lex.yy.c runner.o
|
symbol.o: symbol_table.c symbol_table.h
|
||||||
$(CC) $(CFLAGS) -o $(EXE) runner.o lex.yy.c
|
$(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: grammar.y
|
||||||
bison -d grammar.y
|
bison -d grammar.y
|
||||||
@ -52,4 +55,4 @@ clean:
|
|||||||
rm -f *.tok
|
rm -f *.tok
|
||||||
rm -f grammar.tab.c
|
rm -f grammar.tab.c
|
||||||
rm -f grammar.tab.h
|
rm -f grammar.tab.h
|
||||||
rm -f *.st
|
rm -f *.st
|
||||||
|
7
runner.c
7
runner.c
@ -1,5 +1,4 @@
|
|||||||
//#include "symbol_table.h"
|
//#include "symbol_table.h"
|
||||||
#include "symbol_table.c"
|
|
||||||
#include "runner.h"
|
#include "runner.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
@ -88,7 +87,7 @@ int run(FILE *alpha) {
|
|||||||
|
|
||||||
if (st_flag != NULL) {
|
if (st_flag != NULL) {
|
||||||
//output symbol table, file pointer is
|
//output symbol table, file pointer is
|
||||||
print_symbol_table(curr,st_flag);
|
print_symbol_table(top,st_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yyin != NULL) {
|
if (yyin != NULL) {
|
||||||
@ -166,7 +165,3 @@ void exit_scope() {
|
|||||||
}
|
}
|
||||||
curr = curr->Parent_Scope;
|
curr = curr->Parent_Scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1
runner.h
1
runner.h
@ -11,6 +11,7 @@
|
|||||||
#include "flex.h"
|
#include "flex.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include "symbol_table.h"
|
||||||
|
|
||||||
extern int line_number, column_number;
|
extern int line_number, column_number;
|
||||||
extern char *yytext;
|
extern char *yytext;
|
||||||
|
Reference in New Issue
Block a user