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

28
src/grammar.h Normal file
View File

@ -0,0 +1,28 @@
#pragma once
#include "../src/codegen.h"
#include "../src/intermediate_code.h"
#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, ...);
int label_count;
Instruction *begin;
Instruction *current;
int offset;
int currentsp;
CGNode *cgList;