Project restucture with IR and CG

This commit is contained in:
Scarlett
2025-04-25 19:29:05 -04:00
parent bac8cb53bb
commit 086c8ba170
15 changed files with 1262 additions and 1270 deletions

View File

@ -17,22 +17,7 @@
// Please ask Scarlett if you are unsure of how to format something. Thanks! 😀
%{
#include "../src/symbol_table.h"
extern FILE *asc_flag;
extern bool tc_flag;
typedef enum {
ERROR_RUNTIME = 1,
ERROR_SYNTAX = 2,
ERROR_TYPE = 3,
ERROR_UNDEFINED = 4
} ErrorType;
int token_tracker;
TableNode * tn;
void yyerror(const char *err);
void throw_error(ErrorType error_type, const char *format, ...);
#include "../src/grammar.h"
%}
%union {
@ -630,7 +615,7 @@ expression:
$$ = node;
} else {
$$=undefined;
error_type(getTypeEntry((TableNode*)$2), integ, "");
throw_error(ERROR_TYPE, "%s != %s", getName(getTypeEntry((TableNode*)$2)), getName(integ));
}
}