Human-awareRobo.cs
1
Pushdown Automata • 2017/09/14
• Chapter 2.2 in Sipser
Ø Announcement: q Slides for this lecture are here:
http://www.public.asu.edu/~yzhan442/teaching/CSE355/Lectures/PDA.pdf
Human-awareRobo.cs
2
Last time
FA (DFA & NFA) express Regular Expressions (RE)
• Context free langauges
o Context free grammars
q Design CFGs
q Ambiguities
q Chomsky normal form
Ø Goals:
o Learned context free grammars: the generator for CFLs
CFL
Human-awareRobo.cs
3
Outline for today
FA (DFA & NFA) express Regular Expressions (RE)
• Context free langauges
o Context free grammars
o Pushdown automata
q Definition of PDA
q Computation PDA
Ø Goals:
o Learn PDA, the computing machine for CFL
CFL
Human-awareRobo.cs
4
Pushdown automata
FA:
PDA:
Human-awareRobo.cs
5
Pushdown automata
NPDA
Human-awareRobo.cs
6
Pushdown automata
Human-awareRobo.cs
7
Outline for today
FA (DFA & NFA) express Regular Expressions (RE)
• Context free langauges
o Context free grammars
o Pushdown automata
q Definition of PDA
q Computation PDA
Ø Goals:
o Learn PDA, the computing machine for CFL
CFL
Human-awareRobo.cs
8
Computation of PDA
input string stack
Human-awareRobo.cs
9
Computation of PDA
input string stack
$
Human-awareRobo.cs
10
Computation of PDA
input string stack
a $
Human-awareRobo.cs
11
Computation of PDA
input string stack
a $
Human-awareRobo.cs
12
Computation of PDA
input string stack
a a $
Human-awareRobo.cs
13
Computation of PDA
input string stack
a $
Human-awareRobo.cs
14
Computation of PDA
input string stack
$
Human-awareRobo.cs
15
Computation of PDA
input string stack
ACCEPT
Human-awareRobo.cs
16
Computation of PDA
input string stack
ACCEPT
what is the language here?
Human-awareRobo.cs
17
Computation of PDA
input string stack
ACCEPT
what is the language here? { anbn | n = 0, 1, … }
Human-awareRobo.cs
18
Computation of PDA
Human-awareRobo.cs
19
Computation of PDA
• Why do we need the $ sign for stack?
• Does the stack have to be empty to accept?
• What if a PDA only pushes and never pops?
• What if a PDA always pops after pushes?
• What if a PDA can only keep one symbol on the stack?
Human-awareRobo.cs
20
Example
Human-awareRobo.cs
21
Example
{ a+b }
Human-awareRobo.cs
22
Example
Human-awareRobo.cs
23
Example
{ ambn | } m n 2m,m > 0
Human-awareRobo.cs
24
Outline for today
FA (DFA & NFA) express Regular Expressions (RE)
• Reading assignment for the next class:
o Sipser Sec. 2.2 (remaining) – Quiz link will
be sent out; due date is before the
beginning of the next class on Sep 21
CFL
• Context free langauges
o Context free grammars
o Pushdown automata
q Definition of PDA
q Computation PDA
Ø Goals:
o Learned PDA, the computing machine for CFL