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

PPTX
2.5 ambiguity in context free grammars
PPTX
2.3 context free grammars and languages
PPTX
2.4 derivations and languages
PPTX
SET AND ITS OPERATIONS
PPTX
I lustrating sets using venn diagram
PPSX
Set Language And Notation
PPTX
Identifying subsets of a set
PDF
Lesson 47
2.5 ambiguity in context free grammars
2.3 context free grammars and languages
2.4 derivations and languages
SET AND ITS OPERATIONS
I lustrating sets using venn diagram
Set Language And Notation
Identifying subsets of a set
Lesson 47

What's hot (16)

PPTX
Mathematical skills II - Rearranging Equations
PPT
2.3 notes
PPTX
The principle of inclusion and exclusion for three sets by sharvari
PPTX
Principal of inclusion & exclusion for two sets by vishal maher
DOC
Mat 222 week 5 composition and inverse (ash)
PPTX
Aug 27th
PPT
Chapter1.5
PPT
Algerba in everyday Life
PPTX
Himpunan plpg
PPT
02 more on sets
PPTX
Discrete mathematics presentation
PPT
7.7 Transforming Formulas
PPTX
Maths designed in interactive way examples
DOCX
Rearranging formulas A1
PPT
Unit rate from convenience store
PPTX
Number System & Set Theory
Mathematical skills II - Rearranging Equations
2.3 notes
The principle of inclusion and exclusion for three sets by sharvari
Principal of inclusion & exclusion for two sets by vishal maher
Mat 222 week 5 composition and inverse (ash)
Aug 27th
Chapter1.5
Algerba in everyday Life
Himpunan plpg
02 more on sets
Discrete mathematics presentation
7.7 Transforming Formulas
Maths designed in interactive way examples
Rearranging formulas A1
Unit rate from convenience store
Number System & Set Theory
Ad

Similar to Grammar generated by language (20)

PDF
Abstract Algebra Lecture for Mathematics major
PPTX
Materi minggu ke - 3 Himpunan. Untuk mah
PPT
4898850.ppt
PDF
IIT JAM Math 2022 Question Paper | Sourav Sir's Classes
PPTX
set theory --.pptx
PDF
Toc chapter 1 srg
PDF
unit-1.pdfSRM MATHS DISCREATE MATHS 2024
PDF
4db825a5-cdad-45d1-926a-4f25b9020cba.pdf
PPTX
Unit 1 Set Theory-Engineering Mathematics.pptx
PDF
maths 12th.pdf
PDF
A Szemeredi-type theorem for subsets of the unit cube
PDF
2 homework
PDF
Edicoes asa 12 ano 2020-21 - 3 teste
PDF
Testing Forest-Isomorphism in the Adjacency List Model
PPT
Final maths presentation on sets
PDF
SETS - Vedantu.pdf
PDF
Lesson2_MathematicalLanguageAndSymbols _Lesson 2.1_VariablesAndTheLanguageOfS...
PDF
Assignment No. 7 on Unit-IV - Set Theory, Relations and Function
PPTX
P2-Chp3-SequencesAndSeries from pure maths 2.pptx
PPTX
Abstract Algebra Lecture for Mathematics major
Materi minggu ke - 3 Himpunan. Untuk mah
4898850.ppt
IIT JAM Math 2022 Question Paper | Sourav Sir's Classes
set theory --.pptx
Toc chapter 1 srg
unit-1.pdfSRM MATHS DISCREATE MATHS 2024
4db825a5-cdad-45d1-926a-4f25b9020cba.pdf
Unit 1 Set Theory-Engineering Mathematics.pptx
maths 12th.pdf
A Szemeredi-type theorem for subsets of the unit cube
2 homework
Edicoes asa 12 ano 2020-21 - 3 teste
Testing Forest-Isomorphism in the Adjacency List Model
Final maths presentation on sets
SETS - Vedantu.pdf
Lesson2_MathematicalLanguageAndSymbols _Lesson 2.1_VariablesAndTheLanguageOfS...
Assignment No. 7 on Unit-IV - Set Theory, Relations and Function
P2-Chp3-SequencesAndSeries from pure maths 2.pptx
Ad

More from Dr. ABHISHEK K PANDEY (20)

PPTX
Digital to digital
PPTX
Digital to analog
PPTX
Analog to analog
PPTX
Wcdma interface sakshi
PPT
Utran architecture(rashmi)
PPTX
PPTX
Network topologies(chetan)
PPTX
Multiplexing II
PPTX
Est umts speech cells
PPTX
Digital to analog piyush sen
PPTX
Reguler grammar cfg
PPTX
Regular languag regular set
PPTX
Regular expression for dfa
PPTX
Pumping lemma
PPTX
Pumping lemma numerical
PPT
Pumping lemma for cfg
PPTX
Power of authomata
Digital to digital
Digital to analog
Analog to analog
Wcdma interface sakshi
Utran architecture(rashmi)
Network topologies(chetan)
Multiplexing II
Est umts speech cells
Digital to analog piyush sen
Reguler grammar cfg
Regular languag regular set
Regular expression for dfa
Pumping lemma
Pumping lemma numerical
Pumping lemma for cfg
Power of authomata

Recently uploaded (20)

PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
Analyzing Impact of Pakistan Economic Corridor on Import and Export in Pakist...
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PDF
86236642-Electric-Loco-Shed.pdf jfkduklg
PDF
PPT on Performance Review to get promotions
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PPTX
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PPTX
Artificial Intelligence
PPT
Total quality management ppt for engineering students
PPT
introduction to datamining and warehousing
PPTX
introduction to high performance computing
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Analyzing Impact of Pakistan Economic Corridor on Import and Export in Pakist...
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
86236642-Electric-Loco-Shed.pdf jfkduklg
PPT on Performance Review to get promotions
Fundamentals of safety and accident prevention -final (1).pptx
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
III.4.1.2_The_Space_Environment.p pdffdf
Artificial Intelligence
Total quality management ppt for engineering students
introduction to datamining and warehousing
introduction to high performance computing
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
Automation-in-Manufacturing-Chapter-Introduction.pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...

Grammar generated by language

  • 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