stacka[top]=item; }
string stack::pop(void) //出栈操作 {
if(empty()) {
cerr<<"stack empty, cannot pop."<<endl; exit(1) ; }
string item=stacka[top]; top--;
return item; }
string stack::gettop(void) const //取栈顶操作 {
if(empty()) {
cerr<<"stack empty, cannot gettop."<<endl; exit(1) ; }
return stacka[top]; }
static stack wordStack; //符号栈 static int noOfQuet=0; //静态四元式个数记录 static int noOfT = 1; //静态状态个数记录
void main(){ //主函数 char yesOrNo; //进行一个循环操作控制 do{ cout<<"请输入算术表达式:"<<endl; noOfT = 1; //每次结束询问 ZMachine(); cout<<endl<<"Continue?Yes or Not:"; cin>>yesOrNo; //输入“Y”则继续 }while(yesOrNo=='y'); //否则程序结束 }
bool ZMachine(){ //Z自动机 char w; cin>>w; w = EMachine(w); //调用E自动机
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库编译原理词法分析器语法分析器实验报告(18)在线全文阅读。
相关推荐: