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

正文內(nèi)容

編譯原理課程設(shè)計(jì)c語(yǔ)言編譯器的實(shí)現(xiàn)畢業(yè)論文-全文預(yù)覽

  

【正文】 p=tempnext。 while(temp!=NULL) { int w。 int p,q。 yufa_initialize()。 coutendl。 temp3=string_headnext。 else fout1 temp1numendl。 temp1=new token。 temp3=temp3next。 str *temp3。 if(temp1num == 1) { coutendl。 token *temp1。 string_tailnext=temp。 token_tailnext=temp。//形成字符串 else { err=1。 temp1word=word。 tempcode=25。 temp1word=word。 tempcode=25。//關(guān)鍵字編碼 input1(temp)。 else if(word==then) tempcode=33。 ch=fgetc(fp)。 temp1word=。 tempnext=NULL。}void out3(char ch,string word){ token *temp。 tempnum=1。//界符編碼 default : id=0。 case 39。 case 39。 case 39。 case 39。 case 39。 case 39。 case 39。 case 39。 case 39。 switch(ch) { case 39。//換行 nl++。//空格 else if(feof(fp)) flag=5。)) flag=3。=ch amp。 ch=39。//界符 else if((39。(39。{39。:39。*39。=39。 err=1。 if(flag==1) out1(ch)。 return。 cout* 第一部分:詞法分析 *endl。 cout請(qǐng)輸入源文件路徑及名稱:。 char ch。 coutendl。 if(m==39。 output()。//初始化字符計(jì)數(shù)器 err=0。 symb_tailnext=NULL。 L_false_headLfalse=NULL。 L_four_tailnext=NULL。//初始化三個(gè)隊(duì)列的首尾指針 L_four_head=new L。 string_head=new str。}//////////////////////////////////詞法分析子程序void cifa_main(){ token_head=new token。//語(yǔ)義 outdaima()。 cout************************endl。 cout* 第一部分:詞法分析 *endl。//語(yǔ)義臨時(shí)變量string E_name,T_name,F_name,M_name,id_name,id1_name,id2_name,errword。//文件指針int wordcount。//輸出中間代碼四元式和最后符號(hào)表string newop(int m)。//向四元式鏈中加一個(gè)結(jié)點(diǎn)void add_L_true(L *temp)。//給非終結(jié)狀態(tài)反編號(hào)void add(ike *temp)。//給輸入字符編號(hào),轉(zhuǎn)化成action表列編號(hào)string ID10(int i)。//輸出三個(gè)隊(duì)列的內(nèi)容到相應(yīng)文件中////////////////////////////////語(yǔ)法分析有關(guān)函數(shù)聲明void yufa_main()。//void input1(token *temp)。//按字符讀取源文件void cifa_main()。}。L *L_four_head,*L_four_tail,*L_true_head,*L_false_head。//結(jié)果 L *next。 string op。//符號(hào)編碼 ike *next。//action表int go_to[46][11]。//語(yǔ)法 20個(gè)產(chǎn)生式struct pank//語(yǔ)法 action表結(jié)構(gòu)體{ char sr。//產(chǎn)生式的左部 string right。//字符串內(nèi)容 str *next。}。a=(b+ccc)*a+d}本程序的完整源代碼如下:includecstdioincludeiostreamincludecstdlibincludefstreamincludestringincludecmathusing namespace std。ccc:int。由于水平本次實(shí)驗(yàn)涉及面并不是很全面,我只考慮了c語(yǔ)言的一個(gè)子集。ST R , T. ( *, A , B , T ) →MOV R ,A ;MUL R ,B 。}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ì)指令代碼或可重定位的指令代碼或匯編指令代碼。 emit(if ’’’goto_ _’)。:=。}F→(E)F→(E){:=。}E→TE→T{ :=。:*+={}intandifthenwhiledo$PDRETFBMSLN0123456789101112131415161701234567891020r17r1721r18r1822r16r1623s312424s34s2525s142626r14r1427s312828s3429s14s293030r15r1531s3232s3333r12r12r1234s313535r11r11r1136r10r10r10r10r1037r8r8r8r8r838r6r6s39r6r639s36s4140G[P]:SLR(1)分析表actiongotoid()。文法G[P]的DFA圖如下: 有歸約動(dòng)作812765 : int 說(shuō)明語(yǔ)句接受狀態(tài) D id D id3021491011R 。.D 12. L→L。.R 8. P→id()L。R 4. P→id(.)L。} S {id,while,if} { },。 }E {(,id } { },。RL→L。二. 程序適用范圍 本程序的使用范圍為:整型常量,四則運(yùn)算(為了簡(jiǎn)化問(wèn)題,本程序只考慮加法運(yùn)算和乘法運(yùn)算)和布爾表達(dá)式以及相應(yīng)的賦值語(yǔ)句,條件轉(zhuǎn)移語(yǔ)句和循環(huán)語(yǔ)句。詞法分析輸入的是c語(yǔ)言源程序,輸出的3是具有獨(dú)立語(yǔ)法意義的單詞符號(hào)。然后對(duì)它進(jìn)行詞法,語(yǔ)法,語(yǔ)義分析,并輸出匯編代碼。代碼生成階段,將語(yǔ)義分析得到的中間代碼四元式轉(zhuǎn)化為匯編語(yǔ)言的目標(biāo)代碼并輸出。流程圖如下: 詞法分析流程圖四. 語(yǔ)法分析.源程序中涉及的文法G[P]定義如下表:說(shuō)明語(yǔ)句表達(dá)式布爾表達(dá)式句法0、P’→PP→id () L。 }D { id } { 。,+,),*,}B { id } {then,do,and}M { id } { },。R 3. P→id.()L。R 7. P→id()L。D 11. L→L。對(duì)于有規(guī)約動(dòng)作和接受的狀態(tài),將其特別標(biāo)明。:*+={}intandifthenwhiledo$PDRETFBMSLN012345678910111213141516170123456789100s211acc2s33s44s5895s66s77r48r39s1010s5s13
點(diǎn)擊復(fù)制文檔內(nèi)容
規(guī)章制度相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1