This commit is contained in:
Valk Richard Li 2019-09-09 21:57:04 -05:00 committed by GitHub
parent 3dd7fc7860
commit 582fa63db2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -70,7 +70,7 @@ class code_generator
root.run();
return;
}
void gen_ast()
bool gen_ast()
{
root.return_list().clear();
bool iserror=false;
@ -97,10 +97,10 @@ class code_generator
temp_ast.pop();
}
if(iserror)
return;
return iserror;
std::cout<<">>[Parse] 0 error(s)."<<std::endl;
std::cout<<">>[Parse] Complete checking."<<std::endl;
return;
return false;
}
};

View File

@ -28,7 +28,7 @@ int main()
else if(command=="cls")
{
system("cls");
//windows system("cls);
//windows system("cls");
//linux system("clear");
//macOS system("clear");
}
@ -67,8 +67,8 @@ int main()
lex.lexer_process(prog.use_file());
pas.parse_process(lex.return_list());
cod.input_stack(pas.return_stack());
cod.gen_ast();
cod.run_gen_tree();
if(!cod.gen_ast())
cod.run_gen_tree();
}
else
prog.input_file(command);

View File

@ -1,3 +1,5 @@
1+1+1-123-213+1-1-1-2
32-13-423-24-24+213+12312
0.1+0.2+0.3-0.6
1
10+10+10-30