欢迎来到天天文库
浏览记录
ID:50116018
大小:173.50 KB
页数:9页
时间:2020-03-04
《LR0分析法编译原理实验.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、.代码清单:#include#include#include#include#include#include#include#include#include#include#defineMAX507#defineDEBUGusingnamespacestd;classWF{public:stringleft,right;intback;intid;WF(chars1[],chars2[],intx,inty){left=
2、s1;right=s2;back=x;id=y;}WF(conststring&s1,conststring&s2,intx,inty){left=s1;right=s2;back=x;id=y;}booloperator<(constWF&a)const{if(left==a.left)returnright%s",left.c_str
3、(),right.c_str());}};classClosure{public:vectorelement;voidprint(stringstr){printf("%-15s%-15s","",str.c_str());for(inti=0;i4、ent[i]==a.element[i])continue;elsereturnfalse;returntrue;}};structContent{inttype;intnum;stringout;Content(){type=-1;}Content(inta,intb):type(a),num(b){}};页脚.vectorwf;map>dic;stringstart="S";vectorcollection;vectoritems;charCH='$';intgo[MAX][MAX];intto[MAX];v5、ectorV;boolused[MAX];Contentaction[MAX][MAX];intGoto[MAX][MAX];voidmake_item(){memset(to,-1,sizeof(-1));for(inti=0;i6、items.size();items.push_back(WF(wf[i].left,temp,i,items.size()));}#ifdefDEBUGputs("-------------------------项目表-------------------------");for(inti=0;i%s",items[i].left.c_str(),items[i].right.c_str());puts("--------------------------------------------------------7、");#endif}voidmake_set(){boolhas[MAX];for(inti=0;i&element=temp.element;element.push_back(items[i]);intx=0;for(x=0;
4、ent[i]==a.element[i])continue;elsereturnfalse;returntrue;}};structContent{inttype;intnum;stringout;Content(){type=-1;}Content(inta,intb):type(a),num(b){}};页脚.vectorwf;map>dic;stringstart="S";vectorcollection;vectoritems;charCH='$';intgo[MAX][MAX];intto[MAX];v
5、ectorV;boolused[MAX];Contentaction[MAX][MAX];intGoto[MAX][MAX];voidmake_item(){memset(to,-1,sizeof(-1));for(inti=0;i6、items.size();items.push_back(WF(wf[i].left,temp,i,items.size()));}#ifdefDEBUGputs("-------------------------项目表-------------------------");for(inti=0;i%s",items[i].left.c_str(),items[i].right.c_str());puts("--------------------------------------------------------7、");#endif}voidmake_set(){boolhas[MAX];for(inti=0;i&element=temp.element;element.push_back(items[i]);intx=0;for(x=0;
6、items.size();items.push_back(WF(wf[i].left,temp,i,items.size()));}#ifdefDEBUGputs("-------------------------项目表-------------------------");for(inti=0;i%s",items[i].left.c_str(),items[i].right.c_str());puts("--------------------------------------------------------
7、");#endif}voidmake_set(){boolhas[MAX];for(inti=0;i&element=temp.element;element.push_back(items[i]);intx=0;for(x=0;
此文档下载收益归作者所有