SlideShare a Scribd company logo
1 of 9
Equivalence of
Pushdown
automata and
CFL
-Sampath Kumar S,
AP/CSE, SECE
Equivalence of PDA and CFL
 If a grammar G is context-free, we can build an
equivalent nondeterministic PDA which accepts
the language that is produced by the context-free
grammar G. A parser can be built for the
grammar G.
 Also, if P is a pushdown automaton, an equivalent
context-free grammar G can be constructed where
L(G) = L(P)
21 November 2017
Sampath Kumar S, AP/CSE, SECE
2
Application:
 This equivalence allows a CFG to be used to
specify a programming language and the
equivalent PDA to be used to implement its
compiler.
21 November 2017
Sampath Kumar S, AP/CSE, SECE
3
Theorem
Theorem: A language is context-free iff some
pushdown automaton recognizes it.
Note:
This means that:
1. If a language L is context-free then there is a
PDA ML that recognizes it
2. If a language L is recognized by a PDA ML then
there is a CFG GL that generates L.
21 November 2017
Sampath Kumar S, AP/CSE, SECE
4
CFG to PDA Conversion:
 PDA accepts CFL
 CFL is generated by CFG
 If CFG is given to us then we can construct a PDA
which will accept the language generated by this
grammar.
 CFG G can be defied as G= (N, T, P, S) and M is
a PDA
 M accepts the language generated by G by empty
stack
21 November 2017
Sampath Kumar S, AP/CSE, SECE
5
CFG to PDA Conversion procedure:
 Input −A CFG, G= (V, T, P, S)
 Output −Equivalent PDA, M= (Q, ∑, S, δ, q0, I, F)
Step 1: Convert the productions of the CFG into GNF.
Step 2: The PDA will have only one state {q}.
Step 3: The start symbol of CFG will be the start symbol
in the PDA M.
Step 4: All non-terminals of the CFG will be the stack
symbols of the PDA and all the terminals of the CFG
will be the input symbols of the PDA.
Step 5: For each production A → aX where a is terminal
and A, X are combination of non-terminals, make a
transition δ (q, a, A) = (q, X)
21 November 2017
Sampath Kumar S, AP/CSE, SECE
6
Problem to discuss:
125. Construct a PDA from the following CFG.
G = ({S, X}, {a, b}, P, S) where the production P are −
S → aA2|aA3
A2 → aA2A3|aA3A3
A3 → b
Solution
Let the equivalent PDA,
P = ({q}, {a, b}, {a, b, S, A2, A3 }, δ, q,
S)
where δ −
δ(q, a, S) = {(q, A2), (q, A3)}
δ(q, a, A2) = {(q, A2A3),(q, A3 A3)}
δ(q, b, A3) = {(q, ε )}
21 November 2017
Sampath Kumar S, AP/CSE, SECE
7
21 November 2017
Sampath Kumar S, AP/CSE, SECE
14
நன்றி
21 November 2017
Sampath Kumar S, AP/CSE, SECE
15

More Related Content

What's hot

0 1 knapsack using branch and bound
0 1 knapsack using branch and bound0 1 knapsack using branch and bound
0 1 knapsack using branch and boundAbhishek Singh
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMvikas dhakane
 
1.7. eqivalence of nfa and dfa
1.7. eqivalence of nfa and dfa1.7. eqivalence of nfa and dfa
1.7. eqivalence of nfa and dfaSampath Kumar S
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy methodhodcsencet
 
Chess board problem(divide and conquer)
Chess board problem(divide and conquer)Chess board problem(divide and conquer)
Chess board problem(divide and conquer)RASHIARORA8
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSGayathri Gaayu
 
Topological Sorting
Topological SortingTopological Sorting
Topological SortingShahDhruv21
 
2.8 normal forms gnf & problems
2.8 normal forms   gnf & problems2.8 normal forms   gnf & problems
2.8 normal forms gnf & problemsSampath Kumar S
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)swapnac12
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysisDattatray Gandhmal
 
