欢迎来到天天文库
浏览记录
ID:33215433
大小:127.73 KB
页数:14页
时间:2019-02-22
《程序级结果学习资料学习资料》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、#include#includeusingnamespacestd;constintstacksize=32;classstack{public:initstack();voidpush(char);charpop();boolisempty();voidshowstack();~stack();private:inttop;intbase;char*istack;};stack::initstack(){istack=newchar[stacksize];top=base=0;}voidstack::push(chartok
2、en){if(top-base>=stacksize){cout<<"Overflow!"<3、out<4、6]={'i','+','*','(',')','#'};//定义终结符boolisterminal(charc){for(inti=0;i<5;i++)if(c==nt[i])return0;return1;}voidderivation_E(){s.push('P');s.push('T');}voidderivation_P(){s.push('P');s.push('T');s.push('+');}voidderivation_T(){s.push('Q');s.push('F');}voidderivation_Q(){s.push('Q');s.p5、ush('F');s.push('*');}voidderivation_F(){s.push('i');}voidderivation_F1(){s.push(')');s.push('E');s.push('(');}voidLL1(stringstr){intl=str.length();intstep=0,j=0,k=0,n=0;charch,ter;init();cout<<"步骤"<<"t栈"<<"t输入缓冲区"<<"t输出"<6、7、str<8、ndl;break;ca
3、out<4、6]={'i','+','*','(',')','#'};//定义终结符boolisterminal(charc){for(inti=0;i<5;i++)if(c==nt[i])return0;return1;}voidderivation_E(){s.push('P');s.push('T');}voidderivation_P(){s.push('P');s.push('T');s.push('+');}voidderivation_T(){s.push('Q');s.push('F');}voidderivation_Q(){s.push('Q');s.p5、ush('F');s.push('*');}voidderivation_F(){s.push('i');}voidderivation_F1(){s.push(')');s.push('E');s.push('(');}voidLL1(stringstr){intl=str.length();intstep=0,j=0,k=0,n=0;charch,ter;init();cout<<"步骤"<<"t栈"<<"t输入缓冲区"<<"t输出"<6、7、str<8、ndl;break;ca
4、6]={'i','+','*','(',')','#'};//定义终结符boolisterminal(charc){for(inti=0;i<5;i++)if(c==nt[i])return0;return1;}voidderivation_E(){s.push('P');s.push('T');}voidderivation_P(){s.push('P');s.push('T');s.push('+');}voidderivation_T(){s.push('Q');s.push('F');}voidderivation_Q(){s.push('Q');s.p
5、ush('F');s.push('*');}voidderivation_F(){s.push('i');}voidderivation_F1(){s.push(')');s.push('E');s.push('(');}voidLL1(stringstr){intl=str.length();intstep=0,j=0,k=0,n=0;charch,ter;init();cout<<"步骤"<<"t栈"<<"t输入缓冲区"<<"t输出"<6、7、str<8、ndl;break;ca
6、7、str<8、ndl;break;ca
7、str<8、ndl;break;ca
8、ndl;break;ca
此文档下载收益归作者所有