文件名称:LL-(1)-parser
- 所属分类:
- 编译器/词法分析
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 186kb
- 下载次数:
- 0次
- 提 供 者:
- 浮*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
LL(1)语法分析器设计
1.如下为给定的LL(1)文法。
G[<P>]:
1) <P>->program <D> : <T> begin <S> end {program}
2) D->i D’ {i}
3) D’->, i D’ {,}
4) D’->ε {:}
5) S->s S’ {s}
6) S’-> s S’ { }
7) S’->ε {end}
8) T->real {real}
9) T->integer {integer}
其中右侧{}内为产生的可选集。
2.调试并完善如下给出的文法的LL(1)分析器示例程序,并设输入的文法的句子为:
program
i , i , i : integer
begin
s s s
end
给出输出结果并进行分析说明。
-1. Below for a given LL (1) grammar.
G [<P>]:
1) <P>-> program <D>: <T> begin <S> end {program}
2) D-> i D {i}
3) D ->, i D {,}
4) D -> ε {:}
5) S-> s S {s}
6) S -> s S { }
7) S -> ε {end}
8) T-> real {real}
9) T-> integer {integer}
{} within which the right to produce an optional set.
2. Debug and improve the grammar given in the following LL (1) analyzer sample program, and set the input sentence is the grammar:
program
i, i, i: integer
begin
s s s
end
Output and analysis are given instructions.
1.如下为给定的LL(1)文法。
G[<P>]:
1) <P>->program <D> : <T> begin <S> end {program}
2) D->i D’ {i}
3) D’->, i D’ {,}
4) D’->ε {:}
5) S->s S’ {s}
6) S’-> s S’ { }
7) S’->ε {end}
8) T->real {real}
9) T->integer {integer}
其中右侧{}内为产生的可选集。
2.调试并完善如下给出的文法的LL(1)分析器示例程序,并设输入的文法的句子为:
program
i , i , i : integer
begin
s s s
end
给出输出结果并进行分析说明。
-1. Below for a given LL (1) grammar.
G [<P>]:
1) <P>-> program <D>: <T> begin <S> end {program}
2) D-> i D {i}
3) D ->, i D {,}
4) D -> ε {:}
5) S-> s S {s}
6) S -> s S { }
7) S -> ε {end}
8) T-> real {real}
9) T-> integer {integer}
{} within which the right to produce an optional set.
2. Debug and improve the grammar given in the following LL (1) analyzer sample program, and set the input sentence is the grammar:
program
i, i, i: integer
begin
s s s
end
Output and analysis are given instructions.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
LL (1) parser\Debug\text3.exe
.............\.....\text3.ilk
.............\.....\text3.obj
.............\.....\text3.pch
.............\.....\text3.pdb
.............\.....\vc60.idb
.............\.....\vc60.pdb
.............\g1.dat
.............\LL1.dat
.............\text3-1.txt
.............\text3-2.txt
.............\text3.cpp
.............\text3.dsp
.............\text3.dsw
.............\text3.ncb
.............\text3.opt
.............\text3.plg
.............\Debug
LL (1) parser
.............\.....\text3.ilk
.............\.....\text3.obj
.............\.....\text3.pch
.............\.....\text3.pdb
.............\.....\vc60.idb
.............\.....\vc60.pdb
.............\g1.dat
.............\LL1.dat
.............\text3-1.txt
.............\text3-2.txt
.............\text3.cpp
.............\text3.dsp
.............\text3.dsw
.............\text3.ncb
.............\text3.opt
.............\text3.plg
.............\Debug
LL (1) parser