SlideShare a Scribd company logo
1 of 6
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 example

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 example (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

Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 

Recently uploaded (20)

(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
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...
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
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...
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 

Grammar generated by language example

  • 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