文件名称:语法分析之左递归实验
介绍说明--下载内容均来自于网络,请自行研究使用
此为编译原理实验报告 学习消除文法左递规算法,了解消除文法左递规在语法分析中的作用 内含 设计算法 目的 源码 等等.... 算法:消除左递归算法为: (1)把文法G的所有非终结符按任一种顺序排列成P1,P2,…Pn 按此顺序执行 (2)FOR i:=1 TO n DO BEGIN FOR j:=1 DO 把形如Pi→Pjγ的规则改写成 Pi→δ1γ δ2γ … δkγ。其中Pj→δ1 δ2 … δk是关于Pj的所有规则; 消除关于Pi规则的直接左递归性 END (3)化简由(2)所得的文法。即去除那些从开始符号出发永远无法到达的非终结符的 产生规则。-to compile this report principle experiment to eliminate learning grammar rules Left delivery algorithm, left the Elimination delivery grammar rules in grammar analysis of the role of the design algorithm containing purpose algorithm source code .... etc. : Elimination left recursive algorithm : (1) grammar, of all non-G website by the end of a paramagnetic Arrange sequence P1, P2, ... Pn implementation of this order (2) FOR i : n = 1 DO TO BEGIN FOR j : = 1 DO put the shape of Pi Gamma approximate rewrite the rules 1 into Pi Gamma Gamma 2 k .... These ions 1 2 ... k ions on all the rules; Pi elimination of the direct rule left recursive END (3) Reduction from (2) from the grammar. Removing that those symbols starting from the beginning will never be able to reach the end of the webs
(系统自动生成,下载前可以参看下载内容)
下载文件列表
编译原理实验3.doc