云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 布尔表达式的翻译程序设计

布尔表达式的翻译程序设计

  • 62 次阅读
  • 3 次下载
  • 2025/5/4 21:21:40

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

搜索更多关于: 布尔表达式的翻译程序设计 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

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<

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com