Add runtime & var

This commit is contained in:
Valk Richard Li
2019-10-24 22:25:13 +08:00
committed by GitHub
parent 4915b2bbf6
commit fbaea6b4bd
5 changed files with 199 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ int main()
resource_programme_process prog;
nasal_lexer lex;
nasal_parser pas;
runtime rt;
std::string command;
std::cout<<">> Nasal interpreter by ValKmjolnir"<<std::endl;
std::cout<<">> Input [help] to find help."<<std::endl;
@@ -61,6 +62,8 @@ int main()
pas.parse_main_work();
if(!pas.get_error_num())
pas.print_generated_ast();
else
std::cout<<">>[Abstract_syntax_tree] error(s) occurred,stop."<<std::endl;
}
else if(command=="run")
{
@@ -69,9 +72,9 @@ int main()
pas.parse_process(lex.return_list());
pas.parse_main_work();
if(!pas.get_error_num())
{
;
}
rt.run_abstract_syntax_tree(pas.get_tree());
else
std::cout<<">>[Runtime] error(s) occurred,stop."<<std::endl;
}
else
prog.input_file(command);