diff options
author | Galin Simeonov <gts@volconst.com> | 2021-05-31 22:02:10 +0300 |
---|---|---|
committer | Galin Simeonov <gts@volconst.com> | 2021-07-15 18:00:15 +0300 |
commit | 255a49ba5a41b3854dbdfebdec75fb6229450507 (patch) | |
tree | 616ea5786cb91d03ef609d32b402941dc30e926b /main.c | |
parent | f768d9bdb84e846d89aac66a4f3433a44241c298 (diff) | |
download | MEGATRON-255a49ba5a41b3854dbdfebdec75fb6229450507.tar.gz |
added cmake file
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 60 |
1 files changed, 0 insertions, 60 deletions
@@ -1,60 +0,0 @@ -#include <stdio.h> -#include <program.h> -#include <lexer.h> -#include <string.h> -#include <parser.h> -#include <print.h> - - - -int main(int argc,char **argv) -{ - struct Options *options; - struct Source *source; - struct Program *program; - struct Translation_Data *translation_data; - struct AST* translation_unit; - - options=parse_command_line(argc,argv); - if(options->src_name==NULL) - { - printf("No source file specified\n"); - return 0; - } - source=extract_source(strndup(options->src_name,100)); - translation_data=get_translation_data(); - - if(options->target==OPTION_TARGET_TOKENS || options->target==OPTION_TARGET_AST) - { - lex(translation_data->tokens,source,translation_data); - if(translation_data->errors->size>0) - { - printf("There was an error!\n"); - print_tokens(translation_data->tokens); - return 1; - }else if(options->target==OPTION_TARGET_TOKENS) - { - print_tokens(translation_data->tokens); - }else if(options->target==OPTION_TARGET_AST) //we check because we will probably add more options - { - translation_unit=parse_unit(translation_data); - if(has_new_errors(translation_data)) - { - print_errors(translation_data); - return 1; - }else - { - print_ast(translation_unit); - delete_ast(translation_unit); - } - } - - }else - { - assert(!"false"); - } - - delete_source(source); - delete_options(options); - return 0; -} |