SlideShare a Scribd company logo
Prof.Neeraj Bhargava
Abhishek Kumar
Department of Computer Science
School of Engineering & System Sciences,
MDS, University Ajmer, Rajasthan, India
1
 A grammar express languages with the help of
four tuples:-
(Vn , ∑ , R , S)
• V is a finite set of variables/non-terminals
• Σ is a finite set of terminals
• S ∈ V is the start symbol
• R ⊆ (Σ∪V )∗×(Σ∪V )∗ is a finite set of
rules/productions.
We say γ1 α γ2 ⇒G γ1 β γ2 ,
iff (α → β) ∈ R. And L(G) = {w ∈ Σ∗|S ∗ ⇒G w}
2
Grammar Rules Languages
 Type 3 A → aB or A → a Regular
 Type 2 A → α Context
Free
 Type 1 α → β with |α|≤|β Context
Sensitive
 Type 0 α → β
Recursively
Enumerable
 Figure 2: In the above table, α,β ∈ (Σ∪V )∗,
A,B ∈ V and a ∈ Σ∪{}
3
 Example 2. Consider the grammar G with Σ = {a} with
S → $Ca# | a | ∈ Ca → aaC
$D → $C C# → D# | E a
D → Da aE → Ea
$E → ∈
The following are derivations in this grammar
S ⇒ $Ca# ⇒ $aaC# ⇒ $aaE ⇒ $aEa ⇒ $Eaa ⇒ aa
S ⇒ $Ca# ⇒ $aaC# ⇒ $aaD# ⇒ $aDa# ⇒ $Daa#
⇒ $Caa# ⇒ $aaCa# ⇒ $aaaaC# ⇒ $aaaaE
⇒ $aaaEa ⇒ $aaEaa ⇒ $aEaaa ⇒ $Eaaaa ⇒ aaaa
L(G) = {ai |i is a power of 2}
4
 Example 8. Consider the grammar G with Σ =
{a,b,c}, V = {S,B,C,H} and
S → aSBC | aBC CB → HB
HB → HC HC → BC
aB → ab bB → bb
bC → bc cC → cc
L(G) = {anbncn |n ≥ 0}
5
6

More Related Content

What's hot

Aug 27th
Aug 27thAug 27th
Aug 27th
cirilah
 
Chapter1.5
Chapter1.5Chapter1.5
Chapter1.5
nglaze10
 
Rearranging formulas A1
Rearranging formulas A1Rearranging formulas A1
Rearranging formulas A1
vhiggins1
 
Unit rate from convenience store
Unit rate from convenience storeUnit rate from convenience store
Unit rate from convenience store
foreverun
 

What's hot (17)

Mathematical skills II - Rearranging Equations
Mathematical skills II -  Rearranging EquationsMathematical skills II -  Rearranging Equations
Mathematical skills II - Rearranging Equations
 
Sets
SetsSets
Sets
 
2.3 notes
2.3 notes2.3 notes
2.3 notes
 
The principle of inclusion and exclusion for three sets by sharvari
The principle of inclusion and exclusion for three sets by sharvariThe principle of inclusion and exclusion for three sets by sharvari
The principle of inclusion and exclusion for three sets by sharvari
 
Principal of inclusion & exclusion for two sets by vishal maher
Principal of inclusion & exclusion for two sets by vishal maherPrincipal of inclusion & exclusion for two sets by vishal maher
Principal of inclusion & exclusion for two sets by vishal maher
 
Mat 222 week 5 composition and inverse (ash)
Mat 222 week 5 composition and inverse (ash)Mat 222 week 5 composition and inverse (ash)
Mat 222 week 5 composition and inverse (ash)
 
Aug 27th
Aug 27thAug 27th
Aug 27th
 
Chapter1.5
Chapter1.5Chapter1.5
Chapter1.5
 
Algerba in everyday Life
Algerba in everyday LifeAlgerba in everyday Life
Algerba in everyday Life
 
Himpunan plpg
Himpunan plpgHimpunan plpg
Himpunan plpg
 
02 more on sets
02   more on sets02   more on sets
02 more on sets
 
Discrete mathematics presentation
Discrete mathematics presentationDiscrete mathematics presentation
Discrete mathematics presentation
 
7.7 Transforming Formulas
7.7 Transforming Formulas7.7 Transforming Formulas
7.7 Transforming Formulas
 
Maths designed in interactive way examples
Maths designed in interactive way examplesMaths designed in interactive way examples
Maths designed in interactive way examples
 
Rearranging formulas A1
Rearranging formulas A1Rearranging formulas A1
Rearranging formulas A1
 
