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

正文內(nèi)容

編譯原理課程設(shè)計(jì)c語(yǔ)言編譯器的實(shí)現(xiàn)畢業(yè)論文(更新版)

  

【正文】 stack_headnum=0。 if(p==0) temp=tempnext。 int p,q。 coutendl。 else fout1 temp1numendl。 temp3=temp3next。 if(temp1num == 1) { coutendl。 string_tailnext=temp。//形成字符串 else { err=1。 tempcode=25。 tempcode=25。 else if(word==then) tempcode=33。 temp1word=。}void out3(char ch,string word){ token *temp。//界符編碼 default : id=0。 case 39。 case 39。 case 39。 case 39。 switch(ch) { case 39。//空格 else if(feof(fp)) flag=5。=ch amp。//界符 else if((39。{39。*39。 err=1。 return。 cout請(qǐng)輸入源文件路徑及名稱:。 coutendl。 output()。 symb_tailnext=NULL。 L_four_tailnext=NULL。 string_head=new str。//語(yǔ)義 outdaima()。 cout* 第一部分:詞法分析 *endl。//文件指針int wordcount。//向四元式鏈中加一個(gè)結(jié)點(diǎn)void add_L_true(L *temp)。//給輸入字符編號(hào),轉(zhuǎn)化成action表列編號(hào)string ID10(int i)。//void input1(token *temp)。}。//結(jié)果 L *next。//符號(hào)編碼 ike *next。//語(yǔ)法 20個(gè)產(chǎn)生式struct pank//語(yǔ)法 action表結(jié)構(gòu)體{ char sr。//字符串內(nèi)容 str *next。a=(b+ccc)*a+d}本程序的完整源代碼如下:includecstdioincludeiostreamincludecstdlibincludefstreamincludestringincludecmathusing namespace std。由于水平本次實(shí)驗(yàn)涉及面并不是很全面,我只考慮了c語(yǔ)言的一個(gè)子集。}S→if B then MS→if B then A M{backpatch(,) backpatch(,nextquad)}A→∈{:=nextquad}S→while B do MS→while A1 B do A2 M{ backpatch(,) backpatch(,nextquad+1) emit(’goto’)}A1→∈{:=nextquad}A2→∈{:=nextquad}語(yǔ)法翻譯生成的四元式如下:六. 代碼生成目標(biāo)代碼生成階段的任務(wù)是把中間代碼變換成特定機(jī)器上的絕對(duì)指令代碼或可重定位的指令代碼或匯編指令代碼。:=。}E→TE→T{ :=。文法G[P]的DFA圖如下: 有歸約動(dòng)作812765 : int 說(shuō)明語(yǔ)句接受狀態(tài) D id D id3021491011R 。.R 8. P→id()L。} S {id,while,if} { },。RL→L。詞法分析輸入的是c語(yǔ)言源程序,輸出的3是具有獨(dú)立語(yǔ)法意義的單詞符號(hào)。代碼生成階段,將語(yǔ)義分析得到的中間代碼四元式轉(zhuǎn)化為匯編語(yǔ)言的目標(biāo)代碼并輸出。 }D { id } { 。R 3. P→id.()L。D 11. L→L。:*+={}intandifthenwhiledo$PDRETFBMSLN012345678910111213141516170123456789100s211acc2s33s44s5895s66s77r48r39s1010s5s13121111r112r213s14s23s2722211714s1515s36s4116383716r13s43r1317s19s1818r1919s14s23s272220G[P]:SLR(1)分析表Actiongotoid()。}T→FT→F {:=。 :=makelist(nextquad+1)。下面列舉幾個(gè)簡(jiǎn)單的四元式與匯編代碼的轉(zhuǎn)化列子:.(+,A,B,T)→MOV R ,A ;ADD R ,B 。b:int。//遞增編號(hào) token *next。//string隊(duì)列struct ivan//語(yǔ)法 產(chǎn)生式結(jié)構(gòu)體{ char left。pank action[46][18]。//分析棧首尾指針struct L//語(yǔ)義四元式的數(shù)據(jù)結(jié)構(gòu){ int k。//回填false鏈向前指針}。void scan()。//輸出三個(gè)隊(duì)列的內(nèi)容void outfile()。//給非終結(jié)狀態(tài)編號(hào)char ID21(int j)。//向語(yǔ)義符號(hào)表鏈中加一個(gè)結(jié)點(diǎn)void output_yuyi()。//讀取行數(shù)int yuyi_linshi。 cout* 第四部分:目標(biāo)代碼生成 *endl。 return(0)。 string_tailnext=NULL。 L_false_head=new L。 wordcount=0。 coutendl。 coutendl。 cout************************endl。 flag=judge(ch)。 if(ch==39。 || ch==39。 || ch==39。amp。Z39。) { flag=6。break。break。break。break。break。 tempcode=id。 tempnum=1。 word=word+ch。 else if(word==int) tempcode=37。 temp1num=wordcount。 temp1num=wordcount。 }}void input1(token *temp){ if(token_headnext == NULL) { token_headnext=temp。 }}void output(){ couttoken表內(nèi)容如下:endl。 } cout符號(hào)表內(nèi)容如下:endl。 token *temp1。 temp3=new str。 cout************************endl。 cout語(yǔ)法分析過(guò)程如下:endl。 if(p==3) break。 stack_tailpre=stack_head。R。 css[4].left=39。 css[6].right=T。F39。 css[12].left=39。 css[14].right=if B then M。N39。 css[19].right={N}。 } css[1].len=6。//初始化產(chǎn)生式 for(i=0。i++) { for(j=0。//結(jié)束 action[2][1].sr=39。action[4][0].state=5。r39。 action[10][0].sr=39。action[11][17].state=1。s39。 action[15][0].sr=39。action[16][6].state=43。s39。 action[19][0].sr=39。action[19][15].state=27。r39。 action[22][10].sr=39。action[24][12].state=34。r39。 action[28][12].sr=39。action[29][0].state=14。s39。 action[33][14].sr=39。action[34][0].state=31。r39。 action[36][5].sr=39。action[36][10].state=10。r39。 action[38][2].sr=39。action[38][5].state=39。s39。 action[40][3].sr=39。action[40][6].state=7。s39。 action[43][0].sr=39。action[44][2].state=5。r39。 action[45][3].sr=39。action[45][6].state=9。go_to[10][2]=11。go_to[19][8]=20。go_to[41][4]=38。}//設(shè)置變量名稱標(biāo)志 if(i==1) {j=8,id_left=id_num。 if(i==9) j=1。}//設(shè)置while語(yǔ)句中while位置標(biāo)志 if(i==36) {j=16。 if(i==3) ch=。 if(i==11) ch=int。}int ID2(char ch)//按go_to表給非終結(jié)符編號(hào){ int j。 if(ch==39。) j=4。M39。 if(ch==39。) j=100。E39。 if(ch==39。) j=108。}char ID21(int j)//反編號(hào)非終結(jié)符{ char ch。E39。M39。}void add(ike *temp)//加一個(gè)結(jié)點(diǎn){ if(stack_headnext==stack_tail) { temppre=stack_head。 }}void del()//刪除一個(gè)結(jié)點(diǎn){ stack_tailpreprenext=stack_tail。39。 tempnext=NULL。r39。 tempnext=NULL。//在產(chǎn)生樹(shù)的同時(shí)進(jìn)行語(yǔ)義分析 } else if(sr_temp==39。 } return(flag)
點(diǎn)擊復(fù)制文檔內(nèi)容
規(guī)章制度相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1