some functions of PDA in parser updated.

This commit is contained in:
Valk Richard Li
2019-08-14 02:26:42 +08:00
committed by GitHub
parent b4f86ba667
commit 62e1837704
6 changed files with 89 additions and 49 deletions
+13 -12
View File
@@ -1,11 +1,9 @@
#include <iostream>
#include <cstring>
#include <cstdlib>
#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)
{
@@ -13,13 +11,15 @@ int main()
std::getline(std::cin,command);
if(command=="help")
{
std::cout<<">> 1. input file name to run the nasal script."<<std::endl;
std::cout<<">> 2. command cls to clear the screen."<<std::endl;
std::cout<<">> 3. command exit to shut down the program."<<std::endl;
std::cout<<">> 4. command lexer to see tokens in stack."<<std::endl;
std::cout<<">> 5. command del to delete all elements in stack."<<std::endl;
std::cout<<">> 6. command run to run the programme in stack."<<std::endl;
std::cout<<">> 7. command rs to check the source program."<<std::endl;
std::cout<<">> nasal-- script by ValKmjolnir"<<std::endl;
std::cout<<">> 1. input file name to run the lexer."<<std::endl;
std::cout<<">> 2. command \"cls\" to clear the screen."<<std::endl;
std::cout<<">> 3. command \"exit\" to shut down the program."<<std::endl;
std::cout<<">> 4. command \"lexer\" to see tokens in stack."<<std::endl;
std::cout<<">> 5. command \"parser\" to run parser."<<std::endl;
std::cout<<">> 6. command \"del\" to delete all elements in stack."<<std::endl;
std::cout<<">> 7. command \"run\" to run the programme in stack."<<std::endl;
std::cout<<">> 8. command \"rs\" to check the source program."<<std::endl;
}
else if(command=="cls")
{
@@ -41,10 +41,11 @@ int main()
nasal::nasal_var_stack.delete_all();
nasal::nasal_func_stack.delete_all();
}
else if(command=="parser")
nasal::nasal_parse.parse_work(nasal::nasal_lexer);
else if(command=="run")
{
nasal::nasal_var_stack.delete_all();
nasal::nasal_func_stack.delete_all();
;
}
else
nasal::RunProcess(command);