object oriented methodologies
object oriented methodologiesobject oriented methodologies
object oriented methodologiesAmith Tiwari
 

What's hot (20)

0 1 knapsack using branch and bound
0 1 knapsack using branch and bound0 1 knapsack using branch and bound
0 1 knapsack using branch and bound
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHM
 
1.7. eqivalence of nfa and dfa
1.7. eqivalence of nfa and dfa1.7. eqivalence of nfa and dfa
1.7. eqivalence of nfa and dfa
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Automata theory
Automata theoryAutomata theory
Automata theory
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
N queen problem
N queen problemN queen problem
N queen problem
 
Np cooks theorem
Np cooks theoremNp cooks theorem
Np cooks theorem
 
Chess board problem(divide and conquer)
Chess board problem(divide and conquer)Chess board problem(divide and conquer)
Chess board problem(divide and conquer)
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 
Topological Sorting
Topological SortingTopological Sorting
Topological Sorting
 
2.8 normal forms gnf & problems
2.8 normal forms   gnf & problems2.8 normal forms   gnf & problems
2.8 normal forms gnf & problems
 
Sliding window protocol
Sliding window protocolSliding window protocol
Sliding window protocol
 
Backtracking
Backtracking  Backtracking
Backtracking
 
NFA to DFA
NFA to DFANFA to DFA
NFA to DFA
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
Huffman coding
Huffman coding Huffman coding
Huffman coding
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysis
 
object oriented methodologies
object oriented methodologiesobject oriented methodologies
object oriented methodologies
 
Graph coloring using backtracking
Graph coloring using backtrackingGraph coloring using backtracking
Graph coloring using backtracking
 

Similar to 3.5 equivalence of pushdown automata and cfl

Presentation (2).pptx
Presentation (2).pptxPresentation (2).pptx
Presentation (2).pptxAkhilJoseph63
 
Push down automata
Push down automataPush down automata
Push down automataSomya Bagai
 
On Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate ProgrammingOn Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate ProgrammingRoberto Casadei
 
3.1,2,3 pushdown automata definition, moves & id
3.1,2,3 pushdown automata   definition, moves & id3.1,2,3 pushdown automata   definition, moves & id
3.1,2,3 pushdown automata definition, moves & idSampath Kumar S
 
Pushdown AutomataChapter 12Recognizing Context-F.docx
Pushdown AutomataChapter 12Recognizing Context-F.docxPushdown AutomataChapter 12Recognizing Context-F.docx
Pushdown AutomataChapter 12Recognizing Context-F.docxwoodruffeloisa
 
Integrative Parallel Programming in HPC
Integrative Parallel Programming in HPCIntegrative Parallel Programming in HPC
Integrative Parallel Programming in HPCVictor Eijkhout
 

Similar to 3.5 equivalence of pushdown automata and cfl (10)

Presentation (2).pptx
Presentation (2).pptxPresentation (2).pptx
Presentation (2).pptx
 
Push down automata
Push down automataPush down automata
Push down automata
 
7068458.ppt
7068458.ppt7068458.ppt
7068458.ppt
 
On Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate ProgrammingOn Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate Programming
 
UNIT III.docx
UNIT III.docxUNIT III.docx
UNIT III.docx
 
3.1,2,3 pushdown automata definition, moves & id
3.1,2,3 pushdown automata   definition, moves & id3.1,2,3 pushdown automata   definition, moves & id
3.1,2,3 pushdown automata definition, moves & id
 
Pushdown AutomataChapter 12Recognizing Context-F.docx
Pushdown AutomataChapter 12Recognizing Context-F.docxPushdown AutomataChapter 12Recognizing Context-F.docx
Pushdown AutomataChapter 12Recognizing Context-F.docx
 
Pda to cfg h2
Pda to cfg h2Pda to cfg h2
Pda to cfg h2
 
