SlideShare a Scribd company logo
1 of 8
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

Similar to Pushdown Automaton (1).ppt

FiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxFiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxranjan317165
 
Automata theory introduction
Automata theory introductionAutomata theory introduction
Automata theory introductionNAMRATA BORKAR
 
03-FiniteAutomata.pptx
03-FiniteAutomata.pptx03-FiniteAutomata.pptx
03-FiniteAutomata.pptxssuser47f7f2
 
In the automata theory, a nondeterministic finite.pdf
                     In the automata theory, a nondeterministic finite.pdf                     In the automata theory, a nondeterministic finite.pdf
In the automata theory, a nondeterministic finite.pdfannesmkt
 
Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Editor IJARCET
 
Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Editor IJARCET
 
FiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxFiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxMeghnadh
 
Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! EdholeEdhole.com
 
Free Ebooks Download ! Edhole
Free Ebooks Download ! EdholeFree Ebooks Download ! Edhole
Free Ebooks Download ! EdholeEdhole.com
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).pptssuser47f7f2
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.pptRohitPaul71
 
closure properties of regular language.pptx
closure properties of regular language.pptxclosure properties of regular language.pptx
closure properties of regular language.pptxThirumoorthy64
 

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

FiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxFiniteAutomata_anim.pptx
FiniteAutomata_anim.pptx
 
Unit iv
Unit ivUnit iv
Unit iv
 
Automata theory introduction
Automata theory introductionAutomata theory introduction
Automata theory introduction
 
flat unit1
flat unit1flat unit1
flat unit1
 
03-FiniteAutomata.pptx
03-FiniteAutomata.pptx03-FiniteAutomata.pptx
03-FiniteAutomata.pptx
 
Ch2 finite automaton
Ch2 finite automatonCh2 finite automaton
Ch2 finite automaton
 
Automata
AutomataAutomata
Automata
 
In the automata theory, a nondeterministic finite.pdf
                     In the automata theory, a nondeterministic finite.pdf                     In the automata theory, a nondeterministic finite.pdf
In the automata theory, a nondeterministic finite.pdf
 
Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207
 
Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207
 
FiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxFiniteAutomata_anim.pptx
FiniteAutomata_anim.pptx
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
PDA (1) (1).pptx
PDA (1) (1).pptxPDA (1) (1).pptx
PDA (1) (1).pptx
 
TOC Introduction
TOC Introduction TOC Introduction
TOC Introduction
 
Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! Edhole
 
Free Ebooks Download ! Edhole
Free Ebooks Download ! EdholeFree Ebooks Download ! Edhole
Free Ebooks Download ! Edhole
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).ppt
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.ppt
 
closure properties of regular language.pptx
closure properties of regular language.pptxclosure properties of regular language.pptx
closure properties of regular language.pptx
 
Finite automata
Finite automataFinite automata
Finite automata
 

More from viswanath kani

More from viswanath kani (8)

ContextFreeGrammars (1).pptx
ContextFreeGrammars (1).pptxContextFreeGrammars (1).pptx
ContextFreeGrammars (1).pptx
 
Unit2 Toc.pptx
Unit2 Toc.pptxUnit2 Toc.pptx
Unit2 Toc.pptx
 
Unit -I Toc.pptx
Unit -I Toc.pptxUnit -I Toc.pptx
Unit -I Toc.pptx
 
TuringMachines.pdf
TuringMachines.pdfTuringMachines.pdf
TuringMachines.pdf
 
UNIT 2.pdf
UNIT 2.pdfUNIT 2.pdf
UNIT 2.pdf
 
UNIT 1.pdf
UNIT 1.pdfUNIT 1.pdf
UNIT 1.pdf
 
toc_model_qp2-.pdf
toc_model_qp2-.pdftoc_model_qp2-.pdf
toc_model_qp2-.pdf
 
Bio fuel
Bio fuelBio fuel
Bio fuel
 

Recently uploaded

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 

Recently uploaded (20)

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 

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  