作业帮 > 综合 > 作业

编译原理:消除文法中的左递归

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/14 12:24:28
编译原理:消除文法中的左递归
消除文法G1中的左递归后构造预测分析表.
第一个消除左递归后
S->TS'
S'->-TS'|ε
第二个T消除左递归后
T->FT'
T'->/FT'|ε
然后求STS'T'F的FIRST集和FOLLOW集
first {S} = { ( ,e} follow{S} ={#,)}
first {S'} = {-,ε} follow{S'}={#,)}
first{T} = {(,e} follow{T} ={-,#,)}
first{T'}= {/,ε} follow{T'}={-,#,)}
first(F)={(,e} follow{F}={-,#,),/}
预测分析表:
e ( ) - / #
S TS' TS'
S' ε -TS' ε
T FT' FT'
T' ε ε /FT' ε
F e (S)
再问: ���������⼸�� ��ָ�л http://zhidao.baidu.com/question/680468671167188732.html?quesup2&oldq=1 http://zhidao.baidu.com/question/454915656036153405.html?quesup2&oldq=1 ���ߵȣ���л