Integrative Parallel Programming in HPC
Integrative Parallel Programming in HPCIntegrative Parallel Programming in HPC
Integrative Parallel Programming in HPC
 
Gantt PERT and CPM
Gantt PERT and CPMGantt PERT and CPM
Gantt PERT and CPM
 

More from Sampath Kumar S

5.2 primitive recursive functions
5.2 primitive recursive functions5.2 primitive recursive functions
5.2 primitive recursive functionsSampath Kumar S
 
4.7. chomskian hierarchy of languages
4.7. chomskian hierarchy of languages4.7. chomskian hierarchy of languages
4.7. chomskian hierarchy of languagesSampath Kumar S
 
4.3 techniques for turing machines construction
4.3 techniques for turing machines construction4.3 techniques for turing machines construction
4.3 techniques for turing machines constructionSampath Kumar S
 
4.2 variantsof turing machines (types of tm)
4.2 variantsof turing machines (types of tm)4.2 variantsof turing machines (types of tm)
4.2 variantsof turing machines (types of tm)Sampath Kumar S
 
3.6 & 7. pumping lemma for cfl & problems based on pl
3.6 & 7. pumping lemma for cfl & problems based on pl3.6 & 7. pumping lemma for cfl & problems based on pl
3.6 & 7. pumping lemma for cfl & problems based on plSampath Kumar S
 
2.7 normal forms cnf & problems
2.7 normal forms  cnf & problems2.7 normal forms  cnf & problems
2.7 normal forms cnf & problemsSampath Kumar S
 
2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammars2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammarsSampath Kumar S
 
2.4 derivations and languages
2.4 derivations and languages2.4 derivations and languages
2.4 derivations and languagesSampath Kumar S
 
2.3 context free grammars and languages
2.3 context free grammars and languages2.3 context free grammars and languages
2.3 context free grammars and languagesSampath Kumar S
 
2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammarSampath Kumar S
 
1.9. minimization of dfa
1.9. minimization of dfa1.9. minimization of dfa
1.9. minimization of dfaSampath Kumar S
 
1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressionsSampath Kumar S
 
1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expression1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expressionSampath Kumar S
 
1.4. finite automaton with ε moves
1.4. finite automaton with ε   moves1.4. finite automaton with ε   moves
1.4. finite automaton with ε movesSampath Kumar S
 
1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automatonSampath Kumar S
 
1.3.1 deterministic finite automaton
1.3.1 deterministic finite automaton1.3.1 deterministic finite automaton
1.3.1 deterministic finite automatonSampath Kumar S
 
1.2. introduction to automata theory
1.2. introduction to automata theory1.2. introduction to automata theory
1.2. introduction to automata theorySampath Kumar S
 

More from Sampath Kumar S (20)

5.2 primitive recursive functions
5.2 primitive recursive functions5.2 primitive recursive functions
5.2 primitive recursive functions
 
4.7. chomskian hierarchy of languages
4.7. chomskian hierarchy of languages4.7. chomskian hierarchy of languages
4.7. chomskian hierarchy of languages
 
4.6 halting problem
4.6 halting problem4.6 halting problem
4.6 halting problem
 
4.3 techniques for turing machines construction
4.3 techniques for turing machines construction4.3 techniques for turing machines construction
4.3 techniques for turing machines construction
 
4.2 variantsof turing machines (types of tm)
4.2 variantsof turing machines (types of tm)4.2 variantsof turing machines (types of tm)
4.2 variantsof turing machines (types of tm)
 
4.1 turing machines
4.1 turing machines4.1 turing machines
4.1 turing machines
 
3.6 & 7. pumping lemma for cfl & problems based on pl
3.6 & 7. pumping lemma for cfl & problems based on pl3.6 & 7. pumping lemma for cfl & problems based on pl
3.6 & 7. pumping lemma for cfl & problems based on pl
 
3.4 deterministic pda
3.4 deterministic pda3.4 deterministic pda
3.4 deterministic pda
 
