SlideShare a Scribd company logo
Prof.Neeraj Bhargava
Abhishek Kumar
Department of Computer Science
School of Engineering & System Sciences,
MDS, University Ajmer, Rajasthan, India
ContextFree Grammars
What are Context Free
Grammars?
 In FormalLanguageTheory, aContext freeGrammar(CFG)
isaformalgrammar in whicheveryproduction rule isofthe
form
V w
Where Visasinglenonterminal symbolandwisastring of
terminals and/or nonterminals (w canbe empty)
The languagesgenerated bycontext free grammars are
knowsasthe context freelanguages
What does CFG
do?
 A CFGprovidesasimpleandmathematicallyprecise
mechanismfor describingthe methods bywhichphrasesin
somenatural languageare built from smallerblocks,
capturingthe “blockstructure” ofsentencesin anatural way.
Important features ofnatural languagesyntaxsuchas
agreement andreference isare not the part ofcontext free
grammar , but the basicrecursive structure ofsentences, the
wayin whichclausesnest inside other clauses,andthe wayin
whichlist ofadjectivesandadverbsare swallowed bynouns
andverbsisdescribed exactly.
Formal Definition of
CFG
A context-free grammar G is a 4-tuple (V, , R, S), where:
 Visafinite set; eachelement v Viscalledanon-terminalcharacterora
variable.
  isafinite set ofterminals,disjointfrom , whichmakeup the actual
content ofthe sentence.
 R is a finite relation from V to (V U )* , where the asterisk
represents the Kleene star operation.
If (,)  R, we write production   
 is called a sentential form
• S, the start symbol, usedto represent the wholesentence (or
program). It must be anelement of V.
Production rule notation
 A production rule in Risformalized mathematicallyasapair
(,) , where  isanon-terminal and isastring of
variablesandnonterminals; rather than usingordered pair
notation, production rules are usuallywritten usinganarrow
operator with  asits left handsideand asits right hand
side:   .
 I t isallowedfor  to be the empty string, andin this caseit is
customaryto denote it byε.Theform   εiscalled anε-
production.
Context-Free
Languages
•Given a context-free grammar
G = (V,,R, S), the language generated or derived from
G is the set
L(G) = {w :S * w}
A language L is context-free if there is a context-free
grammar G = (V,, R, S), such that L is generated from G.
Thank You

More Related Content

What's hot

20 hours reflection
20 hours reflection 20 hours reflection
20 hours reflection El Ǝme
 
Regular expressions and languages pdf
Regular expressions and languages pdfRegular expressions and languages pdf
Regular expressions and languages pdf
Dilouar Hossain
 
Context Free Grammar
Context Free GrammarContext Free Grammar
Context Free Grammar
Akhil Kaushik
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
Binsent Ribera
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
Chetan Mahawar
 
Complex predicate meghaditya
Complex predicate meghadityaComplex predicate meghaditya
Complex predicate meghaditya
Meghaditya Roy Chaudhury
 
Normal forms cfg
Normal forms   cfgNormal forms   cfg
Normal forms cfg
Rajendran
 
Types of Language in Theory of Computation
Types of Language in Theory of ComputationTypes of Language in Theory of Computation
Types of Language in Theory of Computation
Ankur Singh
 
Hw6 interpreter iterator GoF
Hw6 interpreter iterator GoFHw6 interpreter iterator GoF
Hw6 interpreter iterator GoF
Edison Lascano
 
ANOTHER PROOF OF THE DENUMERABILITY OF THE COMPLEX NUMBERS
ANOTHER PROOF OF THE DENUMERABILITY OF THE COMPLEX NUMBERSANOTHER PROOF OF THE DENUMERABILITY OF THE COMPLEX NUMBERS
ANOTHER PROOF OF THE DENUMERABILITY OF THE COMPLEX NUMBERS
csandit
 
CONVERTING A SUBSET OF LTL FORMULA TO BUCHI AUTOMATA
CONVERTING A SUBSET OF LTL FORMULA TO BUCHI AUTOMATACONVERTING A SUBSET OF LTL FORMULA TO BUCHI AUTOMATA
CONVERTING A SUBSET OF LTL FORMULA TO BUCHI AUTOMATA
mathsjournal
 
