SlideShare a Scribd company logo
Convert PDA to CFG
• Given a PDA M = (Q, €, F, 6, qO, ZO, {}), we construct a CFG G = (V,
€, P, S)
– V = {[q, A, p] | q, p are in Q, A is in F+{S}}
– P is a set of productions constructed as follows:
• S c [qO, ZO, q] for all q in Q
• for each (p, s) in 6(q, a, A), where a is in € + {s}, we define
production:
[q, A, p] c a € + {s} and B are
in
• for each (p, B1B2…Bm) in 6(q, a, A), where a is
in
F [q, A, qm+1] -> a [q1, B1, q2] [q2, B2, q3] …[qm, Bm, qm+1]
for all q, q1, q2, …, qm+1 in Q
Deterministic PDA’s
• A PDA is deterministic if there is at most one move for any
input symbol, any top stack symbol, and at any state.
• A no move or move without advancing input string are
possible in a deterministic PDA.
• A move without advancing input string implies that no
other move exists.
• The pushdown automaton for wcwR is deterministic.
Deterministic PDA’s
• The set of languages accepted by deterministic PDD’s is
only a subset of the languages accepted by
nondeterministic PDA’s.
• A regular language is language accepted by a DPDA.
• Not all languages accepted by DPAD are regular.
• All languages accepted by DPAD have an unambiguous
CFG.
• Not all unambiguous languages are accepted by DPAD.
Grammatical Format
• Eliminate useless symbols
– derivable from S
– can derive a string of terminals
• Eliminate s-productions
– A -> s is an s-production.
• Eliminate unit productions
– A -> B is a unit production if both A and B are variables.
• For any CFG G and s is not in L(G), there exists
an equivalent context -free grammar with no
useless symbol, s-production, and unit production.
Eliminating Useless Symbols
• Given a CFG G = (V, T, P, S), withL(G ) is not empty, we
can effectively find an equivalent CFG G’ = (V’, T, P’, S)
such that for each A in V’ there is some w in T* for which
A=>*w.
• Given a CFG G = (V, T, P, S), we can effectively find an
equivalent CFG G’ = (V’, T’, P’, S) such that for each X in
(V’+T’) there exist a and þ in (V’+T’)* for which
S =>* aXþ.
Eliminatingssss-productions
• If s is not in L(G), we can eliminate all s-productions.
• A variable is nullable if A =>* s.
• For A -> X1X2…Xn, add the following productions A ->
Y1Y2…Yn
– If Xi is not nullable, then Yi = Xi.
– If Xi is nullable, then Yi = Xi or Yi = s.
– If Xi is nullable for (i = 1, …, n), don’t add A => s.
Eliminating Unit Productions
• If A=>*B and for all nonunit production B->X, add
– A->X
• Eliminate all unit productions.
Eliminating Useless Symbols and sss
and Unit Productions
1. Eliminate s-productions
2. Eliminate unit productions
3. Eliminate useless symbols.
Chomsky Normal Form (CNF)
• If aCFG has only productions of the form, it is called
Chomsky Normal Form (CNF)
– A -> BC, or
– A -> a
where A, B, and C are variables and a is a terminal.
• Any context-free language with e can be generated by a
context-free grammar in which all productions are in CNF.
Chomsky Normal Form (CNF)
• If aCFG has only productions of the form, it is called
Chomsky Normal Form (CNF)
– A -> BC, or
– A -> a
where A, B, and C are variables and a is a terminal.
• Any context-free language with e can be generated by a
context-free grammar in which all productions are in CNF.

More Related Content

What's hot

Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOC
AbhayDhupar
 
push down automata
push down automatapush down automata
push down automata
Christopher Chizoba
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
Muhammad Amjad Rana
 
Code generation in Compiler Design
Code generation in Compiler DesignCode generation in Compiler Design
Code generation in Compiler Design
Kuppusamy P
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
Shiraz316
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler design
Kuppusamy P
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
Akhil Kaushik
 
Three Address code
Three Address code Three Address code
Three Address code
Pooja Dixit
 
P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-Hard
Animesh Chaturvedi
 
Pushdown Automata Theory
Pushdown Automata TheoryPushdown Automata Theory
Pushdown Automata Theory
Saifur Rahman
 