2.7 normal forms cnf & problems
2.7 normal forms  cnf & problems2.7 normal forms  cnf & problems
2.7 normal forms cnf & problems
 
2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammars2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammars
 
2.4 derivations and languages
2.4 derivations and languages2.4 derivations and languages
2.4 derivations and languages
 
2.3 context free grammars and languages
2.3 context free grammars and languages2.3 context free grammars and languages
2.3 context free grammars and languages
 
2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar
 
1.9. minimization of dfa
1.9. minimization of dfa1.9. minimization of dfa
1.9. minimization of dfa
 
1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions
 
1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expression1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expression
 
1.4. finite automaton with ε moves
1.4. finite automaton with ε   moves1.4. finite automaton with ε   moves
1.4. finite automaton with ε moves
 
1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton
 
1.3.1 deterministic finite automaton
1.3.1 deterministic finite automaton1.3.1 deterministic finite automaton
1.3.1 deterministic finite automaton
 
1.2. introduction to automata theory
1.2. introduction to automata theory1.2. introduction to automata theory
1.2. introduction to automata theory
 

Recently uploaded

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 

Recently uploaded (20)

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 

3.5 equivalence of pushdown automata and cfl

  • 2. Equivalence of PDA and CFL  If a grammar G is context-free, we can build an equivalent nondeterministic PDA which accepts the language that is produced by the context-free grammar G. A parser can be built for the grammar G.  Also, if P is a pushdown automaton, an equivalent context-free grammar G can be constructed where L(G) = L(P) 21 November 2017 Sampath Kumar S, AP/CSE, SECE 2
  • 3. Application:  This equivalence allows a CFG to be used to specify a programming language and the equivalent PDA to be used to implement its compiler. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 3
  • 4. Theorem Theorem: A language is context-free iff some pushdown automaton recognizes it. Note: This means that: 1. If a language L is context-free then there is a PDA ML that recognizes it 2. If a language L is recognized by a PDA ML then there is a CFG GL that generates L. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 4
  • 5. CFG to PDA Conversion:  PDA accepts CFL  CFL is generated by CFG  If CFG is given to us then we can construct a PDA which will accept the language generated by this grammar.  CFG G can be defied as G= (N, T, P, S) and M is a PDA  M accepts the language generated by G by empty stack 21 November 2017 Sampath Kumar S, AP/CSE, SECE 5
  • 6. CFG to PDA Conversion procedure:  Input −A CFG, G= (V, T, P, S)  Output −Equivalent PDA, M= (Q, ∑, S, δ, q0, I, F) Step 1: Convert the productions of the CFG into GNF. Step 2: The PDA will have only one state {q}. Step 3: The start symbol of CFG will be the start symbol in the PDA M. Step 4: All non-terminals of the CFG will be the stack symbols of the PDA and all the terminals of the CFG will be the input symbols of the PDA. Step 5: For each production A → aX where a is terminal and A, X are combination of non-terminals, make a transition δ (q, a, A) = (q, X) 21 November 2017 Sampath Kumar S, AP/CSE, SECE 6
  • 7. Problem to discuss: 125. Construct a PDA from the following CFG. G = ({S, X}, {a, b}, P, S) where the production P are − S → aA2|aA3 A2 → aA2A3|aA3A3 A3 → b Solution Let the equivalent PDA, P = ({q}, {a, b}, {a, b, S, A2, A3 }, δ, q, S) where δ − δ(q, a, S) = {(q, A2), (q, A3)} δ(q, a, A2) = {(q, A2A3),(q, A3 A3)} δ(q, b, A3) = {(q, ε )} 21 November 2017 Sampath Kumar S, AP/CSE, SECE 7
  • 8. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 14
  • 9. நன்றி 21 November 2017 Sampath Kumar S, AP/CSE, SECE 15

Editor's Notes

  1. School of EECS, WSU