freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內容

安徽合肥工業(yè)大學編譯原理實驗-資料下載頁

2025-06-29 16:42本頁面
  

【正文】 s_have[5].sleft = 39。F39。 strcpy(s_have[5].sright, (E))。//F(E) s_have[6].sleft = 39。F39。 strcpy(s_have[6].sright, i)。//Fi /*存儲ACTION表中的move移進change規(guī)約*/ action[0].move[0] = 5。 action[0].move[3] = 4。 action[1].move[1] = 6。 action[2].change[1] = 2。 action[2].move[2] = 7。 action[2].change[4] = 2。 action[2].change[5] = 2。 action[3].change[1] = 4。 action[3].change[2] = 4。 action[3].change[4] = 4。 action[3].change[5] = 4。 action[4].move[1] = 5。 action[4].move[3] = 4。 action[5].change[1] = 6。 action[5].change[2] = 6。 action[5].change[4] = 6。 action[5].change[5] = 6。 action[6].move[0] = 5。 action[6].move[3] = 4。 action[7].move[0] = 5。 action[7].move[3] = 4。 action[8].change[1] = 6。 action[8].change[4] = 11。 action[9].change[1] = 1。 action[9].move[2] = 7。 action[9].change[4] = 1。 action[9].change[5] = 1。 action[10].change[1] = 3。 action[10].change[2] = 3。 action[10].change[4] = 3。 action[10].change[5] = 3。 action[11].change[1] = 5。 action[11].change[2] = 5。 action[11].change[4] = 5。 action[11].change[5] = 5。 /*存儲GOTO表*/ go[0].head[0] = 39。E39。//符號棧棧頂非終結符 go[0].head[1] = 39。T39。 go[0].head[2] = 39。F39。 go[0].gt[0] = 1。//要使用的文法 go[0].gt[1] = 2。 go[0].gt[2] = 3。 go[4].head[0] = 39。E39。 go[4].head[1] = 39。T39。 go[4].head[2] = 39。F39。 go[4].gt[0] = 8。 go[4].gt[1] = 2。 go[4].gt[2] = 3。 go[6].head[1] = 39。T39。 go[6].head[2] = 39。F39。 go[6].gt[1] = 9。 go[6].gt[2] = 3。 go[7].head[2] = 39。F39。 go[7].gt[2] = 10。 //其它初始化 sta_Index = 0。 status[sta_Index] = 0。 step = 1。 sym_Index = 0。 symbol[sym_Index] = 39。39。 IsAccept = 0。 instr_top = 0。}/*功能:利用狀態(tài)和字符來查找action和goto參數(shù):當前狀態(tài),剩余輸入串棧頂符號,剩余輸入串棧頂符號是第幾個*/void find_table(int sta, char symb, int col){ if (sta == 1 amp。amp。 col == 5) { coutAcc:分析成功\n)。 IsAccept = 1。 return。 } /*查找移進*/ if (action[sta].move[col] != 0) { cout ACTION[ sta , symb ]= S action[sta].move[col] ,PUSH action[sta].move[col] endl。 status[++sta_Index] = action[sta].move[col]。//更新狀態(tài)棧 symbol[++sym_Index] = symb。//更新符號串 instr_top++。//剩余輸入串向后縮1 } /*查找規(guī)約*/ else if (action[sta].change[col] != 0) { cout r action[sta].change[col] : s_have[action[sta].change[col]].sleft s_have[action[sta].change[col]].sright 規(guī)約,GOTO( status[sta_Index strlen(s_have[action[sta].change[col]].sright)] , s_have[action[sta].change[col]].sleft )=。 int i = 0。 for (i = 0。 i strlen(s_have[action[sta].change[col]].sright)。 i++)//規(guī)約:將符號棧中的文法右部去除 symbol[sym_Index] = 39。\039。 symbol[++sym_Index] = s_have[action[sta].change[col]].sleft。//規(guī)約:在符號棧中加入文法左部 for (i = 0。 i strlen(s_have[action[sta].change[col]].sright)。 i++)//去除狀態(tài)棧中對應的狀態(tài) status[sta_Index i] = 39。\039。 sta_Index = i。//指向狀態(tài)棧數(shù)組最后一位的標記減小 change_goto(status[sta_Index], symbol[sym_Index])。 } else cout ERROR endl。}void change_goto(int sta, char symb){ int i = 0。 for (i = 0。 i 3。 i++) { if (go[sta].head[i] == symb) { status[++sta_Index] = go[sta].gt[i]。 cout go[sta].gt[i] PUSH endl。 return。 } }}/*查表*/void start_find(void){ int s = status[sta_Index]。 char exp_first_char = inputstring[instr_top]。 char sym = symbol[sym_Index]。 while (IsAccept != 1) { s = status[sta_Index]。 exp_first_char = inputstring[instr_top]。 sym = symbol[sym_Index]。 /*輸出步驟*/ cout step++\t\t。 /*輸出當前狀態(tài)棧*/ int i = 0。 for (i = 0。 i = sta_Index。 i++) { coutstatus[i]。 } cout \t\t。 /*輸出符號棧*/ cout symbol \t\t。 /*輸出剩余的輸入串*/ i= 0。 for (i = 0。 i instr_top。 i++) cout 。 for (i = instr_top。 i = instr_index。 i++) { coutinputstring[i]。 } cout\t\t。 switch (exp_first_char) { case 39。i39。: find_table(s, exp_first_char, 0)。 break。 case 39。+39。: find_table(s, exp_first_char, 1)。 break。 case 39。*39。: find_table(s, exp_first_char, 2)。 break。 case 39。(39。: find_table(s, exp_first_char, 3)。 break。 case 39。)39。: find_table(s, exp_first_char, 4)。 break。 case 39。39。: find_table(s, exp_first_char, 5)。 break。 } }}int main(){ //cout 輸入要判斷的分析串:。 string temp。 cin temp。 for (int i = 0。i ()。i++) inputstring[i] = temp[i]。 inputstring[()] = 39。39。 instr_index = () + 1。 Initlize()。 cout 步驟 \t\t 狀態(tài)棧 \t符號棧 \t 輸入串 \t 動作\n。 start_find()。 return 0。}四、實驗評價、收獲與體會這一周真是驚險萬分,有周二四個小時OS實驗,周三網(wǎng)絡考試,周三就要驗收實驗,還有一堆事好像老師都喜歡集體行動把事情堆到一起解決。好在挺過來。這個實驗總的來說太難,嘗試了java寫圖形界面和自動化實現(xiàn)分析表等,但是時間緊迫只好以后有時間慢慢搞?,F(xiàn)在的實驗只是一份低配版的實驗,LR分析表都不是自動生成的,是存儲在數(shù)組中直接使用的,所以老師很失望給了及格分,我也很無奈。沒有大神的超速只能怪自己學藝不精,效率太低。希望以后可以快點。
點擊復制文檔內容
環(huán)評公示相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1