.num);}elseif(act.type==1){WF&tt=wf[act.num];inty=st_stack[st_stack.size()-tt.right.length()-1];intx=Goto[y][tt.left[0]];print(get_steps(steps++),get_stk(op_stack),src.substr(i),get_shift(tt),get_stk(st_stack),act.out,get_steps(x));for(intj=0;j<tt.right.length();j++){st_stack.pop_back();op_stack.pop_back();}op_stack.push_back(tt.left[0]);st_stack.push_back(x);i--;}elseif(act.type==2){print(get_steps(steps++),get_stk(op_stack),src.substr(i),"Accept",get_stk(st_stack),act.out,"");}elsecontinue;}}intmain(){intn;chars[MAX];while(~scanf("%d",&n)){for(inti=0;i<n;i++){scanf("%s",s);intlen=strlen(s),j;for(j=0;j<len;j++)if(s[j]=='-')break;s[j]=0;wf.push_back(WF(s,s+j+2,-1,-1));#ifdefDEBUGwf[wf.size()-1].print();#endif}make_item();make_set(); make_V();make_go();make_table();analyse("abbcde");}}运行结果: