diff --git a/Makefile b/Makefile index 66f7394..e20c254 100644 --- a/Makefile +++ b/Makefile @@ -26,15 +26,6 @@ vs: $(OBJECTS) objects:$(OBJECTS) test: vs - $(OUTPUT_DIR)/$(VS) -l -p -s test/hello.vs - -test-lex: vs - $(OUTPUT_DIR)/$(VS) -l test/hello.vs - -test-parse: vs - $(OUTPUT_DIR)/$(VS) -p test/hello.vs - -test-gencode: vs $(OUTPUT_DIR)/$(VS) -s test/hello.vs clean: diff --git a/src/vs.cpp b/src/vs.cpp index b9214ef..253353e 100644 --- a/src/vs.cpp +++ b/src/vs.cpp @@ -12,40 +12,19 @@ #include "runtime/VSInterpreter.hpp" int main(int argc, char **argv) { - int show_lex = 0, show_parse = 0, show_gen = 0; - argc--; - argv++; - if (argc > 0 && **argv == '-' && (*argv)[1] == 'l') { - show_lex = 1; - argc--; - argv++; - } - if (argc > 0 && **argv == '-' && (*argv)[1] == 'p') { - show_parse = 1; - argc--; - argv++; + if (argc < 2) { + printf("Usage: %s [-s] \n", *argv); + return -1; } - if (argc > 0 && **argv == '-' && (*argv)[1] == 's') { + + argc--; argv++; + int show_gen = 0; + if (**argv == '-' && (*argv)[1] == 's') { show_gen = 1; argc--; argv++; } - if (argc < 1) { - printf("usage: vsc [-l] [-p] [-s] file ...\n"); - return -1; - } - if (show_lex) { - FILE *f = fopen("tokens.txt", "w"); - // fprint_tokens(f, token_list); - fclose(f); - } - - if (show_parse) { - FILE *f = fopen("astree.txt", "w"); - // fprint_astree(f, astree); - fclose(f); - } init_printer(); VSCompiler *compiler = new VSCompiler(builtin_addrs); VSCodeObject *program = compiler->compile(*argv);