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

正文內(nèi)容

編譯原理課程設(shè)計(jì)---語法分析器-其他專業(yè)(已改無錯(cuò)字)

2023-03-03 02:55:29 本頁面
  

【正文】 seekkeyword([])。//尋找匹配變量 markj=seektoken(words[index])。//尋找匹配字符 //判斷表達(dá)式是否有對應(yīng)的產(chǎn)生式 if (markj!=1) { if (variable[marki].tokens[markj]!=1) { 。 push_stack(variable[marki].tokens[markj])。//壓入堆棧 } else return 0。 } else return 0。 } if(words[index]==39。39。) return 1。 else return 0。 } int main(int argc, char* argv[]) { LLOneParse llOneParse。 char userinput[maxsize]。 ()。//調(diào)用初始化函數(shù) printf(請輸入字符串以 號結(jié)束 :)。 scanf(%s,userinput)。 if ((userinput)0)//調(diào)用程序 printf(字符輸入合法 \n)。 else printf(非法輸入 \n)。 return 0。 } 程序運(yùn)行截圖 7 小結(jié) 8 3 算符優(yōu)先分析 算符優(yōu)先文法 E→ T | E+T | ET (注:該文法為示例,可更改) T→ F | T*F | T/F F→ (E) | i 算符優(yōu)先關(guān)系表 + * / ( ) i + * / ( = ) i = 分析程序代碼 程序要求:用戶輸入一個(gè)符號串,程序判斷是否為給定方法的句子。 五號字,固定值 12 磅行間距。 程序要有注釋 include include define maxsize 20 include include //定義堆棧結(jié)構(gòu) struct stack { char stackwords[maxsize]。 int stack_top。 }。 //定義二維關(guān)系表 struct tokens { char token。 int relation[8]。 }。 class ProcessParse { public: void initial()。 int analyzer(char *words)。 private: 9 int seektoken(char word)。 void pop_stack()。 private: struct stack astack。 struct tokens atoken[8]。 }。 //初始化數(shù)據(jù) void ProcessParse::initial() { //初始化堆棧 =0。 [0]=39。39。 //初始化二維表 atoken[0].token=39。+39。 atoken[0].relation[0]=2。 atoken[0].relation[1]=2。 atoken[0].relation[2]=1。 atoken[0].relation[3]=1。 atoken[0].relation[4]=1。 atoken[0].relation[5]=2。 atoken[0].relation[6]=1。 atoken[0].relation[7]=2。 atoken[1].token=39。39。 atoken[1].relation[0]=2。 atoken[1].relation[1]=2。 atoken[1].relation[2]=1。 atoken[1].relation[3]=1。 atoken[1].relation[4]=1。 atoken[1].relation[5]=2。 atoken[1].relation[6]=1。 atoken[1].relation[7]=2。 atoken[2].token=39。*39。 atoken[2].relation[0]=2。 atoken[2].relation[1]=2。 atoken[2].relation[2]=2。 atoken[2].relation[3]=2。 atoken[2].relation[4]=1。 atoken[2].relation[5]=2。 atoken[2].relation[6]=1。 atoken[2].relation[7]=2。 atoken[3].token=39。/39。 atoken[3].relation[0]=2。 atoken[3].relation[1]=2。 atoken[3].relation[2]=2。 atoken[3].relation[3]=2。 atoken[3].relation[4]=1。 atoken[3].relation[5]=2。 atoken[3].relation[6]=1。 atoken[3].relation[7]=2。 atoken[4].token=39。(39。 atoken[4].relation[0]=1。 atoken[4].relation[1]=1。 atoken[4].relation[2]=1。 atoken[4].relation[3]=1。 10 atoken[4].relation[4]=1。 atoken[4].relation[5]=0。 atoken[4].relation[6]=1。 atoken[4].relation[7]=2。 atoken[5].token=39。)39。 atoken[5].relation[0]=2。 atoken[5].relation[1]=2。 atoken[5].relation[2]=2。 atoken[5].relation[3]=2。 atoken[5].relation[4]=1。 atoken[5].relation[5]=2。 atoken[5].relation[6]=1。 atoken[5].relation[7]=2。 atoken[6].token=39。i39。 atoken[6].relation[0]=2。 atoken[6].relation[1]=2。 atoken[6].relation[2]=2。 atoken[6].relation[3]=2。 atoken[6].relation[4]=1。 atoken[6].relation[5]=2。 atoken[6].relation[6]=1。 atoken[6].relation[7]=2。 atoken[7].token=39。39。 atoken[7].relation[0]=1。 atoken[7].relation[1]=1。 atoken[7].relation[2]=1。 atoken[7].relation[3]=1。 atoken[7].relation[4]=1。 atoken[7].relation[5]=1。 atoken[7].relation[6]=1。 atoken[7].relation[7]=0。 } int ProcessParse::seektoken(char word) { switch(word) { case 39。+39。:return 0。 case 39。39。: return 1。 case 39。*39。: return 2。 case 39。/39。: return 3。 case 39。(39。: return 4。 case 39。)39。: return 5。 case 39。i39。: return 6。 case 39。39。:return 7。 default:return 1。 } } void ProcessParse::pop_stack() { while([]!=39。39。) { 。 } 。 } 11 int ProcessParse::analyzer(char *words) { int index=0。//字符指針 int marki=1。//標(biāo)記找到的字符 int markj=1。 while(words[index]!=39。39。) { //搜索二維表 marki=seektoken([])。 markj=seektoken(words[index])。 if(markj!=1)//判斷字符是否在二維表內(nèi) { if(atoken[marki].relation[markj]!=1) { if(atoken[marki].relation[markj]!=2) { //壓入堆棧并調(diào)整指針 ++。 if (atoken[marki].relation[markj]==1) []=39。39。 else []=39。=39。 ++。 []=words[index]。 index++。 } else { pop_stack
點(diǎn)擊復(fù)制文檔內(nèi)容
研究報(bào)告相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1