raaahhhhhh

This commit is contained in:
Scarlett
2025-05-02 12:47:22 -04:00
parent 41280fe622
commit 856e443181
5 changed files with 16 additions and 4 deletions

View File

@ -3,7 +3,8 @@ CC := gcc
FLEX := flex
BISON = bison
CFLAGS := -ggdb
CFLAGS := -ggdb -g -O0 #-fsanitize=address
# LDFLAGS := -fsanitize=address
BISONFLAGS := -d -Wcounterexamples
LEX := src/lexicalStructure.lex
@ -24,7 +25,7 @@ TESTS-S4 := $(wildcard tests/sprint4/test/*.alpha)
all: compiler
compiler: clean tmp $(OBJS)
$(CC) $(CFLAGS) -o $(EXE) $(OBJS)
$(CC) $(CFLAGS) -o $(EXE) $(OBJS) $(LDFLAGS)
clean:
rm -f $(EXE)

View File

@ -633,7 +633,7 @@ simple_statement:
| RETURN expression {
$$ = getTypeEntry((TableNode*)$2);
emit_return(tn_or_const(NODE,(TableNode*)$2));}
|simple_statement error {yyerrok; printdebug("error in simple statement");}
|simple_statement error {yyerrok; yyclearin; printdebug("error in simple statement");}
;

View File

@ -349,6 +349,11 @@ int label_gen(){
}
void emit_as_file(FILE * out_file, Instruction * i){
if (out_file == NULL){
fprintf(stderr, "Error: output file is NULL\n");
return;
}
if(i == NULL){
return;
}

View File

@ -192,7 +192,7 @@ int new_file(char *arg, char *alpha) {
mkdir("./out", 0777);
char *new_basename = calloc(strlen(basename) + 5, sizeof(char));
char *new_basename = calloc(strlen(basename) + 7, sizeof(char));
strcpy(new_basename, "./out/");
strcat(new_basename, basename);
basename = new_basename;

View File

@ -0,0 +1,6 @@
type main: string -> integer
function entry: main
entry(arg) := {
return 0;
}