Delete nasal_interpreter.cpp

This commit is contained in:
Valk Richard Li 2019-09-29 11:03:38 +08:00 committed by GitHub
parent 5ab4adfa79
commit d3fbec0978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 61 deletions

View File

@ -1,61 +0,0 @@
#include "nasal.h"
int main()
{
std::string command;
std::cout<<">> nasal-- script by ValKmjolnir"<<std::endl;
std::cout<<">> input \"help\" to find help."<<std::endl;
while(1)
{
std::cout<<">> ";
std::getline(std::cin,command);
if(command=="help")
{
std::cout<<">> nasal script by ValKmjolnir"<<std::endl;
std::cout<<">> 1. |input file name to run the lexer. (-lexer)"<<std::endl;
std::cout<<">> 2. \"cls\" |clear the screen."<<std::endl;
std::cout<<">> 3. \"exit\" |shut down the program."<<std::endl;
std::cout<<">> 4. \"lexer\" |see tokens in stack."<<std::endl;
std::cout<<">> 5. \"parser\"|run parser. (-parser)"<<std::endl;
std::cout<<">> 6. \"del\" |delete all elements in stack."<<std::endl;
std::cout<<">> 7. \"run\" |run the programme in stack. (-lexer -parser)"<<std::endl;
std::cout<<">> 8. \"rs\" |check the source program."<<std::endl;
}
else if(command=="cls")
{
system("cls");
//linux system("clear");
//macOS system("clear");
}
else if(command=="rs")
nasal::PrintSourceFile();
else if(command=="exit")
{
break;
}
else if(command=="lexer")
nasal::nasal_lexer.print();
else if(command=="del")
{
nasal::ResourceProgram[0]=0;
nasal::nasal_lexer.delete_all();
nasal::nasal_parse.stack_set_empty();
nasal::nasal_var_stack.delete_all();
nasal::nasal_func_stack.delete_all();
std::cout<<">>[Delete] Complete."<<std::endl;
}
else if(command=="parser")
{
nasal::nasal_parse.print_parser(nasal::nasal_lexer);
nasal::nasal_parse.print_error();
}
else if(command=="run")
{
nasal::nasal_parse.run_parser(nasal::nasal_lexer);
nasal::nasal_parse.print_error();
}
else
nasal::RunProcess(command);// in this section the lexer is cleaned
}
return 0;
}