天津理工大学编译原理实验3:语义分析及中间代码生成

2026/4/27 18:21:26

}

else if(production==\ { char sx='7'; (*index)++; pushstack(stack,pointer,state_stack,pointer_state,c,sx,0); }

else if(production==\ { char sx='8'; (*index)++; pushstack(stack,pointer,state_stack,pointer_state,c,sx,0); }

else if(production==\ { char sx='9'; (*index)++; pushstack(stack,pointer,state_stack,pointer_state,c,sx,0); }

else if(production==\ { char sx='a'; (*index)++; pushstack(stack,pointer,state_stack,pointer_state,c,sx,0); }

else if(production==\ { char sx='b'; (*index)++; pushstack(stack,pointer,state_stack,pointer_state,c,sx,0); }

else if(production==\ { char sx='i'; (*index)++; pushstack(stack,pointer,state_stack,pointer_state,c,sx,0); }

else if(production==\ { int po=(*pointer);//用P规约该表达式,有效变量在E的endchar中,需要找到E的位置,即下面的操作 string st=stack[po].endchar;//对应 F po-=2; string se=stack[po].endchar;//在规约之前记录下要规约的字符所代表的变量。对应 T

tsize++;//新增临时变量 t[tsize].num=tsize+1;//下面四个表达式是按照上面的规约式进行的赋值 t[tsize].operate='+'; t[tsize].var1=se; t[tsize].var2=st; cout<<\ int p=(*pointer_state); p-=3; char second=state_stack[p]; int i=getraw(second); int j=getcol('E'); char c_out=getraw_content(table[i][j]); cout<<\用E-->E+T规约且\ popstack(state_stack,pointer_state,3); popstackc(stack,pointer,3); char c='E';//str[(*index)]; pushstack(stack,pointer,state_stack,pointer_state,c,c_out,1); string s=get_tx(t[tsize].num); stack[(*pointer)].endchar=s;//把保存E+T规约的结果的变量保存至当前字符的终结符 }

else if(production==\ { int po=(*pointer);//用P规约该表达式,有效变量在E的endchar中,需要找到E的位置,即下面的操作 string st=stack[po].endchar;//对应 T po-=2; string se=stack[po].endchar;//在规约之前记录下要规约的字符所代表的变量。对应 E tsize++;//新增临时变量 t[tsize].num=tsize+1;//下面四个表达式是按照上面的规约式进行的赋值 t[tsize].operate='-'; t[tsize].var1=se; t[tsize].var2=st; cout<<\ int p=(*pointer_state); p-=3; char second=state_stack[p]; int i=getraw(second); int j=getcol('E'); char c_out=getraw_content(table[i][j]); cout<<\用E-->E-T规约且\ popstack(state_stack,pointer_state,3);


天津理工大学编译原理实验3:语义分析及中间代码生成.doc 将本文的Word文档下载到电脑
搜索更多关于: 天津理工大学编译原理实验3:语义分析及中间代码生成 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219