diff options
Diffstat (limited to 'Sencha-lang/main.cpp')
-rw-r--r-- | Sencha-lang/main.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/Sencha-lang/main.cpp b/Sencha-lang/main.cpp index 74d523d..6269f0a 100644 --- a/Sencha-lang/main.cpp +++ b/Sencha-lang/main.cpp @@ -206,46 +206,46 @@ void interactive() int main(int argc, char *argv[])
{ -
- cout << "Sencha-lang interpreter, version 0.12" << endl; - if(argc <= 1) - { - //TestLexer test_l; - //test_l.run_tests(); + if(argc <= 1) + { + //TestLexer test_l; + //test_l.run_tests(); - //test_parser(); - //test_lexer(); - interactive(); - } - else - { - auto name = argv[1]; - Lexer lexer; - Context context; - context.register_function("print", print); - context.register_function("sin", s_sin); - context.register_function("cos", s_cos); - context.register_function("tan", s_tan); - - Parser parser(&context); - vector<Token> tokens; - string line; - ifstream input_file (name); - - if (input_file.is_open()) - { - while ( input_file.good() ) - { - getline (input_file,line); - tokens = lexer.parse_line(line); - parser.add_tokens(tokens); - } - input_file.close(); - } - - parser.interpret(); - parser.program->execute(); - } + + //test_parser(); + //test_lexer(); + cout << "Sencha-lang interpreter, version 0.12" << endl; + interactive(); + } + else + { + auto name = argv[1]; + Lexer lexer; + Context context; + context.register_function("print", print); + context.register_function("sin", s_sin); + context.register_function("cos", s_cos); + context.register_function("tan", s_tan); + + Parser parser(&context); + vector<Token> tokens; + string line; + ifstream input_file (name); + + if (input_file.is_open()) + { + while ( input_file.good() ) + { + getline (input_file,line); + tokens = lexer.parse_line(line); + parser.add_tokens(tokens); + } + input_file.close(); + } + + parser.interpret(); + parser.program->execute(); + } - return 0;
+ return 0;
}
|