Chapter 3 Context-Free Grammars, Context-Free Languages, Parse ...
Chapter 3 Context-Free Grammars, Context-Free Languages, Parse ...
Chapter 3 Context-Free Grammars, Context-Free Languages, Parse ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
3.9. LEAST FIXED-POINTS AND THE GREIBACH NORMAL FORM 57<br />
If w ∈ Φ n G,i (∅,...,∅) for some n ≥ 2, then there is some rule Ai → αi,j with αi,j of the<br />
form<br />
αi,j = u1Aj1u2 ···ukAjk uk+1,<br />
where u1,...,uk+1 ∈ Σ ∗ , k ≥ 1, and some w1,...,wk ∈ Σ ∗ such that<br />
and<br />
By the induction hypothesis, Ajh<br />
so that Ai<br />
since k ≤ M.<br />
p<br />
=⇒ w with<br />
wh ∈ Φ n−1<br />
G,jh (∅,...,∅),<br />
w = u1w1u2 ···ukwkuk+1.<br />
ph<br />
=⇒ wh with ph ≤ (M +1) n−2 , and thus<br />
Ai =⇒ u1Aj1u2 ···ukAjk uk+1<br />
p1<br />
=⇒··· pk<br />
=⇒ w,<br />
p ≤ p1 + ···+ pk +1≤ M(M +1) n−2 +1≤ (M +1) n−1 ,<br />
Combining Claim 1 and Claim 2, we have<br />
L(GAi )= Φ n G,i(∅,...,∅),<br />
which proves that the least fixed-point of the map ΦG is the m-tuple of languages<br />
n<br />
(L(GA1),...,L(GAm)).<br />
We now show how theorem 3.8.3 can be used to give a short proof that every context-free<br />
grammar can be converted to Greibach Normal Form.<br />
3.9 Least Fixed-Points and the Greibach Normal Form<br />
The hard part in converting a grammar G =(V,Σ,P,S) to Greibach Normal Form is to<br />
convertittoagrammarinso-calledweak Greibach Normal Form, where the productions<br />
are of the form<br />
A → aα, or<br />
S → ɛ,<br />
where a ∈ Σ, α ∈ V ∗ ,andifS → ɛ is a rule, then S does not occur on the right-hand side of<br />
any rule. Indeed, if we first convert G to Chomsky Normal Form, it turns out that we will<br />
get rules of the form A → aBC, A → aB or A → a.