SlideShare a Scribd company logo
4
Most read
5
Most read
REMOVING AMBIGUITY
FROM CFG
1
Group Members:
1. Muradul Islam Jamil (152-35-1203)
2. Mahadi Hasan Joy (152-35-1207)
3. Mazed Mourshed (152-35-1215)
Md. Anwar Hossen
Lecturer, Dept. of Software Engineering
Daffodil International University
2
AMBIGUITY IN CFG
If a context free grammar has more than one derivation tree
for some string, it is called an ambiguous grammar. There
exist multiple right-most or left-most derivations for some
string generated from
that grammar.
3
PROBLEM
Check whether the grammar G with production rules −
S → AB | aaB
A → a | Aa
B → b
4
SOLUTION
Let’s find out the derivation tree for the string “aab". It has two leftmost deriv
i) S → aaB → aab
ii) S → AB →AaB → aaB → aab
5
ANOTHER PROBLEM
Check whether the grammar G with
production rules −
S → S + S | S * S | a
6
SOLUTION
Let’s find out the derivation tree for the string “a+a+a". It has two leftmost d
i) S → S + S → S + S + S → a + a + S → a + a + a
ii) S → S + S → S + S + S → S + a + a → a + a + a
7
SOLUTION
Let’s find out the derivation tree for the string “a+a*a". It has two leftmost de
i) S → S + S → a + S → a + S * S → a + a * a
ii) S → S * S → S + S * S → a + a * S → a + a * a
8
THANK
YOU
9

More Related Content

What's hot (20)

PPT
predicate logic example
SHUBHAM KUMAR GUPTA
 
PPTX
1.7. eqivalence of nfa and dfa
Sampath Kumar S
 
PPT
Lecture 3,4
shah zeb
 
PPTX
Context free grammar
Ratnakar Mikkili
 
PDF
Floyd warshall algorithm
A. S. M. Shafi
 
PPSX
Fuzzy expert system
Hsuvas Borkakoty
 
PPTX
Dijkstra's Algorithm
Rashik Ishrak Nahian
 
PPTX
Regular Expression
valuebound
 
PPTX
Simplification of cfg ppt
Shiela Rani
 
PDF
Gradient descent method
Sanghyuk Chun
 
PPTX
Turing machine by_deep
Deepjyoti Kalita
 
PPT
Goal stack planning.ppt
SadagopanS
 
PPT
Turing Machine
Rajendran
 
PPTX
Clipping
AMIT VIRAMGAMI
 
PPTX
Theory of Automata and formal languages Unit 3
Abhimanyu Mishra
 
PPTX
Introduction to MATLAB
Ravikiran A
 
PPTX
Theory of automata and formal language
Rabia Khalid
 
PPTX
Push down automata
Ratnakar Mikkili
 
PPTX
Load runner & win runner
Himanshu
 
PPT
Chomsky Hierarchy.ppt
AayushSingh233965
 
predicate logic example
SHUBHAM KUMAR GUPTA
 
1.7. eqivalence of nfa and dfa
Sampath Kumar S
 
Lecture 3,4
shah zeb
 
Context free grammar
Ratnakar Mikkili
 
Floyd warshall algorithm
A. S. M. Shafi
 
Fuzzy expert system
Hsuvas Borkakoty
 
Dijkstra's Algorithm
Rashik Ishrak Nahian
 
Regular Expression
valuebound
 
Simplification of cfg ppt
Shiela Rani
 
Gradient descent method
Sanghyuk Chun
 
Turing machine by_deep
Deepjyoti Kalita
 
Goal stack planning.ppt
SadagopanS
 
Turing Machine
Rajendran
 
Clipping
AMIT VIRAMGAMI
 
Theory of Automata and formal languages Unit 3
Abhimanyu Mishra
 
Introduction to MATLAB
Ravikiran A
 
Theory of automata and formal language
Rabia Khalid
 
Push down automata
Ratnakar Mikkili
 
Load runner & win runner
Himanshu
 
Chomsky Hierarchy.ppt
AayushSingh233965
 

More from Ashik Khan (12)

PDF
Online food project
Ashik Khan
 
PDF
Assignment 01
Ashik Khan
 
PPTX
Set associative mapping
Ashik Khan
 
PDF
Travel management system in html 1
Ashik Khan
 
PDF
Dhakavehiclesystem 170417113343.pdf abid
Ashik Khan
 
PDF
Final project of vehicle system.pdf this is it
Ashik Khan
 
DOCX
Final project of vehicle system
Ashik Khan
 
PPTX
Push down automata
Ashik Khan
 
PPTX
Turing machine
Ashik Khan
 
DOCX
vehicle management system project report
Ashik Khan
 
