文件名称:LR-parser
- 所属分类:
- 编译器/词法分析
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 208kb
- 下载次数:
- 0次
- 提 供 者:
- 浮*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
LR分析器设计
给定说明语句的拓广文法G[S ]如下:
(0) S ->S (1) S->v I:T (2) I->I,i (3) I->i (4) T->r
其中v代表终结符var,r代表real。
其识别规范句型活前缀的DFA及LR(0)分析表如下:
输入
状态 ACTION表 GOTO表
v i , : r # S I T
0 S2 1
1 acc
2 S4 3
3 S6 S5
4 r3 r3 r3 r3 r3 r3
5 S9 8
6 S7
7 r2 r2 r2 r2 r2 r2
8 r1 r1 r1 r1 r1 r1
9 r4 r4 r4 r4 r4 r4
编程实现此文法的LR分析器,并设输入的文法的句子为:
var i , i , i : real
给出输出结果
-LR parser design
Given that statement, The Extension of the grammar G [S ] as follows:
(0) S -> S (1) S-> v I: T (2) I-> I, i (3) I-> i (4) T-> r
One representative of terminator v var, r representative of real.
Living patterns of its identification Specification prefix DFA and LR (0) analysis as follows:
Input
GOTO table table status ACTION
v i,: r# S I T
0 S2 1
1 acc
2 S4 3
3 S6 S5
4 r3 r3 r3 r3 r3 r3
5 S9 8
6 S7
7 r2 r2 r2 r2 r2 r2
8 r1 r1 r1 r1 r1 r1
9 r4 r4 r4 r4 r4 r4
Programming LR parser article law, and set the input sentence is the grammar:
var i, i, i: real
Given output
给定说明语句的拓广文法G[S ]如下:
(0) S ->S (1) S->v I:T (2) I->I,i (3) I->i (4) T->r
其中v代表终结符var,r代表real。
其识别规范句型活前缀的DFA及LR(0)分析表如下:
输入
状态 ACTION表 GOTO表
v i , : r # S I T
0 S2 1
1 acc
2 S4 3
3 S6 S5
4 r3 r3 r3 r3 r3 r3
5 S9 8
6 S7
7 r2 r2 r2 r2 r2 r2
8 r1 r1 r1 r1 r1 r1
9 r4 r4 r4 r4 r4 r4
编程实现此文法的LR分析器,并设输入的文法的句子为:
var i , i , i : real
给出输出结果
-LR parser design
Given that statement, The Extension of the grammar G [S ] as follows:
(0) S -> S (1) S-> v I: T (2) I-> I, i (3) I-> i (4) T-> r
One representative of terminator v var, r representative of real.
Living patterns of its identification Specification prefix DFA and LR (0) analysis as follows:
Input
GOTO table table status ACTION
v i,: r# S I T
0 S2 1
1 acc
2 S4 3
3 S6 S5
4 r3 r3 r3 r3 r3 r3
5 S9 8
6 S7
7 r2 r2 r2 r2 r2 r2
8 r1 r1 r1 r1 r1 r1
9 r4 r4 r4 r4 r4 r4
Programming LR parser article law, and set the input sentence is the grammar:
var i, i, i: real
Given output
(系统自动生成,下载前可以参看下载内容)
下载文件列表
LR parser\Acction.dat
.........\Debug\text5.exe
.........\.....\text5.ilk
.........\.....\text5.obj
.........\.....\text5.pch
.........\.....\text5.pdb
.........\.....\vc60.idb
.........\.....\vc60.pdb
.........\GLR
.........\GLR.dat
.........\GoTo.dat
.........\text5-1.txt
.........\text5-2.txt
.........\text5-3.txt
.........\text5.cpp
.........\text5.dsp
.........\text5.dsw
.........\text5.ncb
.........\text5.opt
.........\text5.plg
.........\Debug
LR parser
.........\Debug\text5.exe
.........\.....\text5.ilk
.........\.....\text5.obj
.........\.....\text5.pch
.........\.....\text5.pdb
.........\.....\vc60.idb
.........\.....\vc60.pdb
.........\GLR
.........\GLR.dat
.........\GoTo.dat
.........\text5-1.txt
.........\text5-2.txt
.........\text5-3.txt
.........\text5.cpp
.........\text5.dsp
.........\text5.dsw
.........\text5.ncb
.........\text5.opt
.........\text5.plg
.........\Debug
LR parser