First and follow set
First and follow setFirst and follow set
First and follow set
Dawood Faheem Abbasi
 
Simplification of cfg ppt
Simplification of cfg pptSimplification of cfg ppt
Simplification of cfg ppt
Shiela Rani
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
Vineeta Garg
 
Context free grammar
Context free grammar Context free grammar
Context free grammar
Mohammad Ilyas Malik
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
ASHOK KUMAR REDDY
 
Turing machine-TOC
Turing machine-TOCTuring machine-TOC
Turing machine-TOC
Maulik Togadiya
 
Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)   Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)
Tasif Tanzim
 
Unit iv(simple code generator)
Unit iv(simple code generator)Unit iv(simple code generator)
Unit iv(simple code generator)
Kalaimathi Vijayakumar
 
Webinar : P, NP, NP-Hard , NP - Complete problems
Webinar : P, NP, NP-Hard , NP - Complete problems Webinar : P, NP, NP-Hard , NP - Complete problems
Webinar : P, NP, NP-Hard , NP - Complete problems
Ziyauddin Shaik
 
COMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time EnvironmentsCOMPILER DESIGN Run-Time Environments

What's hot (20)

Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOC
 
push down automata
push down automatapush down automata
push down automata
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Code generation in Compiler Design
Code generation in Compiler DesignCode generation in Compiler Design
Code generation in Compiler Design
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler design
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Three Address code
Three Address code Three Address code
Three Address code
 
P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-Hard
 
Pushdown Automata Theory
Pushdown Automata TheoryPushdown Automata Theory
Pushdown Automata Theory
 
First and follow set
First and follow setFirst and follow set
First and follow set
 
Simplification of cfg ppt
Simplification of cfg pptSimplification of cfg ppt
Simplification of cfg ppt
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Context free grammar
Context free grammar Context free grammar
Context free grammar
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
 
Turing machine-TOC
Turing machine-TOCTuring machine-TOC
Turing machine-TOC
 
Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)   Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)
 
Unit iv(simple code generator)
Unit iv(simple code generator)Unit iv(simple code generator)
Unit iv(simple code generator)
 
Webinar : P, NP, NP-Hard , NP - Complete problems
Webinar : P, NP, NP-Hard , NP - Complete problems Webinar : P, NP, NP-Hard , NP - Complete problems
Webinar : P, NP, NP-Hard , NP - Complete problems
 
COMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time EnvironmentsCOMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time Environments
 

Viewers also liked

Finite automata intro
Finite automata introFinite automata intro
Finite automata introlavishka_anuj
 
Kleene's theorem
Kleene's theoremKleene's theorem
Kleene's theorem
Samita Mukesh
 
L3 cfg
L3 cfgL3 cfg
Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7
Dr. Maamoun Ahmed
 
Payroll Management System
Payroll Management SystemPayroll Management System
Payroll Management System
Dheeraj Jha
 
Data Flow Diagram
Data Flow DiagramData Flow Diagram
Data Flow Diagram
Puneet Arora
 
Payroll Management System SRS
Payroll Management System SRSPayroll Management System SRS
Payroll Management System SRS
Shubham Modi
 
Dfd and flowchart
Dfd and flowchartDfd and flowchart
Dfd and flowchartMir Majid
 
Example of dfd with answer
Example of dfd with answerExample of dfd with answer
Example of dfd with answerMahmoud Bakeer
 
Data flow diagrams (2)
Data flow diagrams (2)Data flow diagrams (2)
Data flow diagrams (2)Ujjwal 'Shanu'
 
Data flow diagram
Data flow diagram Data flow diagram
Data flow diagram Nidhi Sharma
 
Dfd examples
Dfd examplesDfd examples
Dfd examplesMohit
 

Viewers also liked (14)

Cs419 lec7 cfg
Cs419 lec7   cfgCs419 lec7   cfg
Cs419 lec7 cfg
 
Finite automata intro
Finite automata introFinite automata intro
Finite automata intro
 
Kleene's theorem
Kleene's theoremKleene's theorem
Kleene's theorem
 
L3 cfg
L3 cfgL3 cfg
L3 cfg
 
Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7
 
Payroll Management System
Payroll Management SystemPayroll Management System
Payroll Management System
 
Data Flow Diagram
Data Flow DiagramData Flow Diagram
Data Flow Diagram
 
