文档介绍:优质资料
简单的编译原理语法分析器的实现
摘要
编译程序一般由词法分析程序、语法分析程序、语义分析程序、中间代码生成程序、目标代码生成程序、代码优化程序、表格管理程序和出错处理程序等成分构成。在编译原理的教学过程中,算法的讲解都需要对算法进行详细的分析,包括算法条件的判断,文法分析表的构造过程,文法分析表的具体生成,针对文法的句子的分析过程等,这些过程往往需要占用大量时间来分析、制表等。本软件的主要任务就是利用程序来完成算法的上述相关过程,以达到高效,直观的效果。本文旨在介绍语法分析方法中的一种自上而下的分析方法——LL(1)分析法。所谓LL(1)分析法是指语法分析是按自左至右的顺序向前查看一个输入字符串,并分析过程中产生句子的最左推导。
关键词:编译;语法分析;LL(1)算法;演示
The Design and Implementation of A Syntax Analyzer based pilation Theory
Abstract
piler 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 piler 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 plete 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
2
2
递归子程序 3
LL(K)分析方法 4
LL(1)分析方法 4
(1)分析表 5
2 系统流程图 6
6
系统模块流程图 7
3 系统实施 7
8
8
9
9
9
10
10
12
12
::=aβ规则 13
::=Dβ规则 13
::=ε规则 13