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

正文內容

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

2025-07-19 11:12 上一頁面

下一頁面
  

【正文】 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。//關鍵字編碼 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請輸入源文件路徑及名稱:。 char ch。 coutendl。 if(m==39。 output()。//初始化字符計數(shù)器 err=0。 symb_tailnext=NULL。 L_false_headLfalse=NULL。 L_four_tailnext=NULL。//初始化三個隊列的首尾指針 L_four_head=new L。 string_head=new str。}//////////////////////////////////詞法分析子程序void cifa_main(){ token_head=new token。//語義 outdaima()。 cout************************endl。 cout* 第一部分:詞法分析 *endl。//語義臨時變量string E_name,T_name,F_name,M_name,id_name,id1_name,id2_name,errword。//文件指針int wordcount。//輸出中間代碼四元式和最后符號表string newop(int m)。//向四元式鏈中加一個結點void add_L_true(L *temp)。//給非終結狀態(tài)反編號void add(ike *temp)。//給輸入字符編號,轉化成action表列編號string ID10(int i)。//輸出三個隊列的內容到相應文件中////////////////////////////////語法分析有關函數(shù)聲明void yufa_main()。//void input1(token *temp)。//按字符讀取源文件void cifa_main()。}。L *L_four_head,*L_four_tail,*L_true_head,*L_false_head。//結果 L *next。 string op。//符號編碼 ike *next。//action表int go_to[46][11]。//語法 20個產生式struct pank//語法 action表結構體{ char sr。//產生式的左部 string right。//字符串內容 str *next。}。a=(b+ccc)*a+d}本程序的完整源代碼如下:includecstdioincludeiostreamincludecstdlibincludefstreamincludestringincludecmathusing namespace std。ccc:int。由于水平本次實驗涉及面并不是很全面,我只考慮了c語言的一個子集。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}語法翻譯生成的四元式如下:六. 代碼生成目標代碼生成階段的任務是把中間代碼變換成特定機器上的絕對指令代碼或可重定位的指令代碼或匯編指令代碼。 emit(if ’’’goto_ _’)。:=。}F→(E)F→(E){:=。}E→TE→T{ :=。:*+={}intandifthenwhiledo$PDRETFBMSLN0123456789101112131415161701234567891020r17r1721r18r1822r16r1623s312424s34s2525s142626r14r1427s312828s3429s14s293030r15r1531s3232s3333r12r12r1234s313535r11r11r1136r10r10r10r10r1037r8r8r8r8r838r6r6s39r6r639s36s4140G[P]:SLR(1)分析表actiongotoid()。文法G[P]的DFA圖如下: 有歸約動作812765 : int 說明語句接受狀態(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。二. 程序適用范圍 本程序的使用范圍為:整型常量,四則運算(為了簡化問題,本程序只考慮加法運算和乘法運算)和布爾表達式以及相應的賦值語句,條件轉移語句和循環(huán)語句。詞法分析輸入的是c語言源程序,輸出的3是具有獨立語法意義的單詞符號。然后對它進行詞法,語法,語義分析,并輸出匯編代碼。代碼生成階段,將語義分析得到的中間代碼四元式轉化為匯編語言的目標代碼并輸出。流程圖如下: 詞法分析流程圖四. 語法分析.源程序中涉及的文法G[P]定義如下表:說明語句表達式布爾表達式句法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。對于有規(guī)約動作和接受的狀態(tài),將其特別標明。:*+={}intandifthenwhiledo$PDRETFBMSLN012345678910111213141516170123456789100s211acc2s33s44s5895s66s77r48r39s1010s5s13
點擊復制文檔內容
規(guī)章制度相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1