Payroll Management System SRS
Payroll Management System SRSPayroll Management System SRS
Payroll Management System SRS
 
Dfd final
Dfd finalDfd final
Dfd final
 
Dfd and flowchart
Dfd and flowchartDfd and flowchart
Dfd and flowchart
 
Example of dfd with answer
Example of dfd with answerExample of dfd with answer
Example of dfd with answer
 
Data flow diagrams (2)
Data flow diagrams (2)Data flow diagrams (2)
Data flow diagrams (2)
 
Data flow diagram
Data flow diagram Data flow diagram
Data flow diagram
 
Dfd examples
Dfd examplesDfd examples
Dfd examples
 

Similar to Pda to cfg h2

Formal Languages and Automata Theory unit 3
Formal Languages and Automata Theory unit 3Formal Languages and Automata Theory unit 3
Formal Languages and Automata Theory unit 3
Srimatre K
 
Presentation (2).pptx
Presentation (2).pptxPresentation (2).pptx
Presentation (2).pptx
AkhilJoseph63
 
Context Free Languages by S.Mandal-1.ppt
Context Free Languages by S.Mandal-1.pptContext Free Languages by S.Mandal-1.ppt
Context Free Languages by S.Mandal-1.ppt
1sonalishipu
 
Context free grammar
Context free grammarContext free grammar
Context free grammar
Ratnakar Mikkili
 
Automata theory - CFG and normal forms
Automata theory - CFG and normal formsAutomata theory - CFG and normal forms
Automata theory - CFG and normal forms
Akila Krishnamoorthy
 
ContextFreeGrammars.pptx
ContextFreeGrammars.pptxContextFreeGrammars.pptx
ContextFreeGrammars.pptx
PEzhumalai
 
ContextFreeGrammars (1).pptx
ContextFreeGrammars (1).pptxContextFreeGrammars (1).pptx
ContextFreeGrammars (1).pptx
viswanath kani
 
Pushdown automata
Pushdown automataPushdown automata
Pushdown automata
eugenesri
 
Pushdown automata
Pushdown automataPushdown automata
Pushdown automata
parmeet834
 
PushdownAutomata.ppt
PushdownAutomata.pptPushdownAutomata.ppt
PushdownAutomata.ppt
RSRS39
 
Pda
PdaPda
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping LemmaTheory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
Rushabh2428
 
Lec1.pptx
Lec1.pptxLec1.pptx
Lec1.pptx
ziadk6872
 
2. context free langauages
2. context free langauages2. context free langauages
2. context free langauagesdanhumble
 
Conversion of CFG to CNF.pptx
Conversion of CFG to CNF.pptxConversion of CFG to CNF.pptx
Conversion of CFG to CNF.pptx
Rishikesh990460
 
Cs6503 theory of computation november december 2015 be cse anna university q...
Cs6503 theory of computation november december 2015  be cse anna university q...Cs6503 theory of computation november december 2015  be cse anna university q...
Cs6503 theory of computation november december 2015 be cse anna university q...
appasami
 
Unicode Cjk Compatible Variations
Unicode Cjk Compatible VariationsUnicode Cjk Compatible Variations
Unicode Cjk Compatible VariationsJoe Jiang
 
Ch03
Ch03Ch03
Ch03
Hankyo
 

Similar to Pda to cfg h2 (19)

Formal Languages and Automata Theory unit 3
Formal Languages and Automata Theory unit 3Formal Languages and Automata Theory unit 3
Formal Languages and Automata Theory unit 3
 
Presentation (2).pptx
Presentation (2).pptxPresentation (2).pptx
Presentation (2).pptx
 
Context Free Languages by S.Mandal-1.ppt
Context Free Languages by S.Mandal-1.pptContext Free Languages by S.Mandal-1.ppt
Context Free Languages by S.Mandal-1.ppt
 
Context free grammar
Context free grammarContext free grammar
Context free grammar
 
Ch4a
Ch4aCh4a
Ch4a
 
Automata theory - CFG and normal forms
Automata theory - CFG and normal formsAutomata theory - CFG and normal forms
Automata theory - CFG and normal forms
 
ContextFreeGrammars.pptx
ContextFreeGrammars.pptxContextFreeGrammars.pptx
ContextFreeGrammars.pptx
 
