标签:文法 str strong first 分析 its ilo bsp sel
1.将以下文法消除左递归,并分析符号串 i*i+i
(1)E -> E+T | T
E -> TE‘
E‘ -> +TE‘|ε
(2)T -> T*F | F
T -> FT‘
T‘ -> *F|ε
(3)F -> (E) | i
2.P101练习7(2)(3)文法改写,并分别求FIRST集、FOLLOW集,和SELECT集
(2)
A -> aABe|a
B -> Bb|d
First(A)={a,e}
First(B)={b,d}
(3)
S -> Aa|b
A ->SB
B ->ab
First(S) = {a,b,ab}
First(A) = {a,b,ab}
First(B) = {ab}
3.求以下文法的FIRST集、FOLLOW集和SELECT集。
S->Ap
A->a |ε
A->cA
A->aA
First(S) = {a,ε,c}
First(A) = {a,ε,c}
S->Ap
S->Bq
A->a
A->cA
B->b
B->dB
First(S) = {a,c,b,d}
First(A) = {a,c}
Fitst(B) = {d,b}
标签:文法 str strong first 分析 its ilo bsp sel
原文地址:https://www.cnblogs.com/HvYan/p/11840844.html