Merge branch 'Dev' into Sprint2-SymbolTableOperations-FE-t#29

This commit is contained in:
maxsimongt3
2025-02-21 14:53:25 -05:00
committed by GitHub
7 changed files with 155 additions and 119 deletions

View File

@ -1,25 +1,22 @@
#define ALPHA_OFFSET 6
#define TOK_LEN 3
//returns for is_tok
#define INVALID_ARG "invalid"
#define CHECK_OTHER "diff"
//argument type in main
#define NO_ARG 0
#define DIFF_ARG 1
#define TOK_ARG 2
#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>
extern int line_number, column_number;
extern char *yytext;
extern FILE *yyin;
int arg;
SymbolTable * top;
SymbolTable * curr;
@ -28,3 +25,15 @@ 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);