一个编译原理语法分析器的实现与设计一个编译原理语法分析器的实现与设计—免费毕业设计论文.doc
文本预览下载声明
学位论文
一个编译原理语法分析器的实现与设计
论文作者姓名: 申请学位专业: 申请学位类别: 指导教师姓名(职称): 论文提交日期: 一个编译原理语法分析器的实现与设计
摘 要
编译程序一般由词法分析程序、语法分析程序、语义分析程序、中间代码生成程序、目标代码生成程序、代码优化程序、表格管理程序和出错处理程序等成分构成。本文旨在介绍语法分析方法中的一种自上而下的分析方法——LL1)分析法。所谓LL1)分析法是指语法分析是按自左至右的顺序向前查看一个输入字符串,并分析过程中产生句子的最左推导。The Design and Implementation of A Syntax Analyzer based on Compilation Theory
Abstract
The compiler generally is made up of the lexical analyzer program, the syntax analysis program, the semantics analysis program, the inter-language production procedure, the goal code production procedure, the code optimization procedure, the form executive program and the procedure of disposing mistakes. In the teaching process of compiler principle, all algorithm explanation needs to be explain clearly, including algorithm condition judgment, grammar analytical table structure process, grammar analytical table concrete production, in view of grammar sentence analysis process and so on. These processes often take much time to analyze, the scheduling and so on. This program mainly work is to complete the algorithm which take advantage of the procedure to deal with those above mentioned processes , in order to save time. The paper aims at introducing a syntax analytical method named LL(1) algorithm which from the up to down. The syntax analyzer analyzes the character string beginning from the left to right one word each time and educes the most left deduction of the sentence in the analyze course..
Key words: compiler; grammar analysis; LL(1) algorithm; demonstrate
目 录
论文总页数:22页
1引言 1
1.1项目背景 1
1.2目标 1
1.3名词解释 1
1.4算法简介 2
1.4.1自顶向下分析 2
1.4.2 递归子程序 3
1.4.3 LL(K)分析方法 4
1.4.4 LL(1)分析方法 4
1.4.5LL(1)分析表 5
2 系统流程图 6
2.1程序流程图 6
2.2 系统模块流程图 7
3 系统实施 7
3.1文件读取模块 8
3.1.1文件读取使用的CommonDialog控件介绍 8
3.1.2文法左递归的判断 9
3.2算法分析模块 9
3.2.1求select集 9
3.2.2求first集 10
3.2.3求follow集 10
3.3分析表构造模块 12
3.3.1构造文法分析表 12
3.3.2A::=aβ规则 13
3.3.3A::=Dβ规则 13
3.3.4A::=ε规则 13
3.4句子分析模块 13
3.4.1读取句子 14
3.4.2分析句子 14
4 特殊问题及解决方法 14
4.1 Select集的求解 15
4.1.1 问题描述
显示全部