PPTX
vehicle management system project
Ashik Khan
 
DOCX
Srs of dhaka vehicle system
Ashik Khan
 
Online food project
Ashik Khan
 
Assignment 01
Ashik Khan
 
Set associative mapping
Ashik Khan
 
Travel management system in html 1
Ashik Khan
 
Dhakavehiclesystem 170417113343.pdf abid
Ashik Khan
 
Final project of vehicle system.pdf this is it
Ashik Khan
 
Final project of vehicle system
Ashik Khan
 
Push down automata
Ashik Khan
 
Turing machine
Ashik Khan
 
vehicle management system project report
Ashik Khan
 
vehicle management system project
Ashik Khan
 
Srs of dhaka vehicle system
Ashik Khan
 
Ad

Recently uploaded (20)

PDF
Construction of a Thermal Vacuum Chamber for Environment Test of Triple CubeS...
2208441
 
PDF
Natural_Language_processing_Unit_I_notes.pdf
sanguleumeshit
 
PPTX
Information Retrieval and Extraction - Module 7
premSankar19
 
PDF
Zero carbon Building Design Guidelines V4
BassemOsman1
 
PDF
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
PDF
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 
PDF
Jual GPS Geodetik CHCNAV i93 IMU-RTK Lanjutan dengan Survei Visual
Budi Minds
 
DOCX
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
PDF
勉強会資料_An Image is Worth More Than 16x16 Patches
NABLAS株式会社
 
PPTX
Basics of Auto Computer Aided Drafting .pptx
Krunal Thanki
 
PPTX
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
PDF
Zero Carbon Building Performance standard
BassemOsman1
 
PDF
4 Tier Teamcenter Installation part1.pdf
VnyKumar1
 
PDF
All chapters of Strength of materials.ppt
girmabiniyam1234
 
PPTX
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
PDF
CAD-CAM U-1 Combined Notes_57761226_2025_04_22_14_40.pdf
shailendrapratap2002
 
PDF
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
Mohanumar S
 
PDF
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
PDF
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
PPTX
filteration _ pre.pptx 11111110001.pptx
awasthivaibhav825
 
Construction of a Thermal Vacuum Chamber for Environment Test of Triple CubeS...
2208441
 
Natural_Language_processing_Unit_I_notes.pdf
sanguleumeshit
 
Information Retrieval and Extraction - Module 7
premSankar19
 
Zero carbon Building Design Guidelines V4
BassemOsman1
 
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 
Jual GPS Geodetik CHCNAV i93 IMU-RTK Lanjutan dengan Survei Visual
Budi Minds
 
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
勉強会資料_An Image is Worth More Than 16x16 Patches
NABLAS株式会社
 
Basics of Auto Computer Aided Drafting .pptx
Krunal Thanki
 
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
Zero Carbon Building Performance standard
BassemOsman1
 
4 Tier Teamcenter Installation part1.pdf
VnyKumar1
 
All chapters of Strength of materials.ppt
girmabiniyam1234
 
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
CAD-CAM U-1 Combined Notes_57761226_2025_04_22_14_40.pdf
shailendrapratap2002
 
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
Mohanumar S
 
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
filteration _ pre.pptx 11111110001.pptx
awasthivaibhav825
 
Ad

Removing ambiguity-from-cfg

  • 2. Group Members: 1. Muradul Islam Jamil (152-35-1203) 2. Mahadi Hasan Joy (152-35-1207) 3. Mazed Mourshed (152-35-1215) Md. Anwar Hossen Lecturer, Dept. of Software Engineering Daffodil International University 2
  • 3. AMBIGUITY IN CFG If a context free grammar has more than one derivation tree for some string, it is called an ambiguous grammar. There exist multiple right-most or left-most derivations for some string generated from that grammar. 3
  • 4. PROBLEM Check whether the grammar G with production rules − S → AB | aaB A → a | Aa B → b 4
  • 5. SOLUTION Let’s find out the derivation tree for the string “aab". It has two leftmost deriv i) S → aaB → aab ii) S → AB →AaB → aaB → aab 5
  • 6. ANOTHER PROBLEM Check whether the grammar G with production rules − S → S + S | S * S | a 6
  • 7. SOLUTION Let’s find out the derivation tree for the string “a+a+a". It has two leftmost d i) S → S + S → S + S + S → a + a + S → a + a + a ii) S → S + S → S + S + S → S + a + a → a + a + a 7
  • 8. SOLUTION Let’s find out the derivation tree for the string “a+a*a". It has two leftmost de i) S → S + S → a + S → a + S * S → a + a * a ii) S → S * S → S + S * S → a + a * S → a + a * a 8