Unit rate from convenience store
Unit rate from convenience storeUnit rate from convenience store
Unit rate from convenience store
 
Number System & Set Theory
Number System & Set TheoryNumber System & Set Theory
Number System & Set Theory
 

Similar to Grammar generated by language iii

Testing Forest-Isomorphism in the Adjacency List Model
Testing Forest-Isomorphismin the Adjacency List ModelTesting Forest-Isomorphismin the Adjacency List Model
Testing Forest-Isomorphism in the Adjacency List Model
irrrrr
 
Final maths presentation on sets
Final maths presentation on setsFinal maths presentation on sets
Final maths presentation on sets
Rahul Avicii
 
Introduction to set theory
Introduction to set theoryIntroduction to set theory
Introduction to set theory
Nittaya Noinan
 

Similar to Grammar generated by language iii (20)

4898850.ppt
4898850.ppt4898850.ppt
4898850.ppt
 
IIT JAM Math 2022 Question Paper | Sourav Sir's Classes
IIT JAM Math 2022 Question Paper | Sourav Sir's ClassesIIT JAM Math 2022 Question Paper | Sourav Sir's Classes
IIT JAM Math 2022 Question Paper | Sourav Sir's Classes
 
set theory --.pptx
set theory --.pptxset theory --.pptx
set theory --.pptx
 
Toc chapter 1 srg
Toc chapter 1 srgToc chapter 1 srg
Toc chapter 1 srg
 
Unit 1 Set Theory-Engineering Mathematics.pptx
Unit 1 Set Theory-Engineering Mathematics.pptxUnit 1 Set Theory-Engineering Mathematics.pptx
Unit 1 Set Theory-Engineering Mathematics.pptx
 
maths 12th.pdf
maths 12th.pdfmaths 12th.pdf
maths 12th.pdf
 
A Szemeredi-type theorem for subsets of the unit cube
A Szemeredi-type theorem for subsets of the unit cubeA Szemeredi-type theorem for subsets of the unit cube
A Szemeredi-type theorem for subsets of the unit cube
 
2 homework
2 homework2 homework
2 homework
 
Edicoes asa 12 ano 2020-21 - 3 teste
Edicoes asa   12 ano 2020-21 - 3 testeEdicoes asa   12 ano 2020-21 - 3 teste
Edicoes asa 12 ano 2020-21 - 3 teste
 
Testing Forest-Isomorphism in the Adjacency List Model
Testing Forest-Isomorphismin the Adjacency List ModelTesting Forest-Isomorphismin the Adjacency List Model
Testing Forest-Isomorphism in the Adjacency List Model
 
Final maths presentation on sets
Final maths presentation on setsFinal maths presentation on sets
Final maths presentation on sets
 
SETS - Vedantu.pdf
SETS - Vedantu.pdfSETS - Vedantu.pdf
SETS - Vedantu.pdf
 
Lesson2_MathematicalLanguageAndSymbols _Lesson 2.1_VariablesAndTheLanguageOfS...
Lesson2_MathematicalLanguageAndSymbols _Lesson 2.1_VariablesAndTheLanguageOfS...Lesson2_MathematicalLanguageAndSymbols _Lesson 2.1_VariablesAndTheLanguageOfS...
Lesson2_MathematicalLanguageAndSymbols _Lesson 2.1_VariablesAndTheLanguageOfS...
 
P2-Chp3-SequencesAndSeries from pure maths 2.pptx
P2-Chp3-SequencesAndSeries from pure maths 2.pptxP2-Chp3-SequencesAndSeries from pure maths 2.pptx
P2-Chp3-SequencesAndSeries from pure maths 2.pptx
 
Math.pptx
Math.pptxMath.pptx
Math.pptx
 
DISCRETE LOGARITHM PROBLEM
DISCRETE LOGARITHM PROBLEMDISCRETE LOGARITHM PROBLEM
DISCRETE LOGARITHM PROBLEM
 
Cs6660 compiler design november december 2016 Answer key
Cs6660 compiler design november december 2016 Answer keyCs6660 compiler design november december 2016 Answer key
Cs6660 compiler design november december 2016 Answer key
 
Mathematics JEE quick revision notes pdf
Mathematics JEE quick revision notes pdfMathematics JEE quick revision notes pdf
Mathematics JEE quick revision notes pdf
 
Introduction to set theory
Introduction to set theoryIntroduction to set theory
Introduction to set theory
 
SETS PPT-XI.pptx
SETS PPT-XI.pptxSETS PPT-XI.pptx
SETS PPT-XI.pptx
 

More from Dr. ABHISHEK K PANDEY

