Files
compiler-the-translators/runner.h
2025-02-24 15:28:46 -05:00

42 lines
1.2 KiB
C

#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"
//use to set flags for arg types
#define SET_FLAG 1
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "flex.h"
#include "typedefs.h"
#include <stdbool.h>
#include "symbol_table.h"
#include <sys/stat.h>
extern int line_number, column_number;
extern char *yytext;
extern FILE *yyin;
int arg;
SymbolTable * top;
SymbolTable * curr;
// int main(int argc, char* argv[]);
char *is_tok(int argc, char* argv[]);
// int is_alpha_file(char *file, int file_len);
void enter_scope(int, int);
void exit_scope(void);
FILE *alpha_file;
FILE *tok_flag = NULL;
FILE *st_flag = NULL;
int no_flag = 0;
int main(int argc, char* argv[]);
int new_file(char *arg, char *alpha);
int is_alpha_file(char *alpha, int file_len);
bool is_help(char * input);
int run(FILE*alpha);
int check_flag(char * arg, char* alpha);