ContextFreeGrammars (1).pptx
ContextFreeGrammars (1).pptxContextFreeGrammars (1).pptx
ContextFreeGrammars (1).pptx
 
Pushdown automata
Pushdown automataPushdown automata
Pushdown automata
 
Pushdown automata
Pushdown automataPushdown automata
Pushdown automata
 
PushdownAutomata.ppt
PushdownAutomata.pptPushdownAutomata.ppt
PushdownAutomata.ppt
 
Pda
PdaPda
Pda
 
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping LemmaTheory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
 
Lec1.pptx
Lec1.pptxLec1.pptx
Lec1.pptx
 
2. context free langauages
2. context free langauages2. context free langauages
2. context free langauages
 
Conversion of CFG to CNF.pptx
Conversion of CFG to CNF.pptxConversion of CFG to CNF.pptx
Conversion of CFG to CNF.pptx
 
Cs6503 theory of computation november december 2015 be cse anna university q...
Cs6503 theory of computation november december 2015  be cse anna university q...Cs6503 theory of computation november december 2015  be cse anna university q...
Cs6503 theory of computation november december 2015 be cse anna university q...
 
Unicode Cjk Compatible Variations
Unicode Cjk Compatible VariationsUnicode Cjk Compatible Variations
Unicode Cjk Compatible Variations
 
Ch03
Ch03Ch03
Ch03
 

More from Rajendran

Element distinctness lower bounds
Element distinctness lower boundsElement distinctness lower bounds
Element distinctness lower bounds
Rajendran
 
Scheduling with Startup and Holding Costs
Scheduling with Startup and Holding CostsScheduling with Startup and Holding Costs
Scheduling with Startup and Holding Costs
Rajendran
 
Divide and conquer surfing lower bounds
Divide and conquer  surfing lower boundsDivide and conquer  surfing lower bounds
Divide and conquer surfing lower bounds
Rajendran
 
Red black tree
Red black treeRed black tree
Red black tree
Rajendran
 
Hash table
Hash tableHash table
Hash table
Rajendran
 
Medians and order statistics
Medians and order statisticsMedians and order statistics
Medians and order statistics
Rajendran
 
Proof master theorem
Proof master theoremProof master theorem
Proof master theorem
Rajendran
 
Recursion tree method
Recursion tree methodRecursion tree method
Recursion tree method
Rajendran
 
Recurrence theorem
Recurrence theoremRecurrence theorem
Recurrence theorem
Rajendran
 
Master method
Master method Master method
Master method
Rajendran
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
Rajendran
 
Hash tables
Hash tablesHash tables
Hash tables
Rajendran
 
Lower bound
Lower boundLower bound
Lower bound
Rajendran
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
Rajendran
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
Rajendran
 
Longest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm AnalysisLongest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm Analysis
Rajendran
 
Dynamic programming in Algorithm Analysis
Dynamic programming in Algorithm AnalysisDynamic programming in Algorithm Analysis
Dynamic programming in Algorithm Analysis
Rajendran
 
Average case Analysis of Quicksort
Average case Analysis of QuicksortAverage case Analysis of Quicksort
Average case Analysis of Quicksort
Rajendran
 
Np completeness
Np completenessNp completeness
Np completeness
Rajendran
 
computer languages
computer languagescomputer languages
computer languages
Rajendran
 

More from Rajendran (20)

Element distinctness lower bounds
Element distinctness lower boundsElement distinctness lower bounds
Element distinctness lower bounds
 
Scheduling with Startup and Holding Costs
Scheduling with Startup and Holding CostsScheduling with Startup and Holding Costs
Scheduling with Startup and Holding Costs
 
Divide and conquer surfing lower bounds
Divide and conquer  surfing lower boundsDivide and conquer  surfing lower bounds
Divide and conquer surfing lower bounds
 
Red black tree
Red black treeRed black tree
Red black tree
 
Hash table
Hash tableHash table
Hash table
 
Medians and order statistics
Medians and order statisticsMedians and order statistics
Medians and order statistics
 
Proof master theorem
Proof master theoremProof master theorem
Proof master theorem
 
Recursion tree method
Recursion tree methodRecursion tree method
Recursion tree method
 
