CS103
HO#46
Slides--More on Context-Free Languages
May 12, 2010
2
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 6-tuple (Q,
,
,
, q
0
, 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
0
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
)
.
a
,
b
c
We label transitions like this:
which means:
read
a
, pop
b
, push
c
state
control
a
ademrjk
b
f
g
h
q
j
q
k
If the machine is in state q
j
,
reading
a
, with
b
on top of the stack
We label transitions like this:
which means:
read
a
, pop
b
, push
c
state
control
b
f
g
h
If the machine is in state q
j
,
reading
a
, with
b
on top of the stack
state
control
c
f
g
h
Then it pops the
b
,
pushes
c
onto the
top of the stack, and goes to state q
k
a
,
b
c
q
j
q
k
a
ademrjk
a
ademrjk
a , b
c