版權(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年度年福建省高校教師資格證之高等教育心理學(xué)強(qiáng)化訓(xùn)練試卷A卷附答案
- 2024年度山西省高校教師資格證之高等教育法規(guī)模擬考試試卷B卷含答案
- 2024年家具成套生產(chǎn)線(xiàn)項(xiàng)目資金申請(qǐng)報(bào)告代可行性研究報(bào)告
- 2024年-2025年《農(nóng)作物生產(chǎn)技術(shù)》綜合知識(shí)考試題庫(kù)及答案
- 2024專(zhuān)項(xiàng)產(chǎn)品線(xiàn)唯一供貨商協(xié)議
- 兒童教育服務(wù)協(xié)議:2024定制
- 2024照明系統(tǒng)倉(cāng)庫(kù)安裝協(xié)議條款
- 2024工程總承包深度合作協(xié)議
- 2024年賠償問(wèn)題解決協(xié)議模板
- 安全生產(chǎn)管理員的職責(zé)與權(quán)益明細(xì)協(xié)議
- 2024普通高中物理課程標(biāo)準(zhǔn)解讀
- 2024年廣西玉林市自來(lái)水有限公司招聘筆試參考題庫(kù)含答案解析
- 2022年度食品安全負(fù)責(zé)人考試題庫(kù)(含答案)
- 教師近3年任教學(xué)科學(xué)生學(xué)業(yè)水平和綜合素質(zhì)
- 企業(yè)法律合規(guī)與外部監(jiān)管的內(nèi)外因素分析
- 2022年版煤礦安全規(guī)程
- 九年級(jí)數(shù)學(xué)上冊(cè) 期中考試卷(湘教版)
- 冷彎?rùn)C(jī)行業(yè)市場(chǎng)研究報(bào)告
- 牛津英語(yǔ)四年級(jí)上冊(cè)4A-M2-Unit-3-The-lion-and-the-mouse優(yōu)秀信息化教案附反思
- 山東省青島市膠州市2023-2024學(xué)年八年級(jí)上學(xué)期期中英語(yǔ)試卷
- 第三單元“閱讀策略”(主題閱讀) 六年級(jí)語(yǔ)文上冊(cè)閱讀理解(統(tǒng)編版)
評(píng)論
0/150
提交評(píng)論