资源简介
LL1文法分析器 模拟LL1文法分析过程
实现功能:1.文法的输入、表示及转化模块。2.求每个非终结符FIRST 集FOLLOW集和SELECT集模块。3.预测分析表的构建模块。4.文法的检验及消除左公因子和左递归模块。5.对输入终结符串的判断,是否为LL1文法,并进一步分析。

代码片段和文件信息
// Dialog1.cpp : implementation file
//
#include “stdafx.h“
#include “LL1_Grammar.h“
#include “Dialog1.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDialog1 dialog
CDialog1::CDialog1(CWnd* pParent /*=NULL*/)
: CDialog(CDialog1::IDD pParent)
{
//{{AFX_DATA_INIT(CDialog1)
//}}AFX_DATA_INIT
}
void CDialog1::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDialog1)
DDX_Control(pDX IDC_PEDIT m_pedit);
DDX_Control(pDX IDC_VTLIST m_vtlist);
DDX_Control(pDX IDC_VTEDIT m_vtedit);
DDX_Control(pDX IDC_VNLIST m_vnlist);
DDX_Control(pDX IDC_VNEDIT m_vnedit);
DDX_Control(pDX IDC_STARTEDIT m_startedit);
DDX_Control(pDX IDC_PLIST m_plist);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDialog1 CDialog)
//{{AFX_MSG_MAP(CDialog1)
ON_BN_CLICKED(IDC_EXIT OnExit)
ON_BN_CLICKED(IDC_VNADD OnVnadd)
ON_BN_CLICKED(IDC_VNDEL OnVndel)
ON_BN_CLICKED(IDC_VNCLR OnVnclr)
ON_BN_CLICKED(IDC_VTADD OnVtadd)
ON_BN_CLICKED(IDC_VTDEL OnVtdel)
ON_BN_CLICKED(IDC_VTCLR OnVtclr)
ON_BN_CLICKED(IDC_PADD OnPadd)
ON_BN_CLICKED(IDC_PDEL OnPdel)
ON_BN_CLICKED(IDC_PCLR OnPclr)
ON_BN_CLICKED(IDC_SAVE OnSave)
ON_BN_CLICKED(IDC_IMPORT OnImport)
ON_BN_CLICKED(IDC_EXIT OnExit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDialog1 message handlers
void CDialog1::OnExit()
{
// TODO: Add your control notification handler code here
//CDialog1::OnCancel();
AfxGetMainWnd()->SendMessage(WM_CLOSE);
}
void CDialog1::OnVnadd() //添加非终结符
{
// TODO: Add your control notification handler code here
CString string;
m_vnedit.GetWindowText(string);
if(string.GetLength()!=1)
MessageBox(“您输入的非终结符有误,请检查!““错误“ MB_OK | MB_IConstop);
else
{
if((m_vnlist.FindStringExact(-1 string) == LB_ERR) && (string!=““))
m_vnlist.AddString(string);
}
m_vnedit.SetFocus();
m_vnedit.SetSel(0 -1);
}
void CDialog1::OnVndel() //删除非终结符
{
// TODO: Add your control notification handler code here
int iPos;
if ((iPos = m_vnlist.GetCurSel()) != LB_ERR)
m_vnlist.DeleteString(iPos);
m_vnedit.SetFocus();
m_vnedit.SetSel(0 -1);
}
void CDialog1::OnVnclr() //清空非终结符集合
{
// TODO: Add your control notification handler code here
m_vnlist.ResetContent();
m_vnedit.SetWindowText(““);
m_startedit.SetWindowText(““);
}
void CDialog1::OnVtadd() //添加终结符
{
// TODO: Add your control notification handler code here
CString string;
m_vtedit.GetWindowText(string);
if(string.GetLength()!=1)
MessageBox(“您输入的终结符有误,请检查!““错误“ MB_OK | MB_IConstop);
else
{
if((m_vtlist.FindStringExact(-1 string) == LB_ERR) && (string!=““))
m_vtlist.AddString(string);
}
m_vtedit.SetFocus();
m_vtedit.SetSel(0 -1);
}
void CDia
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 474598 2012-08-31 00:10 LL1_Grammar\0.bmp
文件 2359350 2012-08-30 22:08 LL1_Grammar\1.bmp
文件 2359350 2012-08-30 22:08 LL1_Grammar\2.bmp
文件 2359350 2012-08-30 22:08 LL1_Grammar\3.bmp
文件 2359350 2012-08-30 22:08 LL1_Grammar\4.bmp
文件 2359350 2012-08-30 22:08 LL1_Grammar\5.bmp
文件 2359350 2012-08-30 22:08 LL1_Grammar\6.bmp
文件 39664 2012-08-31 13:16 LL1_Grammar\Debug\Dialog1.obj
文件 0 2012-08-24 17:30 LL1_Grammar\Debug\Dialog1.sbr
文件 36013 2012-08-31 05:05 LL1_Grammar\Debug\Dialog2.obj
文件 39736 2012-08-31 05:07 LL1_Grammar\Debug\Dialog3.obj
文件 143356 2012-08-31 05:12 LL1_Grammar\Debug\Dialog4.obj
文件 62754 2012-08-30 16:55 LL1_Grammar\Debug\explorer1.obj
文件 179969 2012-09-02 09:32 LL1_Grammar\Debug\Grammar.obj
文件 0 2012-08-24 17:30 LL1_Grammar\Debug\Grammar.sbr
文件 34042 2012-08-31 05:12 LL1_Grammar\Debug\GrammarDlg.obj
文件 15266 2012-08-31 00:55 LL1_Grammar\Debug\InstructionDlg.obj
文件 3458048 2012-08-24 17:30 LL1_Grammar\Debug\LL1_Grammar.bsc
文件 245823 2012-09-02 09:32 LL1_Grammar\Debug\LL1_Grammar.exe
文件 497972 2012-09-02 09:32 LL1_Grammar\Debug\LL1_Grammar.ilk
文件 14186 2012-08-24 17:30 LL1_Grammar\Debug\LL1_Grammar.obj
文件 7065680 2012-08-24 17:30 LL1_Grammar\Debug\LL1_Grammar.pch
文件 836608 2012-09-01 09:43 LL1_Grammar\Debug\LL1_Grammar.pdb
文件 6108 2012-08-31 05:12 LL1_Grammar\Debug\LL1_Grammar.res
文件 0 2012-08-24 17:30 LL1_Grammar\Debug\LL1_Grammar.sbr
文件 71192 2012-08-31 05:12 LL1_Grammar\Debug\LL1_GrammarDlg.obj
文件 0 2012-08-24 17:30 LL1_Grammar\Debug\LL1_GrammarDlg.sbr
文件 17120 2012-08-27 22:28 LL1_Grammar\Debug\Precept.obj
文件 0 2012-08-24 17:30 LL1_Grammar\Debug\Precept.sbr
文件 28311 2012-08-31 00:58 LL1_Grammar\Debug\RelationDlg.obj
............此处省略64个文件信息
- 上一篇:vc++6.0中文版支持win7
- 下一篇:MFC获取主机名,IP地址,MAC地址
相关资源
- 编译原理c语言编译器
- 编译原理实验-词法分析(c语言代码)
- 北邮-编译原理-词法分析
- 现代编译原理-C语言描述
- 编译原理实验报告+代码+使用说明
- 编译原理课程设计-C语言子集编译器
- 赋值语句翻译c语言实现四元式
- 编译原理用C++消除左递归
- 编译原理简易C编译器
- 实现语法分析器-编译原理
- 编译原理 LR分析器 c++代码
- 设计并实现TINYC语言的扫描程序TINYC
- LL(1)文法分析全过程(FIRST/FLLOW/S
- 编译原理 LR0项目集规范族的构造 L
- 山东大学编译原理实验源代码c++版
- 简单函数绘图语言的解释器
- Lex和Yacc从入门到精通.pdf
- 简易词法分析器——基于C语言
- 词法分析代码内有报告
- 编译原理LL1文法的mfc实现含消除左递
- 编译原理词法分析实验
- pl/0语言的编译器
- C++实现编译原理自动机、LL1文法、及
- 编译原理语义分析程序 c++实现
- 编译原理 课程设计 DAG 报告+源码C++版
- 编译原理课程设计----语法分析器(
- 编译原理简单的编译器源码
- C语言实现一个编译器-编译原理南开大
- 编译原理课程实验报告词法分析器及
- 编译原理与技术李文生:LR分析法C+
评论
共有 条评论