SlideShare a Scribd company logo
1 of 77
PUSH DOWN AUTOMATA
• Adding additional auxiliary memory to Finite Automaton; in
form of ‘ Stack’ ; is Pushdown Automaton.
• While removing the elements LIFO ( Last In First Out) basis.
Pushdown Automata
• Has Read only Input Tape
• An input Alphabet
• Finite state control
• Set of final states
• Initial state
• In Addition to this has Stack “Pushdown Store”.
• It is a Read Write Pushdown Store, as element added to PDA
or removed from PDA
• PDA is in some state and on reading an input symbol and the
topmost symbol in PDA, it moves to a new state and
writes(adds) a string of symbol in PDA.
Pushdown Automata
Pushdown automata are for context-free
languages what finite automata are for regular
languages.
PDAs are recognizing automata that have a
single stack (= memory):
Last-In First-Out pushing and popping
Difference: PDAs are inherently nondeterministic.
(They are not practical machines.)
Types of PDA
• Deterministic PDA- In PDA, there exits exactly
one transition for each input symbol.
• Non Deterministic PDA- In PDA, there may
exits more than one transition for each input
symbol.
Construct a PDA for
}
0
:
{ 
n
b
a n
n
`
Top Down Parsing
• start at the root of derivation tree and
fill in.
• picks a production and tries to match the
input .
• may require backtracking.
Top Down Parsing
Top Down Parsing
Bottom up Parsing
• start at the leaves and
fill in
• start in a state valid for legal
first tokens.
• as input is consumed, change state to encode
possibilities.
• use a stack to store both state and sentential
forms
Bottom Up Parsing
ACCEPTANCE BY pda
• Null Store Acceptance
• Final State Acceptance
Model of PDA
LL(K) Grammer
• In this section we present certain techniques
for top-down parsing which can be applied to
a certain subclass of context-free languages.
We illustrate them by means of some
examples. We discuss LL(l) parsing, LL(k)
parsing, left factoring and the technique to
remove left recursion.
• EXAMPLE
LL(1) Grammer
LL(2) Grammer
LR(K) Grammer
Bottom-Up Parsing
• Start at the leaves and grow toward root
• As input is consumed, encode possibilities in
an internal state
• A powerful parsing technology
• LR grammars
– Construct right-most derivation of program
– Left-recursive grammar, virtually all programming
language are left-recursive
– Easier to express syntax
Bottom-Up Parsing
• Right-most derivation
– Start with the tokens
– End with the start symbol
– Match substring on RHS of production, replace by
LHS
– Shift-reduce parsers
• Parsers for LR grammars
• Automatic parser generators (yacc, bison)
Bottom-Up Parsing
• Example Bottom-Up Parsing
S  S + E | E
E  num | (S)
(1+2+(3+4))+5  (E+2+(3+4))+5 (S+2+(3+4))+5
(S+E+(3+4))+5 (S+(3+4))+5 (S+(E+4))+5
(S+(S+4))+5 (S+(S+E))+5 (S+(S))+5
(S+E)+5 (S)+5 E+5
S+5 S+E S
Bottom-Up Parsing
• Advantage
– Can postpone the selection of productions until
more of the input is scanned
S
S
E
1
+ E
2
S
S
E
( S
S
E
1
+ E
2
)
+ E
Top-Down
Parsing
Bottom-Up
Parsing
SS + E | E
E  num | (S)
More time to decide what rules to apply
Properties of LR(K)
• Every LR(k) grammar G is unambiguouS.
Properties of LR(K)
Properties of LL(K) Grammer
LBA
LBA
LBA Tuples
Types of Turing Machine(Variation)
• MultiTape
• MultiHead
• 2way infinite TM
• Non Deterministic
• Deterministic
• Multi Dimensional
• Universal
2 way infinite TM
Multi Tape Turing Machine
MultiHead TM
Non Deterministic TM
Multi Dimensional TM
Universal TM
• In computer science, a universal Turing
machine(UTM) is a Turing machine that can
simulate an arbitrary Turing machine on
arbitrary input.
• The universal machine essentially achieves
this by reading both the description of
the machine to be simulated as well as the
input thereof from its own tape.
Universal TM
Turing Machine Model
Tuples of TM
Halting Problem
Halting Problem
Halting Problem
Halting Problem of Turing machine
Decidable and Undecidable
Problems
PCP
Undecidable Languages
Decidable Languages
Decidable Languages
Computational Complexity:
Measuring Time & Space Complexity
• Space Complexity-
• Space complexity
• The better the time complexity of an algorithm is, the faster the
algorithm will carry out his work in practice. Apart from time
complexity, its space complexity is also important: This is
essentially the number of memory cells which an algorithm needs.
A good algorithm keeps this number as small as possible, too.
• There is often a time-space-tradeoff involved in a problem, that is,
it cannot be solved with few computing time and low memory
consumption. One then has to make a compromise and to exchange
computing time for memory consumption or vice versa, depending
on which algorithm one chooses and how one parameterizes it.
Measuring Time Complexity
• Time complexity
• How long does this sorting program run? It
possibly takes a very long time on large inputs
(that is many strings) until the program has
completed its work and gives a sign of life
again. Sometimes it makes sense to be able to
estimate the running time before starting a
progr
Cellular Automata
List of Questions to be practiced on
PDA
Some of the Solutions on PDA
Problems
Some of the Solutions on PDA
Problems
Some of the Solutions on PDA
Problems
Some of the Solutions on PDA
Problems
Turing Machine
On 1n2n3n Solution
BEST OF LUCK IN YOUR ETE

More Related Content

Similar to PDA and Turing Machine (1).ppt

System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1
Manoj Patil
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
Abha Damani
 

Similar to PDA and Turing Machine (1).ppt (20)

week 2 - INTRO TO PROGRAMMING.pptx
week 2 - INTRO TO PROGRAMMING.pptxweek 2 - INTRO TO PROGRAMMING.pptx
week 2 - INTRO TO PROGRAMMING.pptx
 
Unit1 Part2 1.ppt
Unit1 Part2 1.pptUnit1 Part2 1.ppt
Unit1 Part2 1.ppt
 
Unit1 Part2 1.ppt
Unit1 Part2 1.pptUnit1 Part2 1.ppt
Unit1 Part2 1.ppt
 
Basic syntax : Algorithm,Flow chart
Basic syntax : Algorithm,Flow chartBasic syntax : Algorithm,Flow chart
Basic syntax : Algorithm,Flow chart
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
 
Parallel concepts1
Parallel concepts1Parallel concepts1
Parallel concepts1
 
System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptx
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
INTRODUCTION TO C++, Chapter 1
INTRODUCTION TO C++, Chapter 1INTRODUCTION TO C++, Chapter 1
INTRODUCTION TO C++, Chapter 1
 
Compier Design_Unit I.ppt
Compier Design_Unit I.pptCompier Design_Unit I.ppt
Compier Design_Unit I.ppt
 
Compier Design_Unit I.ppt
Compier Design_Unit I.pptCompier Design_Unit I.ppt
Compier Design_Unit I.ppt
 
Computer programming and utilization
Computer programming and utilizationComputer programming and utilization
Computer programming and utilization
 
Principles of Compiler Design
Principles of Compiler DesignPrinciples of Compiler Design
Principles of Compiler Design
 
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
BCE L-2 Algorithms-and-Flowchart-ppt.pptBCE L-2 Algorithms-and-Flowchart-ppt.ppt
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
 
C program execution and algorithm
C program execution and algorithm C program execution and algorithm
C program execution and algorithm
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 

Recently uploaded

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 

Recently uploaded (20)

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
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
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
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
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
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
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
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
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
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 

PDA and Turing Machine (1).ppt

  • 2. • Adding additional auxiliary memory to Finite Automaton; in form of ‘ Stack’ ; is Pushdown Automaton. • While removing the elements LIFO ( Last In First Out) basis. Pushdown Automata
  • 3. • Has Read only Input Tape • An input Alphabet • Finite state control • Set of final states • Initial state • In Addition to this has Stack “Pushdown Store”. • It is a Read Write Pushdown Store, as element added to PDA or removed from PDA • PDA is in some state and on reading an input symbol and the topmost symbol in PDA, it moves to a new state and writes(adds) a string of symbol in PDA.
  • 4. Pushdown Automata Pushdown automata are for context-free languages what finite automata are for regular languages. PDAs are recognizing automata that have a single stack (= memory): Last-In First-Out pushing and popping Difference: PDAs are inherently nondeterministic. (They are not practical machines.)
  • 5.
  • 6. Types of PDA • Deterministic PDA- In PDA, there exits exactly one transition for each input symbol. • Non Deterministic PDA- In PDA, there may exits more than one transition for each input symbol.
  • 7. Construct a PDA for } 0 : {  n b a n n
  • 8.
  • 9.
  • 10. `
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. Top Down Parsing • start at the root of derivation tree and fill in. • picks a production and tries to match the input . • may require backtracking.
  • 27. Bottom up Parsing • start at the leaves and fill in • start in a state valid for legal first tokens. • as input is consumed, change state to encode possibilities. • use a stack to store both state and sentential forms
  • 29. ACCEPTANCE BY pda • Null Store Acceptance • Final State Acceptance
  • 31. LL(K) Grammer • In this section we present certain techniques for top-down parsing which can be applied to a certain subclass of context-free languages. We illustrate them by means of some examples. We discuss LL(l) parsing, LL(k) parsing, left factoring and the technique to remove left recursion. • EXAMPLE
  • 35. Bottom-Up Parsing • Start at the leaves and grow toward root • As input is consumed, encode possibilities in an internal state • A powerful parsing technology • LR grammars – Construct right-most derivation of program – Left-recursive grammar, virtually all programming language are left-recursive – Easier to express syntax
  • 36. Bottom-Up Parsing • Right-most derivation – Start with the tokens – End with the start symbol – Match substring on RHS of production, replace by LHS – Shift-reduce parsers • Parsers for LR grammars • Automatic parser generators (yacc, bison)
  • 37. Bottom-Up Parsing • Example Bottom-Up Parsing S  S + E | E E  num | (S) (1+2+(3+4))+5  (E+2+(3+4))+5 (S+2+(3+4))+5 (S+E+(3+4))+5 (S+(3+4))+5 (S+(E+4))+5 (S+(S+4))+5 (S+(S+E))+5 (S+(S))+5 (S+E)+5 (S)+5 E+5 S+5 S+E S
  • 38. Bottom-Up Parsing • Advantage – Can postpone the selection of productions until more of the input is scanned S S E 1 + E 2 S S E ( S S E 1 + E 2 ) + E Top-Down Parsing Bottom-Up Parsing SS + E | E E  num | (S) More time to decide what rules to apply
  • 39. Properties of LR(K) • Every LR(k) grammar G is unambiguouS.
  • 42. LBA
  • 43. LBA
  • 45. Types of Turing Machine(Variation) • MultiTape • MultiHead • 2way infinite TM • Non Deterministic • Deterministic • Multi Dimensional • Universal
  • 47. Multi Tape Turing Machine
  • 51. Universal TM • In computer science, a universal Turing machine(UTM) is a Turing machine that can simulate an arbitrary Turing machine on arbitrary input. • The universal machine essentially achieves this by reading both the description of the machine to be simulated as well as the input thereof from its own tape.
  • 58. Halting Problem of Turing machine
  • 60.
  • 61.
  • 62.
  • 63. PCP
  • 67. Computational Complexity: Measuring Time & Space Complexity • Space Complexity- • Space complexity • The better the time complexity of an algorithm is, the faster the algorithm will carry out his work in practice. Apart from time complexity, its space complexity is also important: This is essentially the number of memory cells which an algorithm needs. A good algorithm keeps this number as small as possible, too. • There is often a time-space-tradeoff involved in a problem, that is, it cannot be solved with few computing time and low memory consumption. One then has to make a compromise and to exchange computing time for memory consumption or vice versa, depending on which algorithm one chooses and how one parameterizes it.
  • 68. Measuring Time Complexity • Time complexity • How long does this sorting program run? It possibly takes a very long time on large inputs (that is many strings) until the program has completed its work and gives a sign of life again. Sometimes it makes sense to be able to estimate the running time before starting a progr
  • 70. List of Questions to be practiced on PDA
  • 71. Some of the Solutions on PDA Problems
  • 72. Some of the Solutions on PDA Problems
  • 73. Some of the Solutions on PDA Problems
  • 74. Some of the Solutions on PDA Problems
  • 77. BEST OF LUCK IN YOUR ETE