小組編譯報(bào)告代碼ben_第1頁(yè)
小組編譯報(bào)告代碼ben_第2頁(yè)
小組編譯報(bào)告代碼ben_第3頁(yè)
小組編譯報(bào)告代碼ben_第4頁(yè)
小組編譯報(bào)告代碼ben_第5頁(yè)
已閱讀5頁(yè),還剩63頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、.c#include #includemmm.h #include #include #definelongnum#defineTP#definemaxlinechar op10; .c#include #includemmm.h #include #include #definelongnum#defineTP#definemaxlinechar op10; FILE*fasm;typedefchar typedefcharstructinfo table100;typedefcharstructinfo table100;info anotable100;typedefstructchar

2、 op10; char var230; char var330; charnamelongnum; float constnum;chartypeTP; typedefdouble shuzi;FILE *fp;FILEchar ch;charcharcharfloat realnum; chardouble shuzi;FILE *fp;FILEchar ch;charcharcharfloat realnum; char變量,12是float變量,13是char變量,21常量,22float常量,23是char常量/3是子程序,4 floatcharsignkindcharp30; /li

3、nechari = q= f= index=retflag =0; charvoid wordslist()q= f= index=retflag =0; charvoid wordslist() getsign(); while(sign!=ifsign& getsign(); while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & if (sign=identitysign) char names30; s= if(s=-2) & sign!=returnsign & sign!=scanfsign &

4、fsign emit(=,p,if (sign!=semsign) while(sign!=ifsignemit(=,p,if (sign!=semsign) while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign & sign!=identitysign& sign!=returnsign & sign!=scanfsign & fsign if(sign!=rparenthesessign) while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbrac

5、ketsign & sign!=identitysign& sign!=returnsign & sign!=scanfsign & fsign if (s=-1 | s=-3) while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign & sign!=identitysign& sign!=returnsign & sign!=scanfsign & fsign whilewhile(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign & si

6、gn!=identitysign& sign!=returnsign & sign!=scanfsign & fsign elsewhile(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign & fsign while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign & fsign while(s

7、ign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign & fsign if (sign!=semsign) while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign & fsign return ;while (sign!=ifsign & sign!=whilesign & sign!=forsig

8、n while (sign!=ifsign & sign!=whilesign & sign!=forsign & sign!=lbracketsign & if(sign=EOFsign)exit(0); /條件語(yǔ)句 := void ifwords() (charwhile (sign!=ifsign & sign!=whilesign & sign!=forsign & sign!=lbracketsign & if (sign!=rparenthesessign) while (sign!=ifsign & sign!=whilesign & sign!=forsign & sign!=

9、lbracketsign & sign!=returnsign & sign!=scanfsign & sign!=prsign!=elsesign) if(sign=EOFsign) exit(0); /while voidif(sign=lowsign|sign=leqsign|sign=abovesign|sign=aeqsign|sign=neqsign| sign=eqsign) if getsign(); elseif getsign(); getsign(); elseif elseif getsign(); elseif getsign(); elseif getsign();

10、 表達(dá)式為 0 voidif(sign=lowsign|sign=leqsign|sign=abovesign|sign=aeqsign|sign=neqsign| sign=eqsign) if getsign(); emit(elseif getsign(); elseif getsign(); getsign(); elseif getsign(); elseif getsign(); elseif getsign(); ( void loopwords()char label110,label210,op_flag5; void loopwords()char label110,lab

11、el210,op_flag5; while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign & fsign / emit(setlab,while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign & fsign while(sign!=ifsign&sign!=whilesign&sign!=f

12、orsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign & fsign while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign & fsign while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign & fsign

13、s= if(s=-1|s=-2)if(s=-2)s= if(s=-1|s=-2)if(s=-2)while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& sign!=returnsign & sign!=scanfsign & fsign emit(=,p,if (sign!=semsign) while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign & fsig

14、n if(sign!=semsign) while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& sign!=returnsign & sign!=scanfsign & fsign if (sign!=identitysign) whileif (sign!=identitysign) while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign & fsign s

15、= if(s=-1|s=-2)if(s=-2)while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& sign!=returnsign & sign!=scanfsign & fsign while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign & fsign while(sign!=ifsign&sign!=whilesign while(sign!=ifsi

16、gn&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign & fsign s= if(s=-1|s=-2)if(s=-2)while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& sign!=returnsign & sign!=scanfsign & fsign while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsig

17、n& & sign!=returnsign & sign!=scanfsign & fsign while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& sign!=returnsign & while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& sign!=returnsign & sign!=scanfsign & fsign while(sign!=ifsign&sign!=whilesign&sign!=forsign&sig

18、n!=lbracketsign& & sign!=returnsign & emit(= ,place3,j=doFN= FN= scanf(標(biāo)識(shí)符,標(biāo)識(shí)符) void scanfwords()charnames30; while (sign!=ifsign & sign!=whilesign & sign!=forsign & sign!=lbracketsign while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& sign!=returnsign & sign!=scanfsign & fsign s=

19、if(s=-1|s=-2)if(s=-2)while(sign!=ifsign&s= if(s=-1|s=-2)if(s=-2)while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& sign!=returnsign & sign!=scanfsign & fsign while (sign!=ifsign & sign!=whilesign & sign!=forsign & sign!=lbracketsign & voidchar while (sign!=ifsign & sign!=whilesign

20、& sign!=forsign & sign!=lbracketsign if getsign(); if getsign(); elsewhile (sign!=ifsign & & sign!=forsign & sign!=lbracketsign void returnwords() while(sign!=ifsign&sign!=whilesign&sign!=forsignwhile(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& & sign!=returnsign & sign!=scanfsign

21、 & fsign 返回值個(gè)數(shù), 用于判斷有返回值的子函數(shù)是否正確voidcharif(sign=addsign) getsign(); ,place3);/place3=-(neq)elseif(sign=addsign) if(sign=addsign) continue ; continue ;p charwhile(sign=multiplicationsign| sign)emit(*,place1,place2,place3); emit(/ := emit(/ := 標(biāo)識(shí)符有返回值函數(shù)調(diào)用語(yǔ)句|(charif (sign=identitysign) if (sign=lparent

22、hesessign) while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign & sign!=identitysign & sign!=returnsign& sign!=scanfsign & fsign & sign!=semsign sign!=elsesign&sign!=multiplicationsign&masign&sign!=addsign&sign!=subtrationsign& sign!=lowsign & sign!=leqsign & sign!=abovesign sign!=aeq

23、sign&sign!=neqsign&sign!=eqsign)t = seek(names,1,index3); if(t=-1|t=-2|t=-3)ift=-2while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign & sign!=identitysign & sign!=returnsign& sign!=scanfsign & fsign & sign!=semsign sign!=elsesign& masign&sign!=addsign&sign!=subtrationsign& sign!=lows

24、ign & masign&sign!=addsign&sign!=subtrationsign& sign!=lowsign & sign!=leqsign & elset = if(t=-1|t=-2)if(t=-2) & sign!=scanfsign & sign!=prfsign & sign!=semsign & sign!=elsesign & sign!=rparenthesessignsign!=multiplicationsign&masign&sign!=addsign&sign!=subtrationsign& sign!=lowsign & sign!=leqsign

25、& sign!=abovesign sign!=aeqsign&sign!=neqsign&sign!=eqsign) while(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& sign!=identitysign & sign!=returnsignwhile(sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=lbracketsign& sign!=identitysign & sign!=returnsignsign!=elsesign&sign!=multipl

26、icationsign&masign & sign!=addsign & sign!=subtrationsign &sign!=lowsign&sign!=leqsign&sign!=abovesign&sign!=neqsign&sign!=eqsign)/ +if(sign=addsign | sign=subtrationsign | if (sign=addsign) getsign(); numbersign | while(numstrk+1 = 0;while(k!=0) while (sign!=ifsign & sign!=whilesign & & sign!=lbrac

27、ketsign & sign!=scanfsign & fsign & sign!=semsign & sign!=elsesign & sign!=lowsign & sign!=leqsign & sign!=abovesign & & sign!=lowsign & sign!=leqsign & sign!=abovesign & sign!=neqsign & sign!=eqsign) voidi = while ( (ch=fgetc(source)= |ch=n | ch=t ) linellong=signalsc=ch=voiderror(+; /switch(k) cas

28、ecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasecasevoidchariffp = fopen(zhongjiandaimayouhua.txt,w);fq= getsign();while(ch=n|ch=| f(n四元式生成!n); char* newplace()char*p=(char*)malloc(10*sizeof(char); p0 = $;if(n10) p2

29、=p1=n/10p2=n%10p3=returnvoidcharvoidcharif(strcmp(signalsi.op,+)=0|strcmp(signalsi.op,-)=0|strcmp(signalsi.op,* )=0 | strcmp(signalsi.op,/ )=0) num2=if(strcmp(signalsi.op,+)=0)temp=num1+num2; if(strcmp(signalsi.op,- )=0) temp =num1-num2; if(strcmp(signalsi.op,*)=0)temp=num1*num2; if(strcmp(signalsi.

30、op,/)=0)temp=num1/num2; strcpy(signalsi.op,=); for void if(strcmp(signalsi.op,+ )=0 | strcmp(signalsi.op,- )=0 | strcmp(signalsi.op,* )=0 | strcmp(signalsi.op,/ )=0 | strcmp(signalsi.op,= )=0)ifvoid if(strcmp(signalsi.op,+ )=0 | strcmp(signalsi.op,- )=0 | strcmp(signalsi.op,* )=0 | strcmp(signalsi.o

31、p,/ )=0 | strcmp(signalsi.op,= )=0)iffor 除forif(strcmp(signalsh.op,+ )=0 | strcmp(signalsh.op,- )=0 iffor(k=j;kcom2;iffor(k=j;kcom2;if(strcmp(signalsi.op,+ )=0 | strcmp(signalsi.op,- | for 除 forif(strcmp(signalsh.op,+ )=0 | strcmp(signalsh.op,- )=0 forif(strcmp(signalsh.op,+ )=0 | strcmp(signalsh.op

32、,- )=0 if/ prfor(k=j;kcom7;k+) iffor ifforfor(k=j;kcom3;/ pr for(j=i+1;j=com8;j+)for(k=i;kcom8;for(k=i;kcom8;i= ifvoidi= while ifvoidi= while if(kind=3) j = while(j=i)else jelse j = while(jindexs)else if elsetableindexs.kind = kind; tableindexs.offset = offset; tableindexs.value = value; tableindexs

33、.address = address; %d的是一個(gè)函數(shù)的時(shí)候 i 才會(huì)+ %d的是一個(gè)函數(shù)的時(shí)候 i 才會(huì)+ indexf(函數(shù)表: ); void plistindexs2.kind=f(參數(shù)表: ); x = flistindex1.FN=return seek(charreturn seek(charm=array1; if (flag=1) n = while(ni) return -1;if (tablearrayn.FN!=FN) return-3;return tablearrayn.address; ame)!=0) y = while voidif (sign=consts

34、ign) while(sign_temp=semsign)else signkind temp = sign; ch_temp = ch; signalsc_temp=signalsc; if (sign=kind=elseif signkind temp = sign; ch_temp = ch; signalsc_temp=signalsc; if (sign=kind=elseifkind=elseif(sign=charsign)kind=13; ifmasign)sign=ch = ch_temp; /value=address=/paranum=strcpy();char else

35、if(kind=12)/elseif(kind=13)/emit(char, elsesign=ch = ch_temp;while elsesign=ch = ch_temp;while signkindtemp=/有返回值函數(shù)定義部分 if(sign=EOFsign)exit(0); n = = /address=/paranum=if (temp=floatsign) if (temp=charsign) emit(start,char, if (sign!=rparenthesessign)if(sign=EOFsign)exit(0); if (sign!=lbracketsign)

36、 if (sign!=lbracketsign) if(sign=EOFsign)exit(0); if (sign!=rbracketsign) if(sign=EOFsign)exit(0); if(retflag=0) if(sign=EOFsign)exit(0); ! n = kind=value=address= n = kind=value=address= /無(wú)返回值函數(shù)定義部分 := void/無(wú)返回值函數(shù)定義部分 := void標(biāo)識(shí)符( if(sign=EOFsign)exit(0); n = kind = 3;value=address=paranum= if(sign=

37、EOFsign)exit(0); if(sign=EOFsign)exit(0); if(sign=EOFsign)exit(0); if(sign=EOFsign)exit(0); if (sign=addsign | sign=subtrationsign ) signkindtemp_sign=sign; if sign& elseconstnum=(float)(0-while (while(k!=0) / constnum=value; elseconstnum = 0-realnum; while(numstrk+1= numstrk=- elseconstnum = 0-real

38、num; while(numstrk+1= numstrk=-elsemasign&if(sign=EOFsign)else if ( (per_sign= sign & sign= numbersign) | (per_sign=floatsign & sign=realnumbersign) | (per_sign=charsign & sign=ctrsign) ) if (sign= numbersign) constnum = (float) num; elseif(sign=realnumbersign)constnum=realnum; else if (sign=ctrsign

39、) constnum = ctr; else masign&if(sign=EOFsign)else masign&if(sign=EOFsign)else masign&if(sign=EOFsign)if(sign=EOFsign)return ; voidif(sign=sign|sign=floatsign|sign=charsign) if(sign=sign) kind = 11;else if(sign=floatsign)kind=elseif(sign=charsign)kind13; getsign(); /if (sign!=identitysign) whileelse

40、elsewhile( if(sign=EOFsign)returnvoid constssignkindper_sign; ; ifsign)kind=elseif(sign=floatsign)kind=22; elseif(sign=charsign)kind= /address=/paranum = per_sign=sign; whilemasign)while (sign!=constsign & sign!=sign&whilemasign)while (sign!=constsign & sign!=sign&sign!=floatsign&sign!=charsign & si

41、gn!=voidsign & sign!=ifsign & sign!=whilesign& sign!=forsign & sign!=identitysign & sign!=returnsign & sign!=scanfsign & sign!=prsign_temp=else while(sign!=constsign&sign&sign!=floatsign&sign!=charsignsign!=voidsign&sign!=scanfsign& while (sign!=constsign & sign!=sign & sign!=floatsign & sign!=chars

42、ign & sign!=voidsign & sign!=ifsign&sign!=whilesign&sign!=forsign&sign!=returnsign&sign!=scanfsign & sign!=prreturnvoid|float|類(lèi)型標(biāo)識(shí)符標(biāo)識(shí)符,類(lèi)型標(biāo)識(shí)符標(biāo)識(shí)符| void|float|類(lèi)型標(biāo)識(shí)符標(biāo)識(shí)符,類(lèi)型標(biāo)識(shí)符標(biāo)識(shí)符| if( temp=sign; kind = 4; /paranum= if(temp=sign)/emit(para, ,name);else if (temp=floatsign)/ emit(para,float, ,name); else if (temp=charsign) /emit(para,char, else while else while signkind temp = sign; ch_temp = ch; signalsc_temp = signalsc; if(sign=elseif(sign=floatsign)kind=12; elseif(sign=charsign)kind=13; whi

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論