资源简介
此程序实现了LR(0)语法分析器,可进行语法分析,输出结果
代码片段和文件信息
// AnalyzeDlg.cpp : implementation file
//
#include “stdafx.h“
#include “LR0ForWin.h“
#include “AnalyzeDlg.h“
#include
#include
#include “Pair.h“
using namespace std;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAnalyzeDlg dialog
CAnalyzeDlg::CAnalyzeDlg(CWnd* pParent /*=NULL*/)
: CResizingDialog(CAnalyzeDlg::IDD pParent)
{
//{{AFX_DATA_INIT(CAnalyzeDlg)
m_input = _T(““);
//}}AFX_DATA_INIT
m_strTempFilename = ““;
m_pTree = new CTreeDlg;
m_pTree->Create(IDD_DIALOG3 this);
m_pTree->SetControlInfo(IDC_TREE1 RESIZE_BOTH);
m_pTree->SetControlInfo(IDOK ANCHORE_BOTTOM | ANCHORE_RIGHT);
}
CAnalyzeDlg::~CAnalyzeDlg()
{
m_pTree->DestroyWindow();
delete m_pTree;
}
void CAnalyzeDlg::DoDataExchange(CDataExchange* pDX)
{
CResizingDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAnalyzeDlg)
DDX_Control(pDX IDC_EDIT1 m_edit1);
DDX_Control(pDX IDC_EXPLORER1 m_web);
DDX_Text(pDX IDC_EDIT1 m_input);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAnalyzeDlg CResizingDialog)
//{{AFX_MSG_MAP(CAnalyzeDlg)
ON_BN_CLICKED(IDC_BUTTON1 OnButton1)
ON_BN_CLICKED(IDC_BUTTON2 OnButton2)
ON_WM_ACTIVATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAnalyzeDlg message handlers
void CAnalyzeDlg::OnOK()
{
// TODO: Add extra validation here
//CDialog::OnOK();
}
void CAnalyzeDlg::OnCancel()
{
// TODO: Add extra cleanup here
if (m_strTempFilename != ““)
DeleteFile(m_strTempFilename.c_str());
CResizingDialog::OnCancel();
}
void CAnalyzeDlg::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_pTree->m_tree.DeleteAllItems();
for(int i = 0; i < m_input.GetLength(); i ++)
{
if (!m_g.IsInVt(m_input.GetAt(i)))
{
MessageBox(“输入的句子不全部由终结符组成“ “错误“ MB_OK | MB_IConstop);
return;
}
}
assert(TreeStack.empty());
m_input += “#“;
char szTempPath[MAX_PATH];
char szTempName[MAX_PATH];
if (m_strTempFilename != ““)
::DeleteFile(m_strTempFilename.c_str());
::GetTempPath(100szTempPath);
::GetTempFileName(szTempPath“LR0“0szTempName);
m_strTempFilename = szTempName;
CStdioFile out;
out.Open(szTempName CFile::modeCreate | CFile::modeWrite);
out.WriteString(“\n“);
out.WriteString(“\n“);
out.WriteString(“tle>Untitled Document tle>\n“);
out.WriteString(“ta http-equiv=\“Content-Type\“ content=\“text/html; charset=gb2312\“>\n“);
out.WriteString(“\n“);
out.WriteString(“\n“);
out.WriteString(“yle=\“border-collapse: collapse\“ bordercolor=\“#111111\“>\n“);
out.WriteString(“\n 步骤 \n 状态栈<
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 126 2007-06-03 14:17 Copy of LR0ForWin\1.txt
文件 115 2002-05-24 16:12 Copy of LR0ForWin\2.txt
文件 98 2002-05-26 23:24 Copy of LR0ForWin\3.txt
文件 123 2002-05-26 22:38 Copy of LR0ForWin\4.txt
文件 155 2002-05-26 23:35 Copy of LR0ForWin\5.txt
文件 8355 2002-05-25 01:04 Copy of LR0ForWin\AnalyzeDlg.cpp
文件 1917 2002-05-25 00:57 Copy of LR0ForWin\AnalyzeDlg.h
文件 11161 2002-05-24 00:40 Copy of LR0ForWin\explorer.cpp
文件 3747 2002-05-24 00:40 Copy of LR0ForWin\explorer1.h
文件 139 2002-05-24 00:43 Copy of LR0ForWin\GoData.cpp
文件 518 2002-05-23 22:17 Copy of LR0ForWin\GoData.h
文件 16132 2002-05-26 23:56 Copy of LR0ForWin\Grammar.cpp
文件 1645 2002-05-26 23:47 Copy of LR0ForWin\Grammar.h
文件 2105 2002-05-24 00:08 Copy of LR0ForWin\LR0ForWin.cpp
文件 5932 2002-05-25 01:00 Copy of LR0ForWin\LR0ForWin.dsp
文件 587 2002-05-24 00:46 Copy of LR0ForWin\LR0ForWin.dsw
文件 1357 2002-05-24 00:08 Copy of LR0ForWin\LR0ForWin.h
文件 10798 2002-05-26 21:58 Copy of LR0ForWin\LR0ForWin.rc
文件 10556 2002-05-26 22:37 Copy of LR0ForWin\LR0ForWinDlg.cpp
文件 1738 2002-05-24 00:32 Copy of LR0ForWin\LR0ForWinDlg.h
文件 249 2002-05-24 00:44 Copy of LR0ForWin\Pair.cpp
文件 423 2002-05-24 00:07 Copy of LR0ForWin\Pair.h
文件 408 2002-05-24 00:44 Copy of LR0ForWin\Precept.cpp
文件 280 2002-05-14 22:58 Copy of LR0ForWin\Precept.h
文件 2548 2002-05-24 00:44 Copy of LR0ForWin\ProjectSet.cpp
文件 718 2002-05-23 10:57 Copy of LR0ForWin\ProjectSet.h
文件 1078 2002-05-26 21:56 Copy of LR0ForWin\res\LR0ForWin.ico
文件 401 2002-05-24 00:08 Copy of LR0ForWin\res\LR0ForWin.rc2
..A.SH. 3072 2002-05-27 00:01 Copy of LR0ForWin\res\Thumbs.db
文件 7235 2002-05-19 00:29 Copy of LR0ForWin\ResizingDialog.cpp
............此处省略16个文件信息
- 上一篇:学生信息管理系统j2ee
- 下一篇:VM虚拟机批量快速克隆
评论
共有 条评论