/* Runner File - Compiles alpha Compiler */ /* The Translators - Spring 2025 */ #define ALPHA_OFFSET 6 #define TOK_LEN 3 #define ST_LEN 2 #define HELP \ "HELP:\nHow to run the alpha compiler:\n./alpha [options] " \ "program\nValid " \ "options:\n-tok output the token number, token, line number, and " \ "column " \ "number for each of the tokens to the .tok file\n-st output the " \ "symbol " \ "table for the program to the .st file\n-help print this message " \ "and exit " \ "the alpha compiler\n" #define SET_FLAG 1 // Used to set flags for arg types #define INVALID \ "INVALID INPUT: Include a .alpha file or use -help for more inputs \n" #include #include #include #include #include #include "../tmp/flex.h" #include "../tmp/grammar.tab.h" #include "symbol_table.h" extern int line_number, column_number; extern char *yytext; extern FILE *yyin; extern bool DEBUG; SymbolTable *top; SymbolTable *cur; FILE *alpha_file; FILE *tok_flag = NULL; FILE *st_flag = NULL; bool DEBUG = false; int no_flag = 0; int arg; TableNode *funprime; TableNode *arrayprim; TableNode *integ; TableNode *addr; TableNode *chara; TableNode *stri; TableNode *boo; TableNode *recprime; TableNode *funtypeprime; TableNode *undefined; int main(int argc, char *argv[]); int check_flag(char *arg, char *alpha); void incr(int lnum, int cnum, int tok); void print_tok(int tok); int run(FILE *alpha); bool is_help(char *input); int new_file(char *arg, char *alpha); int is_alpha_file(char *alpha, int file_len); char *COLOR_RED = "\033[0;31m"; char *COLOR_GREEN = "\033[0;32m"; char *COLOR_ORANGE = "\033[0;33m"; char *COLOR_BLUE = "\033[0;34m"; char *COLOR_PURPLE = "\033[0;35m"; char *COLOR_CYAN = "\033[0;36m"; char *COLOR_LIGHTGRAY = "\033[0;37m"; char *COLOR_DARKGRAY = "\033[1;30m"; char *COLOR_LIGHTRED = "\033[1;31m"; char *COLOR_LIGHTGREEN = "\033[1;32m"; char *COLOR_YELLOW = "\033[1;33m"; char *COLOR_LIGHTBLUE = "\033[1;34m"; char *COLOR_LIGHTPURPLE = "\033[1;35m"; char *COLOR_LIGHTCYAN = "\033[1;36m"; char *COLOR_WHITE = "\033[1;37m";