Converting A Subset of LTL Formula to Buchi Automata
Converting A Subset of LTL Formula to Buchi Automata Converting A Subset of LTL Formula to Buchi Automata
Converting A Subset of LTL Formula to Buchi Automata
ijseajournal
 
PL Lecture 02 - Binding and Scope
PL Lecture 02 - Binding and ScopePL Lecture 02 - Binding and Scope
PL Lecture 02 - Binding and Scope
Schwannden Kuo
 
Syntax and semantics of propositional logic
Syntax and semantics of propositional logicSyntax and semantics of propositional logic
Syntax and semantics of propositional logic
Janet Stemwedel
 
Lecture: Context-Free Grammars
Lecture: Context-Free GrammarsLecture: Context-Free Grammars
Lecture: Context-Free Grammars
Marina Santini
 
Variables and expressions
Variables and expressionsVariables and expressions
Variables and expressions
ayyomarvin
 
PL Lecture 01 - preliminaries
PL Lecture 01 - preliminariesPL Lecture 01 - preliminaries
PL Lecture 01 - preliminaries
Schwannden Kuo
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
FellowBuddy.com
 

What's hot (19)

20 hours reflection
20 hours reflection 20 hours reflection
20 hours reflection
 
Regular expressions and languages pdf
Regular expressions and languages pdfRegular expressions and languages pdf
Regular expressions and languages pdf
 
Context Free Grammar
Context Free GrammarContext Free Grammar
Context Free Grammar
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Complex predicate meghaditya
Complex predicate meghadityaComplex predicate meghaditya
Complex predicate meghaditya
 
Normal forms cfg
Normal forms   cfgNormal forms   cfg
Normal forms cfg
 
Types of Language in Theory of Computation
Types of Language in Theory of ComputationTypes of Language in Theory of Computation
Types of Language in Theory of Computation
 
Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)
 
Hw6 interpreter iterator GoF
Hw6 interpreter iterator GoFHw6 interpreter iterator GoF
Hw6 interpreter iterator GoF
 
ANOTHER PROOF OF THE DENUMERABILITY OF THE COMPLEX NUMBERS
ANOTHER PROOF OF THE DENUMERABILITY OF THE COMPLEX NUMBERSANOTHER PROOF OF THE DENUMERABILITY OF THE COMPLEX NUMBERS
ANOTHER PROOF OF THE DENUMERABILITY OF THE COMPLEX NUMBERS
 
CONVERTING A SUBSET OF LTL FORMULA TO BUCHI AUTOMATA
CONVERTING A SUBSET OF LTL FORMULA TO BUCHI AUTOMATACONVERTING A SUBSET OF LTL FORMULA TO BUCHI AUTOMATA
CONVERTING A SUBSET OF LTL FORMULA TO BUCHI AUTOMATA
 
Converting A Subset of LTL Formula to Buchi Automata
Converting A Subset of LTL Formula to Buchi Automata Converting A Subset of LTL Formula to Buchi Automata
Converting A Subset of LTL Formula to Buchi Automata
 
PL Lecture 02 - Binding and Scope
PL Lecture 02 - Binding and ScopePL Lecture 02 - Binding and Scope
PL Lecture 02 - Binding and Scope
 
Syntax and semantics of propositional logic
Syntax and semantics of propositional logicSyntax and semantics of propositional logic
Syntax and semantics of propositional logic
 
Lecture: Context-Free Grammars
Lecture: Context-Free GrammarsLecture: Context-Free Grammars
Lecture: Context-Free Grammars
 
Variables and expressions
Variables and expressionsVariables and expressions
Variables and expressions
 
PL Lecture 01 - preliminaries
PL Lecture 01 - preliminariesPL Lecture 01 - preliminaries
PL Lecture 01 - preliminaries
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
 

Similar to Context free grammars

contextfreegrammars-120925004035-phpapp02.pdf
contextfreegrammars-120925004035-phpapp02.pdfcontextfreegrammars-120925004035-phpapp02.pdf
contextfreegrammars-120925004035-phpapp02.pdf
ry54321288
 
COMPILER DESIGN LECTURES -UNIT-2 ST.pptx
COMPILER DESIGN LECTURES -UNIT-2 ST.pptxCOMPILER DESIGN LECTURES -UNIT-2 ST.pptx
COMPILER DESIGN LECTURES -UNIT-2 ST.pptx
Ranjeet Reddy
 
