LectureNotes12

LectureNotes12 - ECS 120 Lesson 12 – Pushdown Automata,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ECS 120 Lesson 12 – Pushdown Automata, Pt. 1 Oliver Kreylos Wednesday, April 25th, 2001 Today we are going to look at a generalization of (nondeterministic) finite state machines that is capable of recognizing context-free languages. To recall, the major limitation of finite automata is their lack of memory: The only way an FSM can store information about its input is by moving from state to state, which led us to stating the Pumping Lemma, the major tool for proving that a given language is not regular. 1 Pushdown Automata (PDAs) To overcome the limitation of finite automata, we enhance their computing power by providing them with an unlimited amount of memory, accessible in the form of a stack , see Figure 1. A stack consists of an unlimited number of cells, where each cell can hold one symbol from some alphabet Γ, the stack alphabet . As opposed to normal computer memory, which can be accessed randomly , meaning that cells can be read/written in any order, a stack only allows access to its top element at any time, by the following two operations: • A new character γ ∈ Γ can be pushed onto the stack, growing its size by one. The new top element of the stack is the pushed character γ . • If the stack is not empty, the top element of the stack can be popped off the stack, reducing its size by one. The new top element of the stack is the element underneath the just popped element. By this definition, a stack is a last-in first-out (LIFO) data structure: Ele- ments are retrieved from the stack in the opposite order they were pushed onto it. 1 a b a a b a b b P a b a Figure 1: The structure of a pushdown automaton P , consisting of the input tape, the finite state control, the accept signal and the stack. As opposed to the input tape, which can be read only once from left to right, the stack can be modified by push/pop operations during computation. The finite state control of a PDA is very similar to a nondeterministic finite automaton in that it has a finite set of states, a start state, a set of final states and a transition function. The main difference is, that the PDA can base its decision which state to go to next not only on the next input character, but also on the symbol currently on the top of the stack. In each step of computation, a PDA does all of the following in order: 1. Either ignore the input word, or read a character and include it in the decision to which state to go next, 2. either ignore the current stack contents, or pop off the current top character and include it in the decision to which state to go next, and then 3. either leave the current stack alone, or push a new character onto it. 1.1 Formal Definition of a Stack Just as a sidenote, a stack is formally defined as an abstract data type in the following way: Let Γ be an alphabet. Then Stack(Γ), the class of stacks over the alphabet Γ, is defined as follows: 1. The empty stack s ∈ Stack(Γ) is a stack over Γ....
View Full Document

This note was uploaded on 05/20/2010 for the course ECS 120 taught by Professor Filkov during the Spring '07 term at UC Davis.

Page1 / 9

LectureNotes12 - ECS 120 Lesson 12 – Pushdown Automata,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online