SlideShare a Scribd company logo
5
Most read
7
Most read
8
Most read
Pushdown Automaton
(PDA)
A Pushdown Automaton is a nondeterministic
finite state automaton (NFA) that permits
ε-transitions and a stack.
Pushdown Automaton (PDA)
 
 
F
q
q
a
q
Q
P n
k
m
i ,
,
,
),...
,
(
)
,
,
(
,
,
, 0
0 


 



Q: A finite set of states.
 : A finite set of input symbols.
: A finite stack alphabet.
: The transition function with input:
qi is a state in Q.
a is a symbol in  or a = e (the empty string).
m is a stack symbol, m  .
and the output is a finite set of pairs:
qk the new state.
n is the string of stack symbols that replaces m at the top of the stack.
If n = e, then the stack is popped.
q0: The start state.
0 : Initially, the PDA’s stack consists this symbol and nothing else.
F : The set of accepting states.
PDA Example: }
1)
(0
|
{ *


 w
ww
L R
wwr
The language, Lwwr, is the even-length
palindromes over alphabet {0,1}.
Lwwr is a Context-Free Language (CFL)
generated by the grammar:
e
|
1
1
|
0
0 S
S
S 
One PDA for Lwwr is given on the following
slide...
PDA for Lwwr
)
1
,
(
)
,
1
,
(
)
0
,
(
)
,
0
,
(
)
1 0
0
0
0
0
0
0
0 




 q
q
q
q 

)
11
,
(
)
1
,
1
,
(
)
10
,
(
)
0
,
1
,
(
)
01
,
(
)
1
,
0
,
(
)
00
,
(
)
0
,
0
,
(
)
2
0
0
0
0
0
0
0
0
q
q
q
q
q
q
q
q








)
1
,
(
)
1
,
,
(
)
0
,
(
)
0
,
,
(
)
,
(
)
,
,
(
)
3 1
0
1
0
0
1
0
0 q
q
q
q
q
q 

 e

e



e

)
,
(
)
1
,
1
,
(
)
,
(
)
0
,
0
,
(
)
4 1
1
1
1 e

e
 q
q
q
q 

)
,
(
)
,
,
(
)
5 0
2
0
1 

e
 q
q 
)
,
(
)
,
ut
End_Of_Inp
Read_Past_
,
(
)
6 0
3
0
2 

 q