Ay34306312
Ay34306312Ay34306312
Ay34306312
IJERA Editor
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
Akshaya Arunan
 
Implementation Of Syntax Parser For English Language Using Grammar Rules
Implementation Of Syntax Parser For English Language Using Grammar RulesImplementation Of Syntax Parser For English Language Using Grammar Rules
Implementation Of Syntax Parser For English Language Using Grammar Rules
IJERA Editor
 
Computational model language and grammar bnf
Computational model language and grammar bnfComputational model language and grammar bnf
Computational model language and grammar bnf
Taha Shakeel
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
MAHASREEM
 
Unit-1 PPL PPTvvhvmmmmmmmmmmmmmmmmmmmmmm
Unit-1 PPL PPTvvhvmmmmmmmmmmmmmmmmmmmmmmUnit-1 PPL PPTvvhvmmmmmmmmmmmmmmmmmmmmmm
Unit-1 PPL PPTvvhvmmmmmmmmmmmmmmmmmmmmmm
DhruvKushwaha12
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
Binsent Ribera
 
Syntax analysis
Syntax analysisSyntax analysis
6. describing syntax and semantics
6. describing syntax and semantics6. describing syntax and semantics
6. describing syntax and semantics
Zambales National High School
 
match the following attributes to the parts of a compilerstrips ou.pdf
match the following attributes to the parts of a compilerstrips ou.pdfmatch the following attributes to the parts of a compilerstrips ou.pdf
match the following attributes to the parts of a compilerstrips ou.pdf
arpitaeron555
 
Chapter Three(1)
Chapter Three(1)Chapter Three(1)
Chapter Three(1)bolovv
 
Chapter-3 compiler.pptx course materials
Chapter-3 compiler.pptx course materialsChapter-3 compiler.pptx course materials
Chapter-3 compiler.pptx course materials
gadisaAdamu
 
compiler design course focus of chapter 3 and 4 part
compiler design course focus of chapter 3 and 4 partcompiler design course focus of chapter 3 and 4 part
compiler design course focus of chapter 3 and 4 part
abel185080
 
CH 2.pptx
CH 2.pptxCH 2.pptx
CH 2.pptx
Obsa2
 
Module 11
Module 11Module 11
Module 11
bittudavis
 
Lfg and gpsg
Lfg and gpsgLfg and gpsg
Lfg and gpsg
SubramanianMuthusamy3
 
LFG and GPSG.pptx
LFG and GPSG.pptxLFG and GPSG.pptx
LFG and GPSG.pptx
Subramanian Mani
 
PARSING ARABIC VERB PHRASES USING PREGROUP GRAMMARS
PARSING ARABIC VERB PHRASES USING PREGROUP GRAMMARSPARSING ARABIC VERB PHRASES USING PREGROUP GRAMMARS
PARSING ARABIC VERB PHRASES USING PREGROUP GRAMMARS
ijnlc
 

Similar to Context free grammars (20)

contextfreegrammars-120925004035-phpapp02.pdf
contextfreegrammars-120925004035-phpapp02.pdfcontextfreegrammars-120925004035-phpapp02.pdf
contextfreegrammars-120925004035-phpapp02.pdf
 
COMPILER DESIGN LECTURES -UNIT-2 ST.pptx
COMPILER DESIGN LECTURES -UNIT-2 ST.pptxCOMPILER DESIGN LECTURES -UNIT-2 ST.pptx
COMPILER DESIGN LECTURES -UNIT-2 ST.pptx
 
Ay34306312
Ay34306312Ay34306312
Ay34306312
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Implementation Of Syntax Parser For English Language Using Grammar Rules
Implementation Of Syntax Parser For English Language Using Grammar RulesImplementation Of Syntax Parser For English Language Using Grammar Rules
Implementation Of Syntax Parser For English Language Using Grammar Rules
 
Computational model language and grammar bnf
Computational model language and grammar bnfComputational model language and grammar bnf
Computational model language and grammar bnf
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
 
