Merge branch 'Sprint4-Merge_IR_Into_Symbol_Table' into Sprint4-ASC_TC-FE-t#NoTask

This commit is contained in:
Scarlett
2025-04-25 17:49:25 -04:00
10 changed files with 1499 additions and 113 deletions

View File

@ -2,7 +2,8 @@
/* The Translators - Spring 2025 */
#include "runner.h"
FILE *ir_flag = NULL;
//Constant_Stack *head = NULL;
int main(int argc, char *argv[]) {
if (argc == 1) {
fprintf(stderr, INVALID);
@ -35,6 +36,7 @@ int main(int argc, char *argv[]) {
alpha_file = fopen(argv[argc - 1], "r");
}
}
cg_flag = fopen("cg.s", "w");
return run(alpha_file);
}
@ -140,7 +142,10 @@ int run(FILE *alpha) {
if (st_flag != NULL) {
print_symbol_table(top, st_flag);
emit_as_file(stdout, begin);
fclose(st_flag);
generate();
fclose(cg_flag);
}
if (asc_flag != NULL) {
@ -157,10 +162,10 @@ int run(FILE *alpha) {
fclose(ir_flag);
}
if (cg_flag != NULL) {
printf("Flag -cg is not implemented yet\n");
fclose(cg_flag);
}
//if (cg_flag != NULL) {
// printf("Flag -cg is not implemented yet\n");
//fclose(cg_flag);
//}
if (yyin != NULL) {
fclose(yyin);