This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS103 HO#36 SlidesCFGs, PDAs 5/2/11 1 Pushdown Automaton state control abbabbbaa... x y a z b . . . $ input stack The machine has a pushdown stack of unlimited capacity. It can push symbols onto the stack or pop them off and read them. The stack is initially empty. The machine cannot explicitly test for an empty stack, so we often push a special symbol on first. A pushdown automaton is a 6tuple (Q, , , , q , F) where 1. Q is a finite set of states, 2. is the finite input alphabet, 3. is the finite stack alphabet, 4. : Q P (Q ) is the transition function, 5. q Q is the start state, and 6. F Q is the set of accept states. Transitions depend on the current state, the input symbol, and the top symbol on the stack. Thus the domain of is Q . { } When a transition occurs, the machine may enter a new state and write a new symbol on the top of the stack. Since the machine is nondeterministic, the range of the transition function is P (Q ) . c , a b We label transitions like this: which means: read c , pop a , push b state control aad c mrjk a f g h q j q k If the machine is in state q j , reading c , with a on top of the stack We label transitions like this: which means: read c , pop a , push b state control b f g h Then it pops the a , pushes b onto the top of the stack, and goes to state q k q j q k aadc m rjk c , a b state control aad c mrjk a f g h If the machine is in state q j , reading c , with a on top of the stack Part of the formal definition of a PDA is the following description of how it computes, which is somewhat difficult: state r i a . . . w 1 … w i+1 …w m t s i If (r i , w i+1 , a) contains (r i+1 ,b) the new situation is: state r i+1 b . . . w 1 …w i+1 w i+2 …w m t s i+1 c , a b We label transitions like this: c , a b read c, pop a, push b , a b nothing read, pop a, push b c , b read c, nothing popped, push b c , a read c, pop a, nothing pushed , b nothing read, nothing popped, push b c , read c, nothing popped, nothing pushed , a nothing read, pop a, nothing pushed , nothing read, nothing popped, nothing pushed CS103 HO#36 SlidesCFGs, PDAs 5/2/11 2 c , a b We label transitions like this: c , a b c a b , a b a b c , b c  b c , a c a  , b b c , c  , a  a  ,  read popped pushed q 1 q q 3 q 2 a , x b , x a , x , $ , $ a , x Machine that recognizes { wa w...
View
Full
Document
This note was uploaded on 06/01/2011 for the course EE 103 taught by Professor Plummer during the Spring '11 term at Stanford.
 Spring '11
 PLUMMER

Click to edit the document details