This commit is contained in:
Valk Richard Li
2020-07-15 01:59:38 -07:00
committed by GitHub
parent b5f0eddb4c
commit 6ba888e445
4 changed files with 279 additions and 12 deletions

View File

@@ -65,6 +65,23 @@ void par_func()
return;
}
void ast_func()
{
lexer.scanner(resource.get_file());
if(!lexer.get_error())
{
parse.set_toklist(lexer.get_token_list());
parse.main_process();
if(parse.get_error())
std::cout<<">> [parse] error(s) occurred,stop.\n";
else
parse.get_root().print_ast(0);
}
else
std::cout<<">> [lexer] error(s) occurred,stop.\n";
return;
}
int main()
{
#ifdef _WIN32
@@ -116,9 +133,7 @@ int main()
else if(command=="par")
par_func();
else if(command=="ast")
{
;
}
ast_func();
else if(command=="run")
{
;