项目.cpp
来自「八、 设计SAMPLE语言的语法、语义分析器」· C++ 代码 · 共 36 行
CPP
36 行
#include"头文件.h"
int time=0; //表示正在取第几个sign
extern bianYi parse; //词法分析
extern item sign; //
void getnextsign(){
if(time<parse.list3.w)
sign=parse.list3.jieguo[time++];
}
item::item(){};
item::item(int x1,int x2){
x=x1;
y=x2;
};
//
TFL& TFL::operator=(TFL &temp){
for(int z=0;z<headt[0];z++)
headt[z]=temp.headt[z];
for(z=0;z<headf[0];z++)
headf[z]=temp.headf[z];
codebegin=temp.codebegin;
return *this;
}
TFL::TFL( const TFL & temp){
for(int z=0;z<temp.headt[0]+1;z++)
headt[z]=temp.headt[z];
for(z=0;z<temp.headf[0]+1;z++)
headf[z]=temp.headf[z];
codebegin=temp.codebegin;
}
void error(){
cout<<"第"<<parse.list3.hang[time]<<"行:出错~!"<<endl;
exit(1);
}