Unit-1 PPL PPTvvhvmmmmmmmmmmmmmmmmmmmmmm
Unit-1 PPL PPTvvhvmmmmmmmmmmmmmmmmmmmmmmUnit-1 PPL PPTvvhvmmmmmmmmmmmmmmmmmmmmmm
Unit-1 PPL PPTvvhvmmmmmmmmmmmmmmmmmmmmmm
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
6. describing syntax and semantics
6. describing syntax and semantics6. describing syntax and semantics
6. describing syntax and semantics
 
match the following attributes to the parts of a compilerstrips ou.pdf
match the following attributes to the parts of a compilerstrips ou.pdfmatch the following attributes to the parts of a compilerstrips ou.pdf
match the following attributes to the parts of a compilerstrips ou.pdf
 
Chapter Three(1)
Chapter Three(1)Chapter Three(1)
Chapter Three(1)
 
Chapter-3 compiler.pptx course materials
Chapter-3 compiler.pptx course materialsChapter-3 compiler.pptx course materials
Chapter-3 compiler.pptx course materials
 
compiler design course focus of chapter 3 and 4 part
compiler design course focus of chapter 3 and 4 partcompiler design course focus of chapter 3 and 4 part
compiler design course focus of chapter 3 and 4 part
 
CH 2.pptx
CH 2.pptxCH 2.pptx
CH 2.pptx
 
Module 11
Module 11Module 11
Module 11
 
Lfg and gpsg
Lfg and gpsgLfg and gpsg
Lfg and gpsg
 
LFG and GPSG.pptx
LFG and GPSG.pptxLFG and GPSG.pptx
LFG and GPSG.pptx
 
PARSING ARABIC VERB PHRASES USING PREGROUP GRAMMARS
PARSING ARABIC VERB PHRASES USING PREGROUP GRAMMARSPARSING ARABIC VERB PHRASES USING PREGROUP GRAMMARS
PARSING ARABIC VERB PHRASES USING PREGROUP GRAMMARS
 

More from Dr. ABHISHEK K PANDEY

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

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

ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 

Recently uploaded (20)

ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 

Context free grammars

  • 1. Prof.Neeraj Bhargava Abhishek Kumar Department of Computer Science School of Engineering & System Sciences, MDS, University Ajmer, Rajasthan, India ContextFree Grammars
  • 2. What are Context Free Grammars?  In FormalLanguageTheory, aContext freeGrammar(CFG) isaformalgrammar in whicheveryproduction rule isofthe form V w Where Visasinglenonterminal symbolandwisastring of terminals and/or nonterminals (w canbe empty) The languagesgenerated bycontext free grammars are knowsasthe context freelanguages
  • 3. What does CFG do?  A CFGprovidesasimpleandmathematicallyprecise mechanismfor describingthe methods bywhichphrasesin somenatural languageare built from smallerblocks, capturingthe “blockstructure” ofsentencesin anatural way. Important features ofnatural languagesyntaxsuchas agreement andreference isare not the part ofcontext free grammar , but the basicrecursive structure ofsentences, the wayin whichclausesnest inside other clauses,andthe wayin whichlist ofadjectivesandadverbsare swallowed bynouns andverbsisdescribed exactly.
  • 4. Formal Definition of CFG A context-free grammar G is a 4-tuple (V, , R, S), where:  Visafinite set; eachelement v Viscalledanon-terminalcharacterora variable.   isafinite set ofterminals,disjointfrom , whichmakeup the actual content ofthe sentence.  R is a finite relation from V to (V U )* , where the asterisk represents the Kleene star operation. If (,)  R, we write production     is called a sentential form • S, the start symbol, usedto represent the wholesentence (or program). It must be anelement of V.
  • 5. Production rule notation  A production rule in Risformalized mathematicallyasapair (,) , where  isanon-terminal and isastring of variablesandnonterminals; rather than usingordered pair notation, production rules are usuallywritten usinganarrow operator with  asits left handsideand asits right hand side:   .  I t isallowedfor  to be the empty string, andin this caseit is customaryto denote it byε.Theform   εiscalled anε- production.
  • 6. Context-Free Languages •Given a context-free grammar G = (V,,R, S), the language generated or derived from G is the set L(G) = {w :S * w} A language L is context-free if there is a context-free grammar G = (V,, R, S), such that L is generated from G.