13.11.2014 Views

Introduction to Computational Linguistics

Introduction to Computational Linguistics

Introduction to Computational Linguistics

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.

21. Pushdown Au<strong>to</strong>mata 84<br />

Next we skip the D–productions.<br />

(215)<br />

S → CC | CCZ A → a<br />

Z → ABA | ABYA | ABAZ | ABYAZ B → b<br />

D → AB | ABY C → c<br />

Y → C | CY<br />

Next D can be eliminated (since it is not reachable) and we can replace on the right<br />

hand side of the productions the first nonterminals by terminals.<br />

(216)<br />

S → cC | cCZ<br />

Z → aBA | aBYA | aBAZ | aBYZ<br />

Y → c | cY<br />

Now the grammar is in Greibach Normal Form.<br />

21 Pushdown Au<strong>to</strong>mata<br />

Regular languages can be recognized by a special machine, the finite state au<strong>to</strong>ma<strong>to</strong>n.<br />

Recognition here means that the machine scans the string left–<strong>to</strong>–right and<br />

when the string ends (the machine is <strong>to</strong>ld when the string ends) then it says ‘yes’<br />

if the string is in the language and ‘no’ otherwise. (This picture is only accurate<br />

for deterministic machines; more on that later.)<br />

There are context free languages which are not regular, for example {a n b n : n ∈<br />

N}. Thus devices that can check membership in L(G) for a CFG must therefore<br />

be more powerful. The devices that can do this are called pushdown au<strong>to</strong>mata.<br />

They are finite state machines which have a memory in form of a pushdown. A<br />

pushdown memory is potentially infinite. You can s<strong>to</strong>re in it as much as you like.<br />

However, the operations that you can perform on a pushdown s<strong>to</strong>rage are limited.<br />

You can see only the last item you added <strong>to</strong> it, and you can either put something<br />

on <strong>to</strong>p of that element, or you can remove that element and then the element that<br />

was added before it becomes visible. This behaviour is also called LIFO (last–<br />

in–first–out) s<strong>to</strong>rage. It is realized for example when s<strong>to</strong>ring plates. You always<br />

add plates on <strong>to</strong>p, and remove from the <strong>to</strong>p, so that the bot<strong>to</strong>mmost plates are only<br />

used when there is a lot of people. It is easy <strong>to</strong> see that you can decide whether<br />

a given string has the form a n b n given an additional pushdown s<strong>to</strong>rage. Namely,<br />

you scan the string from left <strong>to</strong> right. As long as you get a, you put it on the

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

Saved successfully!

Ooh no, something went wrong!