全文预览

编译原理课程设计-LR分析器总控程序的实现

上传者:菩提 |  格式:doc  |  页数:15 |  大小:0KB

文档介绍
{Р?char x;Р?int y,z;Р?x = get_top2(hwnd,instr_p); //输入栈的内容Р?y = get_top1(hwnd,status_p); //状态栈栈顶内容Р?z = get_index_char(x); //得到i,*等相当于二维数组Р?return table[y][z];Р}Рvoid action(HWND hwnd,status *status_p,symbol_instr *symbol_p,symbol_instr *instr_p)Р{Р?int i,j,x;Р?char a;Р?i = goto_char(hwnd,status_p,instr_p); Р?//规约出错Р?if(i == -1)Р MessageBox(hwnd,TEXT("规约出错!"),TEXT("结束"),MB_OK|MB_ICONEXCLAMATION);Р?//规约成功Р?if(i == 12)Р?{Р MessageBox(hwnd,TEXT("规约成功!"),TEXT("结束"),MB_OK|MB_ICONEXCLAMATION);Р flag=1;Р?}Р?//移进动作Р?if(i>=0 && i<=11)?Р?{Р push1(hwnd,status_p,i);Р a = pop2(hwnd,instr_p);Р push2(hwnd,symbol_p,a);Р print(hwnd,status_p,symbol_p,instr_p);Р?}Р?//规约动作Р?if(i>=21 && i<=26)Р?{Р x = r[i-21].y;Р for(j=0;j<x;j++)Р {Р pop1(hwnd,status_p);Р pop2(hwnd,symbol_p);Р }Р push2(hwnd,instr_p,r[i-21].x);

收藏

分享

举报
下载此文档