LectureNotes12

# LectureNotes12 - ECS 120 Lesson 12 Pushdown Automata Pt 1...

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

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

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

View Full Document
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 0 Stack(Γ) is a stack over Γ.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern