11. Transformations of CFG
Expression is open or closed
S→S0∣SC
S0→if(E)S∣if(E)ScelseS0
Sc→Ss∣if(E)ScelseSc
L(Gn)=L(G2)
Removal of useless pro...
S→aAB∣b
A→aA∣a
B→Bb
X:N
.....
B is non-productive
A is unreachable
A→XBY
B→C∣D∣ϵ
A→XCY∣XDY∣XY
A→Aa∣b
X is left-recursive, if X=>∗Xx
A→bA′
A′−>aA′ϵ
S→A∣B
A→ABc∣AAd∣a∣aa
A→aA′∣aaA′
A′→BcA′∣AdA′∣ϵ
B→bB′
B′→ccB′∣ϵ
??
A→BaB
B→Abb∣Acb∣ϵ
A=>BaB=>AbbaB