19.05.2013 Views

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 ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

62 CHAPTER 3. CONTEXT-FREE GRAMMARS AND LANGUAGES<br />

we use the system X = KY + K to express every nonterminal Ai in terms of expressions<br />

containing strings αi,j involving a terminal as the leftmost symbol (αi,j ∈ ΣV ∗ ), and we<br />

replace all leftmost occurrences of nonterminals in H (occurrences Ai in strings of the form<br />

Aiβ, whereβ ∈ V ∗ ) using the above expressions. In this fashion, we obtain a matrix L, and<br />

it is immediately shown that the system<br />

X = KY + K,<br />

Y = LY + L,<br />

generates the same tuple of languages. Furthermore, this last system corresponds to a weak<br />

Greibach Normal Form.<br />

It we start with a grammar in Chomsky Normal Form (with no production S → ɛ) such<br />

that every nonterminal belongs to T (G), we actually get a Greibach Normal Form (the entries<br />

in K are terminals, and the entries in H are nonterminals). Thus, we have justified lemma<br />

3.6.1. The method is also quite economical, since it introduces only m2 new nonterminals.<br />

However, the resulting grammar may contain some useless nonterminals.<br />

3.10 Tree Domains and Gorn Trees<br />

Derivation trees play a very important role in parsing theory and in the proof of a strong<br />

version of the pumping lemma for the context-free languages known as Ogden’s lemma.<br />

Thus, it is important to define derivation trees rigorously. We do so using Gorn trees.<br />

Let N+ = {1, 2, 3,...}.<br />

Definition 3.10.1 A tree domain D is a nonempty subset of strings in N ∗ + satisfying the<br />

conditions:<br />

(1) For all u, v ∈ N ∗ +,ifuv ∈ D, thenu ∈ D.<br />

(2) For all u ∈ N ∗ +, for every i ∈ N+, ifui ∈ D then uj ∈ D for every j, 1≤ j ≤ i.<br />

The tree domain<br />

is represented as follows:<br />

D = {ɛ, 1, 2, 11, 21, 22, 221, 222, 2211}<br />

ɛ<br />

↙ ↘<br />

1 2<br />

↙ ↙ ↘<br />

11 21 22<br />

↙ ↘<br />

221 222<br />

↓<br />

2211

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!