内容发布更新时间 : 2024/12/23 5:11:02星期一 下面是文章的全部内容请认真阅读。
int tcount=0; int wcount=0;
char *rwtab[9]={\class tuidao { public: char a[10]; char b[10]; char c[10]; char d[10];
void emit(char *m,char *n,char *p,char *q);
void print() {cout< }t[100]; void tuidao::emit(char *m,char *n,char *p,char *q) { strcpy(a,m); strcpy(b,n); strcpy(c,p); strcpy(d,q); } class interpreter { private: ifstream SourceFile; char buffercode[200]; int syn; int current; char token[8]; 9 public: void scaner(); void B(); void B1(); void T(); void F(); void T1(); void run(); void read(); void bolon(); void toword(); char *unit(); char *expression(); char *term(); void bolan(); void reset() { current=0; }; void run1() { scaner(); expression(); }; }; void bolan() { strcpy(n.nibolan[tear].w,q[0].arg1);tear++; strcpy(n.nibolan[tear].w,q[0].arg2);tear++; 10 strcpy(n.nibolan[tear].w,q[0].op);tear++; for(int i=0;i for (int j=i-1;j>=0;j--) { if (strcmp(q[i].arg1,q[j].result)==0) { if (strcmp(q[i].arg2,q[j+1].result)==0) {strcpy(n.nibolan[tear].w,q[i].op);tear++;break;} } if else { strcpy(n.nibolan[tear].w,q[i].arg2);tear++; strcpy(n.nibolan[tear].w,q[i].op);tear++; break; } ((strcmp(q[i].arg1,q[j].result)!=0)&&(strcmp(q[i].arg2,q[j+1].result)==0)) { } if strcpy(n.nibolan[tear].w,q[i].op);tear++; strcpy(n.nibolan[head].w,q[i].arg1);head--; break; ((strcmp(q[i].arg1,q[j].result)!=0)&&(strcmp(q[i].arg2,q[j].result)!=0)) { strcpy(n.nibolan[tear].w,q[i].arg1);tear++; 11 strcpy(n.nibolan[tear].w,q[i].arg2);tear++; strcpy(n.nibolan[tear].w,q[i].op);tear++; break; } } } } void interpreter::toword() { current=0; int i=0; while (buffercode[current]!='#') { scaner(); strcpy(wr[wcount].w,token); wcount++; i++; } }; void interpreter::read() { cin.getline(buffercode,200); cout< } void interpreter::run() { current=0; { 12