91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1017KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2023-10-21
  • 語言: 其他
  • 標(biāo)簽: WHILE??LR方法??

資源簡介

WHILE循環(huán)語句的翻譯程序設(shè)計(LR方法、輸出四元式)

資源截圖

代碼片段和文件信息

#include
#include?
#include
#include?
#include
#include
#include?“conio.h“
using?namespace?std;
ofstream?coutf(“cifa.txt“ios::out);//結(jié)果輸出至文件cifa.txt
ofstream?couty(“yufa.txt“ios::out);//結(jié)果輸出至文件yufa.txt
ofstream?couts(“obj.txt“ios::out);//結(jié)果輸出至文件obj.txt
char?shuru[100]tmp;
char?sr[100];
char?b[10]op[10]rop[10];
char?a[10];
int?q=0;

struct?Table{
????char?act_0[10];
????int?act_1[10];
????int?go[4];
}action[18];

struct??sys{
char?f;
char?op1;
char?op2;
char?result;
}equ[10];

void?Init(){
????/*---------------???????ACTION??????-----------------------*/
????action[0].act_0[0]=‘s‘;???????action[0].act_1[0]=2;
????action[1].act_0[9]=‘Z‘;??????
????action[2].act_0[1]=‘s‘;???????action[2].act_1[1]=3;
????action[3].act_0[5]=‘s‘;???????action[3].act_1[5]=5;
????action[4].act_0[2]=‘s‘;???????action[4].act_1[2]=6;
????action[5].act_0[2]=‘r‘;???????action[5].act_1[2]=7;
????action[5].act_0[7]=‘s‘;???????action[5].act_1[7]=7;
????action[6].act_0[3]=‘s‘;???????action[6].act_1[3]=9;
????action[7].act_0[5]=‘s‘;???????action[7].act_1[5]=8;
????action[8].act_0[2]=‘r‘;???????action[8].act_1[2]=6;?
????action[9].act_0[5]=‘s‘;???????action[9].act_1[5]=14;
????action[10].act_0[4]=‘r‘;??????action[10].act_1[4]=3;
????action[10].act_0[5]=‘s‘;??????action[10].act_1[5]=14;
????action[11].act_0[4]=‘s‘;??????action[11].act_1[4]=12;
action[12].act_0[9]=‘r‘;??????action[12].act_1[9]=1;
????action[13].act_0[4]=‘r‘;??????action[13].act_1[4]=2;
????action[14].act_0[8]=‘s‘;??????action[14].act_1[8]=17;
????action[14].act_0[6]=‘s‘;??????action[14].act_1[6]=15;
????action[15].act_0[5]=‘s‘;??????action[15].act_1[5]=14;
action[16].act_0[4]=‘r‘;?????action[16].act_1[4]=4;
action[16].act_0[5]=‘r‘;?????action[16].act_1[5]=4;
action[17].act_0[4]=‘r‘;?????action[17].act_1[4]=5;
action[17].act_0[5]=‘r‘;?????action[17].act_1[5]=5;

????/*--------------------?????GOTO??????-------------------------*/
????action[0].go[0]=1;
????action[3].go[2]=4;;
????action[9].go[1]=11;
????action[9].go[3]=10;
????action[10].go[1]=13;
????action[10].go[3]=10;
????action[15].go[3]=16;
????
}

void?cifa()
{
int?i=0j=0k=0m=0;
????for(q=1;q????{
???? tmp=sr[q];
??????????if(tmp>=‘0‘&&tmp<=‘9‘||tmp>=‘a(chǎn)‘&&tmp<=‘z‘||tmp>=‘A‘&&tmp<=‘Z‘)
???????a[i++]=tmp;
?????else?if(tmp==‘+‘||tmp==‘-‘||tmp==‘/‘||tmp==‘*‘)
?????????op[j++]=tmp;
??????else?if(tmp==‘>‘||tmp==‘<‘)
?????????????????rop[k++]=tmp;
????????????else?if(tmp==‘(‘||tmp==‘)‘||tmp==‘{‘||tmp==‘}‘||tmp==‘;‘)
?????????????????????b[m++]=tmp;??????????????????
????}
????cout<<“詞法分析完成結(jié)果輸出到文件cifa.txt“<????coutf<<“詞法分析結(jié)果:“<????coutf<<“關(guān)鍵字:“<<“w“<????coutf<<“變量名:“;
????????for(i=0;i????{?
????????coutf<????}
?????coutf<?????coutf<<“表達(dá)式運算符:“;
????for(i=0;i????{?
????????coutf<????}
????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????????0??2010-01-10?16:12??0708袁立明13\cifa.txt

?????文件??????????0??2010-01-07?15:24??0708袁立明13\Debug\cifa.txt

?????文件??????????0??2010-01-07?15:24??0708袁立明13\Debug\obj.txt

?????文件??????82944??2010-01-10?16:12??0708袁立明13\Debug\vc60.idb

?????文件?????118784??2010-01-07?10:31??0708袁立明13\Debug\vc60.pdb

?????文件?????602256??2010-01-10?16:12??0708袁立明13\Debug\while(LR).exe

?????文件?????850072??2010-01-10?16:12??0708袁立明13\Debug\while(LR).ilk

?????文件?????354722??2010-01-10?16:11??0708袁立明13\Debug\while(LR).obj

?????文件????2480928??2010-01-07?10:31??0708袁立明13\Debug\while(LR).pch

?????文件????1180672??2010-01-10?16:12??0708袁立明13\Debug\while(LR).pdb

?????文件??????????0??2010-01-07?15:24??0708袁立明13\Debug\yufa.txt

?????文件?????????17??2010-01-10?16:12??0708袁立明13\input.txt

?????文件??????????0??2010-01-10?16:12??0708袁立明13\obj.txt

?????文件???????9925??2009-06-21?22:33??0708袁立明13\while(LR).cpp

?????文件???????3439??2010-01-10?16:11??0708袁立明13\while(LR).dsp

?????文件????????526??2010-01-10?16:12??0708袁立明13\while(LR).dsw

?????文件??????41984??2010-01-10?16:12??0708袁立明13\while(LR).ncb

?????文件??????48640??2010-01-10?16:12??0708袁立明13\while(LR).opt

?????文件????????753??2010-01-10?16:12??0708袁立明13\while(LR).plg

?????文件??????????0??2010-01-10?16:12??0708袁立明13\yufa.txt

?????目錄??????????0??2010-01-10?18:39??0708袁立明13\Debug

?????目錄??????????0??2010-01-10?18:39??0708袁立明13

-----------?---------??----------?-----??----

??????????????5775662????????????????????22


評論

共有 條評論

相關(guān)資源