Recurrence theorem
Recurrence theoremRecurrence theorem
Recurrence theorem
 
Master method
Master method Master method
Master method
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
 
Hash tables
Hash tablesHash tables
Hash tables
 
Lower bound
Lower boundLower bound
Lower bound
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
Longest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm AnalysisLongest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm Analysis
 
Dynamic programming in Algorithm Analysis
Dynamic programming in Algorithm AnalysisDynamic programming in Algorithm Analysis
Dynamic programming in Algorithm Analysis
 
Average case Analysis of Quicksort
Average case Analysis of QuicksortAverage case Analysis of Quicksort
Average case Analysis of Quicksort
 
Np completeness
Np completenessNp completeness
Np completeness
 
computer languages
computer languagescomputer languages
computer languages
 

Recently uploaded

Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 

Recently uploaded (20)

Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 

Pda to cfg h2

  • 1. Convert PDA to CFG • Given a PDA M = (Q, €, F, 6, qO, ZO, {}), we construct a CFG G = (V, €, P, S) – V = {[q, A, p] | q, p are in Q, A is in F+{S}} – P is a set of productions constructed as follows: • S c [qO, ZO, q] for all q in Q • for each (p, s) in 6(q, a, A), where a is in € + {s}, we define production: [q, A, p] c a € + {s} and B are in • for each (p, B1B2…Bm) in 6(q, a, A), where a is in F [q, A, qm+1] -> a [q1, B1, q2] [q2, B2, q3] …[qm, Bm, qm+1] for all q, q1, q2, …, qm+1 in Q
  • 2. Deterministic PDA’s • A PDA is deterministic if there is at most one move for any input symbol, any top stack symbol, and at any state. • A no move or move without advancing input string are possible in a deterministic PDA. • A move without advancing input string implies that no other move exists. • The pushdown automaton for wcwR is deterministic.
  • 3. Deterministic PDA’s • The set of languages accepted by deterministic PDD’s is only a subset of the languages accepted by nondeterministic PDA’s. • A regular language is language accepted by a DPDA. • Not all languages accepted by DPAD are regular. • All languages accepted by DPAD have an unambiguous CFG. • Not all unambiguous languages are accepted by DPAD.
  • 4. Grammatical Format • Eliminate useless symbols – derivable from S – can derive a string of terminals • Eliminate s-productions – A -> s is an s-production. • Eliminate unit productions – A -> B is a unit production if both A and B are variables. • For any CFG G and s is not in L(G), there exists an equivalent context -free grammar with no useless symbol, s-production, and unit production.
  • 5. Eliminating Useless Symbols • Given a CFG G = (V, T, P, S), withL(G ) is not empty, we can effectively find an equivalent CFG G’ = (V’, T, P’, S) such that for each A in V’ there is some w in T* for which A=>*w. • Given a CFG G = (V, T, P, S), we can effectively find an equivalent CFG G’ = (V’, T’, P’, S) such that for each X in (V’+T’) there exist a and þ in (V’+T’)* for which S =>* aXþ.
  • 6. Eliminatingssss-productions • If s is not in L(G), we can eliminate all s-productions. • A variable is nullable if A =>* s. • For A -> X1X2…Xn, add the following productions A -> Y1Y2…Yn – If Xi is not nullable, then Yi = Xi. – If Xi is nullable, then Yi = Xi or Yi = s. – If Xi is nullable for (i = 1, …, n), don’t add A => s.
  • 7. Eliminating Unit Productions • If A=>*B and for all nonunit production B->X, add – A->X • Eliminate all unit productions.
  • 8. Eliminating Useless Symbols and sss and Unit Productions 1. Eliminate s-productions 2. Eliminate unit productions 3. Eliminate useless symbols.
  • 9. Chomsky Normal Form (CNF) • If aCFG has only productions of the form, it is called Chomsky Normal Form (CNF) – A -> BC, or – A -> a where A, B, and C are variables and a is a terminal. • Any context-free language with e can be generated by a context-free grammar in which all productions are in CNF.
  • 10. Chomsky Normal Form (CNF) • If aCFG has only productions of the form, it is called Chomsky Normal Form (CNF) – A -> BC, or – A -> a where A, B, and C are variables and a is a terminal. • Any context-free language with e can be generated by a context-free grammar in which all productions are in CNF.