q 
}
{
}
,
1
,
0
{
}
1
,
0
{
}
,
,
,
{ 3
0
3
2
1
0 q
F
q
q
q
q
Q 




 
 
F
q
Q
P ,
,
,
,
,
, 0
0 






A Graphical Notation for PDA’s
1. The nodes correspond to the states of the PDA.
2. An arrow labeled Start indicates the unique start
state.
3. Doubly circled states are accepting states.
4. Edges correspond to transitions in the PDA as
follows:
5. An edge labeled (ai, m)/n from state q to state p
means that (q, ai, m) contains the pair (p, n),
perhaps among other pairs.
Graphical Notation for PDA of Lwwr
q0 q1
q2
q3
start
(ε, 0) / 0
(ε, 0) / 0
(ε, 1) / 1
(0,0)/ε
(1,1)/ε
(ε,0) / 0
(EOF,0) / 0
All possibilities that do not have explicit
edges, have implicit edges that go to an
implicit reject state.
• This is a nondeterministic machine.
• Think of the machine as following all possible paths.
• Kill a path if it leads to a reject state.
• If any path leads to an accept state, then the machine accepts.
(0, 0)/00
(0, 1)/01
(1, 0)/10
(1, 1)/11
(0, 0)/00
(1, 0)/10
Exercise 1
Design a PDA that recognizes legal sequences
of ‘if’ and ‘else’ statements in a C program.
In the PDA, let ‘i’ stands for ‘if’ and ‘e’ stands for
‘else’.
Hint: There is a problem whenever the number
of ‘else’ statements in any prefix exceeds the
number of ‘if’ statements in that prefix.
Exercise 2
Design a PDA to accept the language:
}
or
|
{ k
j
j
i
c
b
a k
j
i



More Related Content

PPTX
Pushdown_Automata_Presentation in Automata theory and compiler design
PDF
Free Ebooks Download ! Edhole
PPTX
539_PDA push down automata_ d_b_m_s.pptx
DOCX
UNIT III.docx
PPTX
push down automata
PPTX
csc218pushdownautomata-160627235627.pptx
PPT
Designing of a Determinstic Push Down Atomaton
PPTX
3.1,2,3 pushdown automata definition, moves & id
Pushdown_Automata_Presentation in Automata theory and compiler design
Free Ebooks Download ! Edhole
539_PDA push down automata_ d_b_m_s.pptx
UNIT III.docx
push down automata
csc218pushdownautomata-160627235627.pptx
Designing of a Determinstic Push Down Atomaton
3.1,2,3 pushdown automata definition, moves & id

Similar to Pushdown Automaton (1).ppt (20)

PPTX
Push down automata
PPTX
Unit iv
DOCX
theory of computation notes for school of engineering
PPTX
unit 3.pptx-theory of computation unit 3 notes
PPTX
PPTX
Module 4 PDA updated Theory of computation.pptx
PDF
push down automata- theoretical foundations of computations
PPT
2-stack-Push Down Automata(PDA)_TOComp.ppt
PPTX
PDA (1) (1).pptx
PPTX
Introduction_to_PDA.pptx
PDF
TOC 9 | Pushdown Automata
PPTX
16 PDA push down autometa push down.pptx
PPTX
AUTOMATA AUTOMATA AUTOMATAAutomata7Chapter6.pptx
PPTX
Unit 2 Pumping lemma Unit 2 Pumping lemma
DOCX
Pushdown AutomataChapter 12Recognizing Context-F.docx
PPTX
PDA (pushdown automaton)
PPT
Description of Finite Automata and Languages Accepted by Push Down Automata
PPT
Push Down Automata (PDA) Definition, Problems and State Diagrams including tr...
PPT
Turing Machine push down automata-examples
Push down automata
Unit iv
theory of computation notes for school of engineering
unit 3.pptx-theory of computation unit 3 notes
Module 4 PDA updated Theory of computation.pptx
push down automata- theoretical foundations of computations
2-stack-Push Down Automata(PDA)_TOComp.ppt
PDA (1) (1).pptx
Introduction_to_PDA.pptx
TOC 9 | Pushdown Automata
16 PDA push down autometa push down.pptx
AUTOMATA AUTOMATA AUTOMATAAutomata7Chapter6.pptx
Unit 2 Pumping lemma Unit 2 Pumping lemma
Pushdown AutomataChapter 12Recognizing Context-F.docx
PDA (pushdown automaton)
Description of Finite Automata and Languages Accepted by Push Down Automata
Push Down Automata (PDA) Definition, Problems and State Diagrams including tr...
Turing Machine push down automata-examples
Ad

More from viswanath kani (8)

PPTX
ContextFreeGrammars (1).pptx
PPTX
Unit2 Toc.pptx
PPTX
Unit -I Toc.pptx
PDF
TuringMachines.pdf
PDF
UNIT 2.pdf
PDF
UNIT 1.pdf
PDF
toc_model_qp2-.pdf
DOCX
Bio fuel
ContextFreeGrammars (1).pptx
Unit2 Toc.pptx
Unit -I Toc.pptx
TuringMachines.pdf
UNIT 2.pdf
UNIT 1.pdf
toc_model_qp2-.pdf
Bio fuel
Ad

Recently uploaded (20)

PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Welding lecture in detail for understanding
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPT
Project quality management in manufacturing
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Geodesy 1.pptx...............................................
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Construction Project Organization Group 2.pptx
PPTX
Sustainable Sites - Green Building Construction
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
web development for engineering and engineering
Internet of Things (IOT) - A guide to understanding
Embodied AI: Ushering in the Next Era of Intelligent Systems
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Welding lecture in detail for understanding
Operating System & Kernel Study Guide-1 - converted.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
UNIT 4 Total Quality Management .pptx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Project quality management in manufacturing
CYBER-CRIMES AND SECURITY A guide to understanding
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Geodesy 1.pptx...............................................
Automation-in-Manufacturing-Chapter-Introduction.pdf
Model Code of Practice - Construction Work - 21102022 .pdf
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Construction Project Organization Group 2.pptx
Sustainable Sites - Green Building Construction
bas. eng. economics group 4 presentation 1.pptx
web development for engineering and engineering

Pushdown Automaton (1).ppt

  • 1. Pushdown Automaton (PDA) A Pushdown Automaton is a nondeterministic finite state automaton (NFA) that permits ε-transitions and a stack.
  • 2. Pushdown Automaton (PDA)     F q q a q Q P n k m i , , , ),... , ( ) , , ( , , , 0 0         Q: A finite set of states.  : A finite set of input symbols. : A finite stack alphabet. : The transition function with input: qi is a state in Q. a is a symbol in  or a = e (the empty string). m is a stack symbol, m  . and the output is a finite set of pairs: qk the new state. n is the string of stack symbols that replaces m at the top of the stack. If n = e, then the stack is popped. q0: The start state. 0 : Initially, the PDA’s stack consists this symbol and nothing else. F : The set of accepting states.
  • 3. PDA Example: } 1) (0 | { *    w ww L R wwr The language, Lwwr, is the even-length palindromes over alphabet {0,1}. Lwwr is a Context-Free Language (CFL) generated by the grammar: e | 1 1 | 0 0 S S S  One PDA for Lwwr is given on the following slide...
  • 4. PDA for Lwwr ) 1 , ( ) , 1 , ( ) 0 , ( ) , 0 , ( ) 1 0 0 0 0 0 0 0 0       q q q q   ) 11 , ( ) 1 , 1 , ( ) 10 , ( ) 0 , 1 , ( ) 01 , ( ) 1 , 0 , ( ) 00 , ( ) 0 , 0 , ( ) 2 0 0 0 0 0 0 0 0 q q q q q q q q         ) 1 , ( ) 1 , , ( ) 0 , ( ) 0 , , ( ) , ( ) , , ( ) 3 1 0 1 0 0 1 0 0 q q q q q q    e  e    e  ) , ( ) 1 , 1 , ( ) , ( ) 0 , 0 , ( ) 4 1 1 1 1 e  e  q q q q   ) , ( ) , , ( ) 5 0 2 0 1   e  q q  ) , ( ) , ut End_Of_Inp Read_Past_ , ( ) 6 0 3 0 2    q q  } { } , 1 , 0 { } 1 , 0 { } , , , { 3 0 3 2 1 0 q F q q q q Q          F q Q P , , , , , , 0 0       
  • 5. A Graphical Notation for PDA’s 1. The nodes correspond to the states of the PDA. 2. An arrow labeled Start indicates the unique start state. 3. Doubly circled states are accepting states. 4. Edges correspond to transitions in the PDA as follows: 5. An edge labeled (ai, m)/n from state q to state p means that (q, ai, m) contains the pair (p, n), perhaps among other pairs.
  • 6. Graphical Notation for PDA of Lwwr q0 q1 q2 q3 start (ε, 0) / 0 (ε, 0) / 0 (ε, 1) / 1 (0,0)/ε (1,1)/ε (ε,0) / 0 (EOF,0) / 0 All possibilities that do not have explicit edges, have implicit edges that go to an implicit reject state. • This is a nondeterministic machine. • Think of the machine as following all possible paths. • Kill a path if it leads to a reject state. • If any path leads to an accept state, then the machine accepts. (0, 0)/00 (0, 1)/01 (1, 0)/10 (1, 1)/11 (0, 0)/00 (1, 0)/10
  • 7. Exercise 1 Design a PDA that recognizes legal sequences of ‘if’ and ‘else’ statements in a C program. In the PDA, let ‘i’ stands for ‘if’ and ‘e’ stands for ‘else’. Hint: There is a problem whenever the number of ‘else’ statements in any prefix exceeds the number of ‘if’ statements in that prefix.
  • 8. Exercise 2 Design a PDA to accept the language: } or | { k j j i c b a k j i  