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

正文內(nèi)容

編譯技術(shù)課程設(shè)計(jì)報(bào)告-詞法分析、語(yǔ)法分析、中間代碼生成(更新版)

  

【正文】 。 rt=YT2(t1)。 t1=rt。 int rr=newTemp()。 int rr=newTemp()。 rt=YE2(t1)。 t[num1].operator+=(strn)。 int nn。 int YT2(int a)。 temp++。ε endl。amp。 F1()。 } else if (flags[temp]!=0||flags[temp]!=17)//如果是非 或非) { 第 26 頁(yè) coutT39。 } void T2() { if(flags[temp]==10||flags[temp]==13)//如果是乘或除 { coutT39。*Fendl。 return 。E39。 } else if(flags[temp]==12)//減號(hào) { coutE39。39。 void E2()。\039。\039。\039。 words[j+1] = 39。:{ 第 23 頁(yè) words[j] = ch。}39。 } case39。 break。 flag = 17。\039。 words[j+1] = 39。\039。) words[j++] = ch。 flag = 11。 words[j] = 39。 } else { i。\039。) words[j++] = ch。 flag = 9。 words[j] = 39。+39。\039。) words[j++] = ch。 flag = 14。 words[j] = 39。 } else { i。\039。 flag = 8。 ch = program[i++]。 i。amp。) amp。 status = 1。 break。 ch=program[i++]。z39。amp。a39。//標(biāo)括識(shí)符 int temp=0。由于課堂上,學(xué)習(xí)的東西比較淺,難免眼高手低,故而,通過(guò)實(shí)驗(yàn)和課程,遇到了很多課本上 面見(jiàn)不到的問(wèn)題,完成實(shí)驗(yàn)后,個(gè)人在成就感的同時(shí),也學(xué)習(xí)到了編程的具體過(guò)程中的很多知識(shí)。 } else is_right=0。如果是,調(diào)用 F1 函數(shù),返回。amp。 F()。 F1 函數(shù):判斷是不是” **” ,如果是,調(diào)用 F 函 數(shù),如果不是,進(jìn)行出錯(cuò)處理,置 is_right 為 0。 T1()。 F()。 T2()。 return 。E39。 } else if(flags[temp]==12)//減號(hào) { coutE39。39。 如果是其他單詞表的符號(hào),則將他們的 flags[]置為相應(yīng)的種別碼,并將字符存到words[] 中返回主函數(shù)輸出。 39。 而絕對(duì)不要寫(xiě)成 ifi0 i=1。 二、任務(wù) 及要求 基本要求: 1. 詞法分析器 產(chǎn)生下述小語(yǔ)言的單詞序列 這個(gè) 小語(yǔ)言 的所有的單詞符號(hào),以及它們的種別編碼和內(nèi)碼值如下表: 單詞符號(hào) 種別編碼 助記符 內(nèi)碼值 while 1 while ? if 2 if ? else 3 else ? switch 4 switch ? case 5 case ? 標(biāo)識(shí)符 6 id 符號(hào)表入口地址 常數(shù) 7 num 常數(shù)表入口地址 = 8 = ? + 9 + ? * 10 * ? ** 11 ** ? ? 12 ? ? / 13 / ? 14 relop MT = 14 relop ME 14 relop LT = 14 relop LE == 14 relop EQ != 14 relop UEQ ; 15 ; ? , 16 , ? ( 17 ( LB ) 17 ) RB 對(duì)于這個(gè) 小語(yǔ)言 ,有幾點(diǎn)重要的限制: 首先 ,所有的關(guān)鍵字(如 if﹑ while 等)都是“保留字”。也就是說(shuō),對(duì)于關(guān)鍵字不專(zhuān)設(shè)對(duì)應(yīng)的轉(zhuǎn)換圖。 3. 中間代碼生成器 產(chǎn)生上述算術(shù)表達(dá)式的中間代 碼(四元式序列) 較高要求: 1. 擴(kuò)充上述小語(yǔ)言的單詞; 2. 增加語(yǔ)法分析器的功能,能識(shí)別條件語(yǔ)句和循環(huán)語(yǔ)句等; 3. 增加中間代碼生成器的功能,能產(chǎn)生條件語(yǔ)句和循環(huán)語(yǔ)句等的中間代碼(四元式序列) 4. 報(bào)錯(cuò)基礎(chǔ)上增加錯(cuò)誤信息; 5. 將中間代碼翻譯成匯編語(yǔ)言。 Number存放整數(shù)值, words[]存放標(biāo)識(shí)符,關(guān)鍵字或者其他符號(hào)。is_right) 為真,就輸出“分析成功”,否則輸出“分析失敗”。 E2()。 T()。 E1()。 T1 函數(shù):判斷是不是” *”或者“ /” 如果是,調(diào)用 F 函數(shù),如果不是,進(jìn)行出錯(cuò) 處理,置 is_right 為 0。 temp++。39。39。 P()。flags[temp]!=17amp。flags[temp]!=13)//非 非)非 +非 非 *非 / { coutF39。 } else if(flags[temp]==17) //( { coutP(E)endl。 temp 用來(lái)存放數(shù)組的下表,在主程序中語(yǔ)法分析結(jié)束后,置 0. 定義函數(shù) newtemp()用于門(mén)生一個(gè)新的臨時(shí)變量的名字,具體實(shí)現(xiàn)時(shí)每 產(chǎn)生一個(gè) T,就及時(shí)送到符號(hào)表中,也可以不進(jìn)符號(hào)表,直接將單詞值用整 數(shù)碼表示。 /*status which is use to judge the string is keywords or not!*/ char ch。 //關(guān)鍵字 number=0。 (ch = 39。)) //字母 { while ((ch = 39。)amp。\039。 break。 status = 1。939。 )) { number = number*10+(ch39。:{ if (ch == 39。) { words[j++] = ch。39。=39。 } 第 19 頁(yè) case39。 if (ch == 39。 } break。 ch = program[i++]。 flag = 18。\039。 } else if (ch == 39。 } break。 ch = program[i++]。39。 } 第 21 頁(yè) case39。 if (ch == 39。 } break。 ch = program[i++]。 flag = 13。 break。 } case39。[39。:{ words[j] = ch。 words[j+1] = 39。\039。 flag = 22。 break。 } case39。 } //case39。 //} default:{ flag = 1。 void T2()。 E2()。 T()。 E1()。39。 } else if(flags[temp]==13) //除號(hào) { coutT39。T39。 return 。 temp++。flags[temp]!=12amp。 temp++。 } //語(yǔ)義分析以及中間代碼生成 int YE()。 int YP()。 stringstream stream。 return num1。 t1=a。 return rt。 return rt。 } else if (flags[temp]!=0||flags[temp]!=17) { return t1。 t1=a。 return rt。 return rt。 } else return t。 if(flags[temp]==11) { temp++。 } else return t1。 rt=YE()。 printf((while,1) (if,2) (else,3) (switch,4) (case,5)\n)。 printf((!=,14) (。 int i=0。 printf(\n)。 streamt[num]。 } } }while (flag != 0)。is_right) { printf(\n)。 }
點(diǎn)擊復(fù)制文檔內(nèi)容
研究報(bào)告相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1