




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、衡陽師范學(xué)院工科課程設(shè)計 -編譯原理課程設(shè)計報告題 目: LR(0)分析器自動構(gòu)造程序的實現(xiàn) 學(xué) 號: 13190207 姓 名: 譚金星 班 級: 1302 指導(dǎo)教師: 陳瓊老師 日 期: 2016年 6月20日 目 錄第一章 概 述4第二章 設(shè)計的基本原理52.1 識別文法的LR(0)項目集規(guī)范族的構(gòu)造52.2 LR(0)分析表的構(gòu)造52.3 LR(0)分析器總控程序構(gòu)造6第三章 程序設(shè)計73.1 程序總體構(gòu)架73.2 程序存儲結(jié)構(gòu)83.2.1 符號表存儲結(jié)構(gòu)83.2.2 產(chǎn)生式表存儲結(jié)構(gòu)83.2.3 項目集規(guī)范族表存儲結(jié)構(gòu)93.2.4 LR(0)分析表存儲結(jié)構(gòu)93.3 程序算法103.3
2、.1 項目集規(guī)范族的構(gòu)造103.3.2 LR(0)分析表構(gòu)造11第四章 程序測試124.1 符號表測試124.2 產(chǎn)生式表測試134.3 項目集規(guī)范族表測試134.4 LR(0)分析表測試144.5 LR(0)分析器測試14第五章 總結(jié)和展望15附錄16參考文獻(xiàn)17一 概 述本課程設(shè)計完成了以下內(nèi)容:1. 實現(xiàn)了對任意給定的文法,識別文法活前綴的、的狀態(tài)轉(zhuǎn)化矩陣及項目集規(guī)范族的構(gòu)造;2. 判斷該文法是否為文法,實現(xiàn)了分析表的構(gòu)造,并輸出到指定文件中;3. 實現(xiàn)了分析器總控程序,對輸入的表達(dá)式進(jìn)行文法分析。4.在VC+6.0程序上運行二 設(shè)計的基本原理本課程設(shè)計的核心算法Error! Refer
3、ence source not found.主要有三點:1. 識別文法活前綴的、的狀態(tài)轉(zhuǎn)化矩陣及項目集規(guī)范族的構(gòu)造;2. 分析表的構(gòu)造;3. 分析器總控程序的構(gòu)造。2.1 識別文法的LR(0)項目集規(guī)范族的構(gòu)造采用(閉包)的構(gòu)造一個文法的項目規(guī)范簇。假定是文法的任一項目集,定義和構(gòu)造的閉包的算法:(1)的任何項目都屬于;(2)若屬于,那么,對任何關(guān)于的產(chǎn)生式,項目也屬于;(3)重復(fù)執(zhí)行上述兩個步驟直至不再增大。其中初始 ,為對文法進(jìn)行拓廣構(gòu)造而引進(jìn)的不出現(xiàn)在中的非終結(jié)符。定義狀態(tài)轉(zhuǎn)換函數(shù),的第一個變元是一個項目集,第二個變元是一個文法符號。函數(shù)值定義為。其中 = 任何形如的項目| 屬于2.2
4、LR(0)分析表的構(gòu)造 假定。令每個項目集的下標(biāo)作為分析器的狀態(tài)。特別是,令那個包含項目的集合的下標(biāo)為分析器的初態(tài)。分析表的子表和子表可按如下方法構(gòu)造: (1)若項目屬于且,為終結(jié)符,則置為“把移近棧”,簡記為“”。 (2)若項目屬于,那么對于任何終結(jié)符(或結(jié)束符#),置為“用產(chǎn)生式進(jìn)行規(guī)約”,簡記為“”(假定產(chǎn)生式是文法的第j個產(chǎn)生式) (3)若項目屬于,則置為“接受”,簡記為“acc”。 (4)若,則置。 (5)分析表中凡不能用規(guī)則14填入信息的空白處均置上“報錯標(biāo)志”。如果分析表中任何一項被重復(fù)填入,則說明分析表的入口不是唯一的,項目集中存在沖突項目,該文法不是文法。2.3 LR(0)分
5、析器總控程序構(gòu)造分析表包括量部分,“動作”表和“狀態(tài)轉(zhuǎn)換”表。規(guī)定了當(dāng)狀態(tài)面臨輸入符號時應(yīng)采取什么動作。規(guī)定了狀態(tài)面對文法符號時下一狀態(tài)是什么。每一項所規(guī)定的動作不外乎是下述四種可能之一。(1)移進(jìn) 把的下一狀態(tài)和輸入符號推進(jìn)棧,下一輸入符號變成現(xiàn)行輸入符號。(2)歸約 指用某一產(chǎn)生式進(jìn)行規(guī)約。假若的長度為,規(guī)約的動作是,去除棧頂?shù)膫€項,使?fàn)顟B(tài)變成棧頂狀態(tài),然后把的下一狀態(tài)推進(jìn)棧。規(guī)約動作不改變現(xiàn)行輸入符號。規(guī)約動作不改變現(xiàn)行輸入符號。(3)接受 宣布分析成功,停止分析器工作(4)報錯 發(fā)現(xiàn)源程序含有錯誤,調(diào)用出錯處理程序。三 程序設(shè)計3.1 程序總體構(gòu)架 本課程設(shè)計開發(fā)的程序主要由4張表組成
6、,分別為:符號表、產(chǎn)生式表、表和項目集規(guī)范簇表。同時,項目集規(guī)范簇表包含一個分析棧作為分析器總控程序。產(chǎn)生式表包含符號表作為子表,項目集規(guī)范簇表包含產(chǎn)生式表、表作為子表。 程序工作流程:1. 讀取含有文法規(guī)則的文件,為該文法中的每一個不同的文法符號(終結(jié)符和非終結(jié)符分配一個編號),記錄文法符號的屬性(終結(jié)符/非終結(jié)符),存儲于一張符號表中;2. 再次讀取文件,將產(chǎn)生式存儲于產(chǎn)生式表中;3. 根據(jù)產(chǎn)生式構(gòu)建項目集規(guī)范族,存儲于表中;4. 根據(jù)構(gòu)建的項目集規(guī)范族構(gòu)建分析表,填寫分析表同時檢查該文法是否為文法;5. 對于輸入的表達(dá)式,分析器根據(jù)構(gòu)建的分析表進(jìn)行文法分析,給出分析結(jié)果。3.2 程序存儲
7、結(jié)構(gòu)3.2.1 符號表存儲結(jié)構(gòu)動態(tài)數(shù)組下標(biāo),同時作為符號的編號標(biāo)識符是否為非終結(jié)符3.2.2 產(chǎn)生式表存儲結(jié)構(gòu)產(chǎn)生式標(biāo)號非終結(jié)符標(biāo)號 (與中的一致)指示當(dāng)前非終結(jié)符的產(chǎn)生式當(dāng)前非終結(jié)符產(chǎn)生式的長度,用于幫助區(qū)分一個產(chǎn)生式的不同項目,即項目個數(shù)等于指示下一個非終結(jié)符一個產(chǎn)生式中的標(biāo)識符名(與中的一致)一個產(chǎn)生式中的下一個標(biāo)識符3.2.3 項目集規(guī)范族表存儲結(jié)構(gòu) 1)定義二元組 : :產(chǎn)生式標(biāo)號,與 中的一致 :一個產(chǎn)生式的第個項目,可由 中的幫助確定 如:產(chǎn)生式 : , 2)結(jié)構(gòu):當(dāng)前狀態(tài)編號 指示下一狀態(tài) 指示閉包中的項目 閉包中的項目名當(dāng)前項目的產(chǎn)生的新狀態(tài)的編號,即狀態(tài)轉(zhuǎn)移的目的地狀態(tài)編號
8、閉包中的下一個項目待構(gòu)造的項目的閉包的待構(gòu)造的項目的閉包待構(gòu)造狀態(tài)的待構(gòu)造狀態(tài)的項目3.2.4 LR(0)分析表存儲結(jié)構(gòu)指示表頭的孩子結(jié)點指示表頭的后繼結(jié)點指示該表項的操作指示該表項的操作數(shù)指示該表項是否被填寫過,用于判斷文法是否為文法3.3 程序算法3.3.1 項目集規(guī)范族的構(gòu)造1. (初始化)將初始條件作為該狀態(tài)頭結(jié)點的第一個孩子結(jié)點,并構(gòu)造該孩子結(jié)點的閉包,連接其后,指向第一個狀態(tài)頭結(jié)點,指向第一個狀態(tài)頭結(jié)點的第一個孩子結(jié)點;2. 查看,若為空,停止;若不為空,轉(zhuǎn)3;3. 查看,若為空,轉(zhuǎn)4;若不為空,構(gòu)造的,檢查該狀態(tài)與之前構(gòu)造的狀態(tài)有無重復(fù),若重復(fù),則停止構(gòu)造,的填寫重復(fù)的已存在的狀
9、態(tài)的編號;若不重復(fù),則作為一個新狀態(tài),連接于,并構(gòu)造其閉包連接其后,指向。轉(zhuǎn)2;4. 指向下一狀態(tài),若下一狀態(tài)為空,則結(jié)束,否則,指向下一狀態(tài)頭結(jié)點的第一個孩子結(jié)點,轉(zhuǎn)3。具體細(xì)節(jié):設(shè)所指項目為,因為要對其構(gòu)造閉包,該項目一定不是終態(tài),所以區(qū)分項目的圓點符號位于第個標(biāo)識符的左側(cè)?,F(xiàn)在構(gòu)造的閉包,分兩個步驟實現(xiàn):1. 構(gòu)造的 : 查看中編號為的產(chǎn)生式,取得該產(chǎn)生式的長度屬性1) 若,則停止構(gòu)造當(dāng)前閉包(已是終態(tài)),此時 的項填;2) 否則,將作為該閉包的第一個項目,此時 的項填該新狀態(tài)的狀態(tài)編號。2. 構(gòu)造該孩子結(jié)點的閉包 :查看中編號為的產(chǎn)生式的第個標(biāo)識符,取得該標(biāo)識符的,查看中該標(biāo)識符的類別
10、屬性3) 若為1(非終結(jié)符),則查看非終結(jié)符的所有產(chǎn)生 式,記這些產(chǎn)生式的編號為,將所有的加入閉包4) 否則,結(jié)束3. 檢查該狀態(tài)與之前構(gòu)造的狀態(tài)有無重復(fù) :斷言:任意兩個狀態(tài),只要不同,則即為不同狀態(tài)。3.3.2 LR(0)分析表構(gòu)造對于編號為的狀態(tài),現(xiàn)依據(jù)其項目填寫分析表:1. 如果該項目形如,查看該項目的屬性,1)若為終結(jié)符,則在表的狀態(tài)對應(yīng)行,對應(yīng)列,填寫,表示將把 移進(jìn)棧2)若為非終結(jié)符,則在表的狀態(tài)對應(yīng)行,對應(yīng)列,填寫,表示狀態(tài)轉(zhuǎn)移至狀態(tài)2. 如果該項目形如1)若為起始符號,則置在表的狀態(tài)對應(yīng)行,對應(yīng)列,填寫,表示接受。2)否則,對任何終結(jié)符或結(jié)束符,則在表的狀態(tài)對應(yīng)行,對應(yīng)列,填
11、寫,表示用產(chǎn)生式進(jìn)行規(guī)約。四 程序測試以文法G為例:程序模塊輸入:含上述文法的文件,下面展示個模塊的輸出結(jié)果4.1 符號表測試圖6 符號表測試輸出結(jié)果為 與預(yù)期結(jié)果相同圖7 產(chǎn)生式表測試4.2 產(chǎn)生式表測試輸出結(jié)果與讀入的文件中的產(chǎn)生式相同,且產(chǎn)生式中符號的編號正確4.3 項目集規(guī)范族表測試圖8 DFA表測試輸出結(jié)果為 :與預(yù)期結(jié)果相同4.4 LR(0)分析表測試圖9 分析表測試輸出結(jié)果為分析表,與預(yù)期結(jié)果相同4.5 LR(0)分析器測試以輸入字符串a(chǎn)ccd#和acad#為例圖10 分析器測試表達(dá)式的分析結(jié)果正確五 總結(jié)和展望完成了編譯原理課程設(shè)計之后,我感到十分的疲憊,但是那一份富有成就感的
12、欣喜卻勝過了那十分的疲憊。由于本次選題匆忙,選了一道比較有難度的題目,在做課程設(shè)計的過程中,我翻閱了很多相關(guān)資料,對課本中點到即止的知識進(jìn)行了更加深入的學(xué)習(xí),有了更加深入的理解。做課程設(shè)計的過程是痛苦的,我在這一個星期內(nèi)多次熬夜戰(zhàn)斗,有時甚至顧不上吃飯,只為了揪出程序中的錯誤,只為了精益求精的完成這個課程設(shè)計。就在我寫這份總結(jié)的時候,我發(fā)現(xiàn)自己我一點也不累了,反而很興奮,很有成就感。通過本次課程設(shè)計,我發(fā)現(xiàn)實踐是檢驗學(xué)習(xí)深度、學(xué)習(xí)成果的唯一途徑,課本上的知識點都是濃縮的精華,在理論闡述上不可能做到面面俱到,學(xué)到的知識當(dāng)然也不可能直接運用到實際情況上。在實踐的過程中,我們需要將我們學(xué)習(xí)到的知識進(jìn)
13、行一定程度的擴充,本次課程設(shè)計涉及到算法,LR分析器自動構(gòu)造程序的機制原理以及C+語言。在用C+語言實現(xiàn)本次課程設(shè)計的過程中,我更加熟悉了C+語言的語法機制,語言規(guī)范;在實現(xiàn)LR分析器自動構(gòu)造程序的過程中,我更加熟悉了其構(gòu)造程序的原理以及與之相關(guān)的算法。由于時間匆忙,我完成的課程設(shè)計還有很多不足之處,很多工作還可以繼續(xù)完善,在提交作業(yè)之后,我不會把它放在那里一看不看的,我會繼續(xù)完善它,讓它更加人性化,具有可操作性,比如做個可視化的界面出來,豐富它的功能,相信以后的工作將更加多彩豐富,更加有成就感! 附錄說明:本附錄中包含了本次課程設(shè)計的所有代碼Closure_List.h#ifndef CLO
14、SURE_LIST_H#define CLOSURE_LIST_H#include Formula_List.h#include LR0_Table.hstruct Item_Name_Typeint Formula_Num; int Formula_Item; ;struct Closure_Child_NodeItem_Name_Type Item_Name;int Destination; Closure_Child_Node *Next_Item;struct Closure_Parent_Nodeint Current_State;Closure_Parent_Node *Next_
15、State;Closure_Child_Node *Item;class Closure_Listprivate:Closure_Parent_Node *Closure_List_head;Closure_Parent_Node *GoToSet_Parent;Closure_Parent_Node *Current_Parent;Closure_Child_Node *GoToSet_Child;Closure_Child_Node *Current_Child;int AmountOf_State; Formula_List sub_Formula_List;LR0_Table sub_
16、LR0_Table;public:Closure_List():sub_Formula_List(),sub_LR0_Table()Closure_List_head = NULL;GoToSet_Parent = NULL;Current_Parent = NULL;GoToSet_Child = NULL;Current_Child = NULL;AmountOf_State = 0;Create_Closure_List();Closure_List();void print_Closure_List();void make_LR0_Table();void print_LR0_Tabl
17、e();void Output_LR0_Table_ToFile();bool Sentence_Analyse(const char Sentence50);private:void Add_Clousure();bool Add_GoToSet();void Set_Initial_State();bool Is_Same_State_Exist(const int Formula_Num,const int Formula_Item,int& Same_State_Num);void Create_Closure_List();void Destroy_Closure_List();#e
18、ndifFormula_List.h#ifndef FORMULA_LIST_H#define FORMULA_LIST_H#include Sign_List.hstruct Formula_List_ChildItemint Sign_Name;Formula_List_ChildItem* Next_Sign;struct Formula_List_ParentItemint Formula_Num; int Vn_Name; int Formula_Length; Formula_List_ParentItem* Next_Vn;Formula_List_ChildItem* Form
19、ula;class Formula_Listprivate:Formula_List_ParentItem *Formula_List_head;Formula_List_ChildItem *current_Formula_Item;Formula_List_ParentItem *current_VnNode;Sign_List Sub_Sign_List; public:Formula_List():Sub_Sign_List()Formula_List_head = NULL; current_Formula_Item = NULL; current_VnNode = NULL;Cre
20、ate_Formula_List();Formula_List();void print_Formula_List();int int_check_Sign_Name(const char word);char char_check_Sign_Name(const int Sign_Name);int Get_Formula_Length(const int Formula_Num);int Get_Sign_Name(const int Formula_Num, const int Item_Num);int Get_Formula_LeftVn(const int Formula_Num)
21、;bool Is_Sign_Name_Vn(const int Sign_Name);int Get_AmountOf_Identity();private:void Destroy_Formula_List();void Create_Formula_List(); ;#endifLR0_Table.h#ifndef LR0_TABLE_H#define LR0_TABLE_H#include #include using namespace std;#include ConstValue.hstruct LR0_Table_Childchar Operation;int Oprand;bo
22、ol Has_Been_Filled;LR0_Table_Child *Next_Table_Child;struct LR0_Table_ParentLR0_Table_Child *Table_Child;LR0_Table_Parent *Next_Table_Parent;class LR0_Tableprivate:LR0_Table_Parent *LR0_Table_head;LR0_Table_Parent *Current_Parent;LR0_Table_Child *Current_Child;public:LR0_Table();LR0_Table();void ini
23、tial(const int AmountOf_State, const int AmountOf_Identity);bool Fill_In_Table(const int State_Num, const int Identity_Num,const char char_Opration, const int int_Oprand);void _OutputToFile();void _print_LR0_Table();void Visit_LR0_Table(const int State_Num, const int Identity_Num, char& char_Opratio
24、n, int& int_Oprand);private:void Destroy_LR0_Table();#endifSign_List.h#ifndef SIGN_LIST_H#define SIGN_LIST_H#include #include using namespace std;#include ConstValue.hstruct Sign_List_itemchar Identity; bool Is_Vn;Sign_List_item *next_Identity;struct Identity_List_itemchar Identity; bool Is_Vn;class
25、 Sign_Listprivate:Identity_List_item *Identity_List;int AmountOf_Identity; public:Sign_List();Sign_List();void print_Identity_List();int _int_check_Sign_Name(const char word);char _char_check_Sign_Name(const int Sign_Name);bool _Is_Sign_Name_Vn(const int Sign_Name);int _Get_AmountOf_Identity();priva
26、te:void Destroy_temp_Sign_List();void Create_Identity_List();private:Sign_List_item *current_Identity; Sign_List_item *head; bool Is_sameIdentity_Exist(const char word);#endifStack.h#ifndef STACK_H#define STACK_Hstruct elemint data;elem *next;class Stackprivate:elem *top;int count;public:Stack();Sta
27、ck();bool pushElem(const int Data);bool getElem(int &Data); bool popElem();int countElem()const;#endifClosure_List.cpp#include Closure_List.h#include Stack.hbool Closure_List:Add_GoToSet()int temp_Formula_Length = sub_Formula_List.Get_Formula_Length(GoToSet_Child-Item_Name.Formula_Num);if (GoToSet_C
28、hild-Item_Name.Formula_Item Item_Name.Formula_Num,GoToSet_Child-Item_Name.Formula_Item +1,SameDestination)=true)GoToSet_Child-Destination = SameDestination;return false; Closure_Child_Node *tempChild = new Closure_Child_Node;tempChild-Item_Name.Formula_Num = GoToSet_Child-Item_Name.Formula_Num;tempC
29、hild-Item_Name.Formula_Item = GoToSet_Child-Item_Name.Formula_Item +1;tempChild-Next_Item = NULL;Current_Child = tempChild;Closure_Parent_Node *tempParent = new Closure_Parent_Node;tempParent-Item = tempChild;tempParent-Next_State = NULL;tempParent-Current_State = Current_Parent-Current_State +1;Cur
30、rent_Parent-Next_State = tempParent;Current_Parent = tempParent;GoToSet_Child-Destination = Current_Parent-Current_State;+AmountOf_State;return true;elseGoToSet_Child-Destination = -1;return false;void Closure_List:Add_Clousure()int temp_Sign_Name = sub_Formula_List.Get_Sign_Name(GoToSet_Child-Item_
31、Name.Formula_Num,GoToSet_Child-Item_Name.Formula_Item +1);if (temp_Sign_Name=-1)return;if (sub_Formula_List.Is_Sign_Name_Vn(temp_Sign_Name)=true)int temp_Formula_Num = 1;int temp_Vn_Name = 0;while (temp_Vn_Name = sub_Formula_List.Get_Formula_LeftVn(temp_Formula_Num)!=-1)if (temp_Sign_Name=temp_Vn_Na
32、me)Closure_Child_Node *tempChild = new Closure_Child_Node;tempChild -Item_Name.Formula_Num = temp_Formula_Num;tempChild -Item_Name.Formula_Item = 1;tempChild-Next_Item = NULL;Current_Child-Next_Item = tempChild;Current_Child = tempChild;+temp_Formula_Num;void Closure_List:Set_Initial_State()Closure_
33、List_head = new Closure_Parent_Node;Closure_List_head-Current_State = 0;Closure_List_head-Item = NULL;Closure_List_head-Next_State = NULL;GoToSet_Parent = Closure_List_head;Current_Parent = Closure_List_head;Closure_Child_Node *tempChild = new Closure_Child_Node;tempChild -Item_Name.Formula_Num = 1;
34、tempChild -Item_Name.Formula_Item = 1;tempChild-Next_Item = NULL;Closure_List_head -Item = tempChild;GoToSet_Child = tempChild;Current_Child = tempChild;+AmountOf_State;int temp_Sign_Name = sub_Formula_List.Get_Sign_Name(1,1);int temp_Formula_Num = 1;int temp_Vn_Name = 0;while (temp_Vn_Name = sub_Fo
35、rmula_List.Get_Formula_LeftVn(temp_Formula_Num)!=-1)if (temp_Sign_Name=temp_Vn_Name)Closure_Child_Node *tempChild = new Closure_Child_Node;tempChild -Item_Name.Formula_Num = temp_Formula_Num;tempChild -Item_Name.Formula_Item = 1;tempChild-Next_Item = NULL;Current_Child-Next_Item = tempChild;Current_
36、Child = tempChild;+temp_Formula_Num;void Closure_List:Create_Closure_List()Set_Initial_State();while (GoToSet_Parent!=NULL)if (GoToSet_Child!=NULL)if (Add_GoToSet()=true) Add_Clousure(); GoToSet_Child = GoToSet_Child-Next_Item; elseGoToSet_Parent = GoToSet_Parent-Next_State;if (GoToSet_Parent=NULL)b
37、reak;GoToSet_Child = GoToSet_Parent-Item;void Closure_List:Destroy_Closure_List()Current_Parent = Closure_List_head;if (Closure_List_head = NULL)return;elsewhile (Current_Parent != NULL)Closure_Parent_Node *temp_ToDelete = Current_Parent;Current_Child = Current_Parent-Item;while (Current_Child != NU
38、LL)Closure_Child_Node *ToDelete = Current_Child;Current_Child = Current_Child-Next_Item;delete ToDelete;Current_Parent = Current_Parent-Next_State;delete temp_ToDelete;Closure_List_head = NULL;GoToSet_Parent = NULL;Current_Parent = NULL;GoToSet_Child = NULL;Current_Child = NULL;void Closure_List:pri
39、nt_Closure_List()Closure_Parent_Node *print_Vn_Node = Closure_List_head;if (Closure_List_head = NULL)return;elsewhile (print_Vn_Node != NULL)coutCurrent_StateItem;while (pirnt_Item_Node != NULL)coutItem_Name.Formula_Num,Item_Name.Formula_Item,Destination, ;pirnt_Item_Node = pirnt_Item_Node-Next_Item
40、;coutNext_State;bool Closure_List:Is_Same_State_Exist(const int Formula_Num,const int Formula_Item ,int& Same_State_Num)Closure_Parent_Node *Check_Parent_Node = Closure_List_head;while (Check_Parent_Node != NULL)if (Check_Parent_Node-Item-Item_Name.Formula_Item = Formula_Item &Check_Parent_Node-Item
41、-Item_Name.Formula_Num = Formula_Num)Same_State_Num = Check_Parent_Node-Current_State;return true;Check_Parent_Node =Check_Parent_Node-Next_State;Same_State_Num = -1;return false;void Closure_List:make_LR0_Table()sub_LR0_Table.initial(AmountOf_State,sub_Formula_List.Get_AmountOf_Identity();Closure_P
42、arent_Node *Traverse_Parent = Closure_List_head;Closure_Child_Node *Traverse_Child = Closure_List_head-Item;bool No_ErrorOccurIn_FillingTable = true;while (Traverse_Parent!=NULL)Item_Name_Type Traverse_Item; Traverse_Item.Formula_Num = Traverse_Child-Item_Name.Formula_Num;Traverse_Item.Formula_Item
43、= Traverse_Child-Item_Name.Formula_Item;int CurrentFormulalength = sub_Formula_List.Get_Formula_Length(Traverse_Item.Formula_Num);if (Traverse_Item.Formula_ItemDestination;if (sub_Formula_List.Is_Sign_Name_Vn(Traverse_Sign_Name)=false)No_ErrorOccurIn_FillingTable = sub_LR0_Table.Fill_In_Table(Traver
44、se_Parent-Current_State,Traverse_Sign_Name,s,Goal_State_Num);elseNo_ErrorOccurIn_FillingTable = sub_LR0_Table.Fill_In_Table(Traverse_Parent-Current_State,Traverse_Sign_Name,g,Goal_State_Num);else int Traverse_Sign_Name = sub_Formula_List.Get_Sign_Name(Traverse_Item.Formula_Num, Traverse_Item.Formula
45、_Item-1);if (Traverse_Sign_Name=1)No_ErrorOccurIn_FillingTable = sub_LR0_Table.Fill_In_Table(Traverse_Parent-Current_State,sub_Formula_List.Get_AmountOf_Identity(),a,1);elsefor (int i=0; iCurrent_State, i,r,Traverse_Item.Formula_Num);No_ErrorOccurIn_FillingTable = sub_LR0_Table.Fill_In_Table(Travers
46、e_Parent-Current_State, sub_Formula_List.Get_AmountOf_Identity(),r,Traverse_Item.Formula_Num);if (No_ErrorOccurIn_FillingTable=false)coutNext_Item!=NULL)Traverse_Child = Traverse_Child-Next_Item;elseif (Traverse_Parent-Next_State!=NULL)Traverse_Parent = Traverse_Parent-Next_State;Traverse_Child = Traverse_Parent-Item;elsebreak;void Closure_List:print_LR0_Table()for (int i=1; isub_
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 幼兒安全坐電梯
- 書法教師職業(yè)素養(yǎng)評估2025年:書法教育倫理與道德規(guī)范試題
- 2025年高壓電工基礎(chǔ)理論知識考試模擬試卷
- 2025年專升本藝術(shù)概論考試模擬試題(藝術(shù)史論知識點解析與解題方法)
- 2025年消防設(shè)施操作員資格考試題庫(含消防設(shè)施操作員應(yīng)急處理)
- 登高作業(yè)操作培訓(xùn)
- 科研開題導(dǎo)航
- 禮儀修養(yǎng)與形象塑造
- 化學(xué)創(chuàng)新縱橫
- 寒露時節(jié)的健康保障
- 正確認(rèn)識人的本質(zhì) (修改版)
- 2023年北京師范大學(xué)珠海分校招聘考試真題
- 2016-2023年江蘇經(jīng)貿(mào)職業(yè)技術(shù)學(xué)院高職單招(英語/數(shù)學(xué)/語文)筆試歷年考點試題甄選合集含答案解析
- 高原健康呼吸用氧 通用技術(shù)指南
- 合同的變更和解除條款
- 中醫(yī)內(nèi)科學(xué)-咳嗽課件
- 2022管理學(xué)試題庫(馬工程)
- 光儲充車棚技術(shù)方案設(shè)計方案
- 中建支吊架專項施工方案
- 維修驗收單完
- 手動報警按鈕(建筑消防設(shè)施檢測原始記錄)
評論
0/150
提交評論