More from Dr. ABHISHEK K PANDEY (20)

Digital to digital
Digital to digitalDigital to digital
Digital to digital
 
Digital to analog
Digital to analog Digital to analog
Digital to analog
 
Analog to analog
Analog to analogAnalog to analog
Analog to analog
 
Wcdma interface sakshi
Wcdma interface sakshiWcdma interface sakshi
Wcdma interface sakshi
 
Utran architecture(rashmi)
Utran architecture(rashmi)Utran architecture(rashmi)
Utran architecture(rashmi)
 
Umts
UmtsUmts
Umts
 
Osi modal
Osi modalOsi modal
Osi modal
 
Network topologies(chetan)
Network topologies(chetan)Network topologies(chetan)
Network topologies(chetan)
 
Multiplexing II
Multiplexing IIMultiplexing II
Multiplexing II
 
Est umts speech cells
Est umts speech cellsEst umts speech cells
Est umts speech cells
 
Digital to analog piyush sen
Digital to analog piyush senDigital to analog piyush sen
Digital to analog piyush sen
 
Adc
AdcAdc
Adc
 
Reguler grammar cfg
Reguler grammar cfgReguler grammar cfg
Reguler grammar cfg
 
Regular languag regular set
Regular languag regular setRegular languag regular set
Regular languag regular set
 
Regular expression for dfa
Regular expression for dfaRegular expression for dfa
Regular expression for dfa
 
Pumping lemma
Pumping lemmaPumping lemma
Pumping lemma
 
Pumping lemma numerical
Pumping lemma numericalPumping lemma numerical
Pumping lemma numerical
 
Pumping lemma for cfg
Pumping lemma for cfgPumping lemma for cfg
Pumping lemma for cfg
 
Power of authomata
Power of authomataPower of authomata
Power of authomata
 
Pda1
Pda1Pda1
Pda1
 

Recently uploaded

Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
Kamal Acharya
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdf
Kamal Acharya
 

Recently uploaded (20)

Electrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission lineElectrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission line
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
Top 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering ScientistTop 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering Scientist
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdf
 
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdfONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
 
Pharmacy management system project report..pdf
Pharmacy management system project report..pdfPharmacy management system project report..pdf
Pharmacy management system project report..pdf
 
Arduino based vehicle speed tracker project
Arduino based vehicle speed tracker projectArduino based vehicle speed tracker project
Arduino based vehicle speed tracker project
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and VisualizationKIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltage
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
 
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdf
 

Grammar generated by language iii

  • 1. Prof.Neeraj Bhargava Abhishek Kumar Department of Computer Science School of Engineering & System Sciences, MDS, University Ajmer, Rajasthan, India 1
  • 2.  A grammar express languages with the help of four tuples:- (Vn , ∑ , R , S) • V is a finite set of variables/non-terminals • Σ is a finite set of terminals • S ∈ V is the start symbol • R ⊆ (Σ∪V )∗×(Σ∪V )∗ is a finite set of rules/productions. We say γ1 α γ2 ⇒G γ1 β γ2 , iff (α → β) ∈ R. And L(G) = {w ∈ Σ∗|S ∗ ⇒G w} 2
  • 3. Grammar Rules Languages  Type 3 A → aB or A → a Regular  Type 2 A → α Context Free  Type 1 α → β with |α|≤|β Context Sensitive  Type 0 α → β Recursively Enumerable  Figure 2: In the above table, α,β ∈ (Σ∪V )∗, A,B ∈ V and a ∈ Σ∪{} 3
  • 4.  Example 2. Consider the grammar G with Σ = {a} with S → $Ca# | a | ∈ Ca → aaC $D → $C C# → D# | E a D → Da aE → Ea $E → ∈ The following are derivations in this grammar S ⇒ $Ca# ⇒ $aaC# ⇒ $aaE ⇒ $aEa ⇒ $Eaa ⇒ aa S ⇒ $Ca# ⇒ $aaC# ⇒ $aaD# ⇒ $aDa# ⇒ $Daa# ⇒ $Caa# ⇒ $aaCa# ⇒ $aaaaC# ⇒ $aaaaE ⇒ $aaaEa ⇒ $aaEaa ⇒ $aEaaa ⇒ $Eaaaa ⇒ aaaa L(G) = {ai |i is a power of 2} 4
  • 5.  Example 8. Consider the grammar G with Σ = {a,b,c}, V = {S,B,C,H} and S → aSBC | aBC CB → HB HB → HC HC → BC aB → ab bB → bb bC → bc cC → cc L(G) = {anbncn |n ≥ 0} 5
  • 6. 6