}
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);
相关推荐: