-
大小: 7.24MB文件類型: .zip金幣: 2下載: 0 次發(fā)布日期: 2023-09-22
- 語言: 其他
- 標(biāo)簽: 編譯原理??課程設(shè)計(jì)??
資源簡介
任意給定一個(gè)上下文無關(guān)文法,通過程序計(jì)算文法所有非終結(jié)符FIRST和FOLLOW集,和每個(gè)產(chǎn)生式的SELECT集;
判斷該文法是否為LL(1)文法;
構(gòu)造相應(yīng)文法的預(yù)測分析表;
基于相應(yīng)文法的預(yù)測分析表,動態(tài)演示(分步)一個(gè)句子分析過程。如果報(bào)錯(cuò),請?zhí)崾究赡艿脑颉⒁娊滩腜95表4.5;
設(shè)計(jì)、實(shí)現(xiàn)能根據(jù)分析結(jié)果(產(chǎn)生式序列)構(gòu)建句子或者源程序的語法分析樹;
如果給定的文法含有左遞歸,嘗試對文法進(jìn)行改寫,消除左遞歸;

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.Collections;
namespace?LL1Paser
{
????public?class?Grammar
????{
????????//分析表
????????private?String[]?analyzeTable;
????????/**?
?????????*?LL(1)文法產(chǎn)生集合?
?????????*/
????????private?List?productionList;
????????/**?
?????????*?表達(dá)式集合?
?????????*/
????????private?Dictionary>?expressionMap;
????????/**?
?????????*?開始符?
?????????*/
????????private?char?s;
????????/**?
?????????*?Vn非終結(jié)符集合?
?????????*/
????????private?List?nvSet?=?new?List();
????????/**?
?????????*?Vt終結(jié)符集合?
?????????*/
????????private?List?ntSet?=?new?List();
????????/**?
?????????*?First集合?
?????????*/
????????private?Dictionary>?firstMap;
????????/**?
?????????*?Follow集合?
?????????*/
????????private?Dictionary>?followMap;
????????/**?
????????*?Select集合?
????????*/
????????Dictionary>>?selectMap;//
????????public?string[]?getAnalyzeTable()
????????{
????????????return?analyzeTable;
????????}
????????public?Dictionary>>?getSelectMap()
????????{
????????????return?selectMap;
????????}
????????public?void?setSelectMap(Dictionary>>?selectMap)
????????{
????????????this.selectMap?=?selectMap;
????????}
????????public?Dictionary>?getFirstMap()
????????{
????????????return?firstMap;
????????}
????????public?void?setFirstMap(Dictionary>?firstMap)
????????{
????????????this.firstMap?=?firstMap;
????????}
????????public?Dictionary>?getFollowMap()
????????{
????????????return?followMap;
????????}
????????public?void?setFollowMap(Dictionary>?followMap)
????????{
????????????this.followMap?=?followMap;
????????}
????????public?Dictionary>?getexpressionMap()
????????{
????????????return?expressionMap;
????????}
????????public?void?setexpressionMap(Dictionary>?expressionMap)
????????{
????????????this.expressionMap?=?expressionMap;
????????}
????????public?List?getGrammar()
????????{
????????????return?productionList;
????????}
????????public?void?setGrammar(List?productionList)
????????{
????????????this.productionList?=?productionList;
????????}
????????public?char?getS()
????????{
????????????return?s;
????????}
????????public?void?setS(char?s)
????????{
????????????this.s?=?s;
????????}
????????public?List?getNvSet()
????????{
????????????return?nvSet;
????????}
????????public?void?setNvSet(List?nvSet)
????????{
????????????this.nvSet?=?nvSet;
????????}
????????public?List?getNtSet()
????????{
????????????return?ntSet;
????????}
????????public?void?setNtSet(List?ntSet)
????????{
????????????this.ntSet?=?ntSet;
???
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-12-27?18:38??03LL(1)分析程序\
?????目錄???????????0??2017-12-27?18:38??03LL(1)分析程序\LL1\
?????目錄???????????0??2017-12-27?18:38??03LL(1)分析程序\LL1\LL1Paser-Winform版\
?????目錄???????????0??2017-12-27?18:38??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\
?????目錄???????????0??2017-12-27?18:38??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\
?????目錄???????????0??2017-12-27?18:38??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\
?????目錄???????????0??2017-12-27?18:38??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\v14\
?????文件???????54272??2017-12-20?17:18??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\v14\.suo
?????目錄???????????0??2017-12-28?14:04??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\v15\
?????文件???????71168??2017-12-28?14:04??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\v15\.suo
?????文件?????4648960??2017-12-28?14:04??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\v15\Browse.VC.db
?????目錄???????????0??2017-12-27?18:38??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\v15\Server\
?????目錄???????????0??2017-12-28?14:04??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\v15\Server\sqlite3\
?????文件???????????0??2017-12-25?19:10??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\v15\Server\sqlite3\db.lock
?????文件??????581632??2017-12-28?14:04??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\v15\Server\sqlite3\storage.ide
?????目錄???????????0??2017-12-28?14:02??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\v15\ipch\
?????目錄???????????0??2017-12-28?14:02??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\v15\ipch\AutoPCH\
?????目錄???????????0??2017-12-28?14:02??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\v15\ipch\AutoPCH\a493f13b77e1b77d\
?????文件????30539776??2017-12-28?14:02??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\.vs\LL1Paser\v15\ipch\AutoPCH\a493f13b77e1b77d\~VSE9AC.ipch
?????目錄???????????0??2017-12-27?18:38??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\LL1Paser\
?????文件???????19227??2017-12-20?09:58??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\LL1Paser\Grammar.cs
?????文件????????3816??2017-12-20?14:01??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\LL1Paser\LL1Paser.csproj
?????文件???????16287??2017-12-27?16:20??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\LL1Paser\Main.Designer.cs
?????文件???????14226??2017-12-27?16:20??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\LL1Paser\Main.cs
?????文件????????5817??2017-12-27?16:20??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\LL1Paser\Main.resx
?????文件?????????488??2017-12-18?19:15??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\LL1Paser\Program.cs
?????目錄???????????0??2017-12-27?18:38??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\LL1Paser\Properties\
?????文件????????1366??2017-12-18?19:15??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\LL1Paser\Properties\AssemblyInfo.cs
?????文件????????2867??2017-12-18?19:15??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\LL1Paser\Properties\Resources.Designer.cs
?????文件????????5612??2017-12-18?19:15??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\LL1Paser\Properties\Resources.resx
?????文件????????1094??2017-12-18?19:15??03LL(1)分析程序\LL1\LL1Paser-Winform版\LL1Paser\LL1Paser\Properties\Settings.Designer.cs
............此處省略29個(gè)文件信息
評論
共有 條評論