目 录
引 言.....................................................................................................................................................I
摘 要...................................................................................................................................................II
第 1 章 概述........................................................................................................................................1
1.1 项目背景...............................................................................................................................1
1.2 编写目的...............................................................................................................................1
1.3 软件定义...............................................................................................................................1
1.4 开发环境...............................................................................................................................2
1.4.1 Visual C++简介..........................................................................................................2
1.4.2 MFC............................................................................................................................2
第 2 章 需求分析................................................................................................................................3
2.1 问题陈述...............................................................................................................................3
2.2 LR 分析器工作原理简介.....................................................................................................3
2.3 需完成的功能.......................................................................................................................4
2.4 数据流图...............................................................................................................................5
2.4.1 LR(1)分析器构造及输入串分析流程......................................................................5
2.4.2 求项目集规范族流程................................................................................................6
2.4.3 分析表构造流程........................................................................................................7
2.4.4 总控程序流程............................................................................................................8
2.5 数据字典表达.......................................................................................................................8
2.5.1 数据项........................................................................................................................8
2.5.2 数据结构....................................................................................................................9
2.5.3 数据流........................................................................................................................9
2.5.4 数据存储..................................................................................................................11
2.5.5 处理过程..................................................................................................................11
第 3 章 逻辑设计..............................................................................................................................14
3.1 系统基本工作流程.............................................................................................................14
3.2 系统设计模块框图.............................................................................................................15
第 4 章 总体设计..............................................................................................................................16
4.1 主要模块原理介绍.............................................................................................................16
4.1.1 LR(1)项目集族构造................................................................................................16
4.1.2 LR(1)分析表构造....................................................................................................16
4.1.3 LR(0)文法判定........................................................................................................17
4.2 主要模块算法思想.............................................................................................................17
4.2.1 相关数据结构..........................................................................................................17
4.2.2 项目集求闭包..........................................................................................................18
4.2.3 LR(0)判定模块........................................................................................................18
4.2.4 总控程序..................................................................................................................19
4.3 LR(0)文法判定流程图及核心代码...................................................................................20
4.3.1 流程图......................................................................................................................20
4.3.2 LR(0)文法判定源程序............................................................................................20