30 lines
937 B
C
30 lines
937 B
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>
|
|
|
|
extern int line_number, column_number;
|
|
extern char *yytext;
|
|
extern FILE *yyin;
|
|
int arg;
|
|
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);
|