SlideShare a Scribd company logo
ITM
Gwalior
1
INSTITUTE OF TECHNOLOGY AND MANAGEMENT
TOPIC: TYPES OF GRAMMAR
CS-501(A):Theory of computation
Presented to- Presented by-
Dr . Deepak Gupta Abhay Dhupar 0905CS191001
Associate Professor Abhay Singh 0905CS191002
(Dept. of CSE) Abhinav Goyal 0905CS191003
Abhinav Gupta 0905CS191004
GRAMMARS
• Noam Chomsky gave a mathematical model of grammar.
This model is used to write computer languages effectively.
• Grammar in theory of computation is a finite set of formal
rules that are generating syntactically correct sentences.
• The formal definition of grammar is that it is defined as four
tuples
ITM
Gwalior
2
CONT.
 G=(V,T,P,S)
 G is a grammar, which consists of a set of production rules. It is used to generate
the strings of a language.
 T is the final set of terminal symbols. It is denoted by lower case letters.
 V is the final set of non-terminal symbols. It is denoted by capital letters.
 P is a set of production rules, which is used for replacing non-terminal symbols
(on the left side of production) in a string with other terminals (on the right side
of production).
 S is the start symbol used to derive the string.
ITM
Gwalior
3
CONT.
• V = { S , A , B } => Non-Terminal symbols
• T = { a , b } => Terminal symbols
• P = { S → ABa , A → Ba , B → ab} => Production rules
• S = { S } => Start symbol
ITM
Gwalior
4
ITM
Gwalior
5
ITM
Gwalior
6
DIFFERENT TYPES OF GRAMMAR
Grammar can be divided on basis of –
 Type of Production Rules
 Number of Derivation Trees
 Number of Strings
ITM
Gwalior
7
CONT.
ITM
Gwalior
8
TYPES OF GRAMMAR
Grammar language Automata Production
Rules
Type 0 Recursively
enumerable
Turning machine No restriction
Type 1 Context-
sensitive
Linear-bounded Non-
deterministic machine
αAβ → αγβ
Type 2 Context-free Non-deterministic push down
Automata
A→γ
Type 3 Regular Finite Automata data A→αB
A→α
ITM
Gwalior
9
CONT.
ITM
Gwalior
10
TYPE 0
ITM
Gwalior
11
Type 0 grammar language are recognized by turing machine.
Grammar Production in the form of
where
α is ( V + T)* V ( V + T)*
β is ( V + T )*.
In type 0 there must be at least one variable on Left side of production.
Ex -
Sab –> ba
A –> S.
TYPE 1
Type-1 grammars generate the context-sensitive languages.
The language generated by the grammar are recognized by the Linear
Bound Automata
In Type 1,
I. First of all Type 1 grammar should be Type 0.
II. Grammar Production in the form of
|α | <= | β |
i.e count of symbol in α is less than or equal to
Ex S –> AB
AB –> abc
B –> b
ITM
Gwalior
12
TYPE 2
Type-2 grammars generate the context-free languages. The language
generated by the grammar is recognized by a Pushdown automata.
In Type 2,
1. First of all it should be Type 1.
2. Left hand side of production can have only one variable.
|α| = 1.
Their is no restriction on β .
Ex -
S –> AB
A –> a
B –> b
ITM
Gwalior
13
TYPE 3
Type-3 grammars generate regular languages. These languages are
exactly all languages that can be accepted by a finite state automaton.
Type 3 is most restricted form of grammar.
It should be in the given form only :
V –> VT / T (left-regular grammar)
(or)
V –> TV /T (right-regular grammar)
Ex -
S –> a
ITM
Gwalior
14
APPLICATION OF GRAMMAR
• For defining programming languages
• For parsing the program by constructing syntax tree
• For translation of programming languages
• For describing arithmetic expressions
• For construction of compilers, etc.
ITM
Gwalior
15
THANK YOU
ITM
Gwalior
16

More Related Content

What's hot

Intro automata theory
Intro automata theory Intro automata theory
Intro automata theory
Rajendran
 
Recognition-of-tokens
Recognition-of-tokensRecognition-of-tokens
Recognition-of-tokens
Dattatray Gandhmal
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
Muhammed Afsal Villan
 
AUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESAUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTES
suthi
 
Finite automata
Finite automataFinite automata
Finite automata
Bipul Roy Bpl
 
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDAPush Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Ashish Duggal
 
Input-Buffering
Input-BufferingInput-Buffering
Input-Buffering
Dattatray Gandhmal
 
3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl
Sampath Kumar S
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
Dipankar Boruah
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler design
Kuppusamy P
 
Automata theory - CFG and normal forms
Automata theory - CFG and normal formsAutomata theory - CFG and normal forms
Automata theory - CFG and normal forms
Akila Krishnamoorthy
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
FellowBuddy.com
 
Problems, Problem spaces and Search
Problems, Problem spaces and SearchProblems, Problem spaces and Search
Problems, Problem spaces and Search
BMS Institute of Technology and Management
 
Lecture: Automata
Lecture: AutomataLecture: Automata
Lecture: Automata
Marina Santini
 
Code generation in Compiler Design
Code generation in Compiler DesignCode generation in Compiler Design
Code generation in Compiler Design
Kuppusamy P
 
Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1
Srimatre K
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
Mukesh Chinta
 
NFA & DFA
NFA & DFANFA & DFA
NFA & DFA
Akhil Kaushik
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
Mukesh Tekwani
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
Dr. C.V. Suresh Babu
 

What's hot (20)

Intro automata theory
Intro automata theory Intro automata theory
Intro automata theory
 
Recognition-of-tokens
Recognition-of-tokensRecognition-of-tokens
Recognition-of-tokens
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
AUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESAUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTES
 
Finite automata
Finite automataFinite automata
Finite automata
 
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDAPush Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
 
Input-Buffering
Input-BufferingInput-Buffering
Input-Buffering
 
3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler design
 
Automata theory - CFG and normal forms
Automata theory - CFG and normal formsAutomata theory - CFG and normal forms
Automata theory - CFG and normal forms
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
 
Problems, Problem spaces and Search
Problems, Problem spaces and SearchProblems, Problem spaces and Search
Problems, Problem spaces and Search
 
Lecture: Automata
Lecture: AutomataLecture: Automata
Lecture: Automata
 
Code generation in Compiler Design
Code generation in Compiler DesignCode generation in Compiler Design
Code generation in Compiler Design
 
Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
 
NFA & DFA
NFA & DFANFA & DFA
NFA & DFA
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 

Similar to Types of grammer - TOC

Syntax Analyzer.pdf
Syntax Analyzer.pdfSyntax Analyzer.pdf
Syntax Analyzer.pdf
kenilpatel65
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggg
adugnanegero
 
Theory of Computation Grammar Concepts and Problems
Theory of Computation Grammar Concepts and ProblemsTheory of Computation Grammar Concepts and Problems
Theory of Computation Grammar Concepts and Problems
Rushabh2428
 
International journal of compiling
International journal of compilingInternational journal of compiling
International journal of compiling
Andivann
 
International journal of compiling
International journal of compilingInternational journal of compiling
International journal of compiling
Mgcal D. Saul Magfield
 
Theory of automata and formal language lab manual
Theory of automata and formal language lab manualTheory of automata and formal language lab manual
Theory of automata and formal language lab manual
Nitesh Dubey
 
9781284077247_PPTx_CH01.pptx
9781284077247_PPTx_CH01.pptx9781284077247_PPTx_CH01.pptx
9781284077247_PPTx_CH01.pptx
mainakmail2585
 
Theory of computing
Theory of computingTheory of computing
Theory of computingRanjan Kumar
 
Normal-forms-for-Context-Free-Grammars.ppt
Normal-forms-for-Context-Free-Grammars.pptNormal-forms-for-Context-Free-Grammars.ppt
Normal-forms-for-Context-Free-Grammars.ppt
Karthik Rohan
 
Formal Languages and Automata Theory unit 4
Formal Languages and Automata Theory unit 4Formal Languages and Automata Theory unit 4
Formal Languages and Automata Theory unit 4
Srimatre K
 
Lexical
LexicalLexical
Lexical
baran19901990
 
Cfg part i
Cfg   part iCfg   part i
Cfg part i
Kashif Ali
 
TOC_Solutions-Adi.pdf
TOC_Solutions-Adi.pdfTOC_Solutions-Adi.pdf
TOC_Solutions-Adi.pdf
Prof. Dr. K. Adisesha
 
TOC Solutions-Adi.pdf
TOC Solutions-Adi.pdfTOC Solutions-Adi.pdf
TOC Solutions-Adi.pdf
AdiseshaK
 
TOC_Solutions-Adi.pdf
TOC_Solutions-Adi.pdfTOC_Solutions-Adi.pdf
TOC_Solutions-Adi.pdf
AdiseshaK
 
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHYFINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
nishimanglani
 
Flat unit 3
Flat unit 3Flat unit 3
Flat unit 3
VenkataRaoS1
 
Building blocks 2
Building blocks 2Building blocks 2
Building blocks 2
NAZIRGUJJAR
 
2-Chomsky hierarchy of languages.ppt
2-Chomsky hierarchy of languages.ppt2-Chomsky hierarchy of languages.ppt
2-Chomsky hierarchy of languages.ppt
shruti533256
 

Similar to Types of grammer - TOC (20)

Syntax Analyzer.pdf
Syntax Analyzer.pdfSyntax Analyzer.pdf
Syntax Analyzer.pdf
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggg
 
Theory of Computation Grammar Concepts and Problems
Theory of Computation Grammar Concepts and ProblemsTheory of Computation Grammar Concepts and Problems
Theory of Computation Grammar Concepts and Problems
 
International journal of compiling
International journal of compilingInternational journal of compiling
International journal of compiling
 
International journal of compiling
International journal of compilingInternational journal of compiling
International journal of compiling
 
Theory of automata and formal language lab manual
Theory of automata and formal language lab manualTheory of automata and formal language lab manual
Theory of automata and formal language lab manual
 
9781284077247_PPTx_CH01.pptx
9781284077247_PPTx_CH01.pptx9781284077247_PPTx_CH01.pptx
9781284077247_PPTx_CH01.pptx
 
Theory of computing
Theory of computingTheory of computing
Theory of computing
 
Normal-forms-for-Context-Free-Grammars.ppt
Normal-forms-for-Context-Free-Grammars.pptNormal-forms-for-Context-Free-Grammars.ppt
Normal-forms-for-Context-Free-Grammars.ppt
 
Formal Languages and Automata Theory unit 4
Formal Languages and Automata Theory unit 4Formal Languages and Automata Theory unit 4
Formal Languages and Automata Theory unit 4
 
Lexical
LexicalLexical
Lexical
 
Cfg part i
Cfg   part iCfg   part i
Cfg part i
 
TOC_Solutions-Adi.pdf
TOC_Solutions-Adi.pdfTOC_Solutions-Adi.pdf
TOC_Solutions-Adi.pdf
 
TOC Solutions-Adi.pdf
TOC Solutions-Adi.pdfTOC Solutions-Adi.pdf
TOC Solutions-Adi.pdf
 
TOC_Solutions-Adi.pdf
TOC_Solutions-Adi.pdfTOC_Solutions-Adi.pdf
TOC_Solutions-Adi.pdf
 
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHYFINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
 
Flat unit 3
Flat unit 3Flat unit 3
Flat unit 3
 
Building blocks 2
Building blocks 2Building blocks 2
Building blocks 2
 
2-Chomsky hierarchy of languages.ppt
2-Chomsky hierarchy of languages.ppt2-Chomsky hierarchy of languages.ppt
2-Chomsky hierarchy of languages.ppt
 
Ch4a
Ch4aCh4a
Ch4a
 

More from AbhayDhupar

JavaScript : A trending scripting language
JavaScript : A trending scripting languageJavaScript : A trending scripting language
JavaScript : A trending scripting language
AbhayDhupar
 
What is Data analytics and it's importance ?
What is Data analytics and it's importance ?What is Data analytics and it's importance ?
What is Data analytics and it's importance ?
AbhayDhupar
 
Internet & it's concepts
Internet & it's conceptsInternet & it's concepts
Internet & it's concepts
AbhayDhupar
 
Loops in Python
Loops in PythonLoops in Python
Loops in Python
AbhayDhupar
 
Successive Approximation ADC
Successive Approximation ADC Successive Approximation ADC
Successive Approximation ADC
AbhayDhupar
 
Food chain
Food chainFood chain
Food chain
AbhayDhupar
 
Edge computing
Edge computingEdge computing
Edge computing
AbhayDhupar
 
Sets and its types-
 Sets and its types- Sets and its types-
Sets and its types-
AbhayDhupar
 

More from AbhayDhupar (8)

JavaScript : A trending scripting language
JavaScript : A trending scripting languageJavaScript : A trending scripting language
JavaScript : A trending scripting language
 
What is Data analytics and it's importance ?
What is Data analytics and it's importance ?What is Data analytics and it's importance ?
What is Data analytics and it's importance ?
 
Internet & it's concepts
Internet & it's conceptsInternet & it's concepts
Internet & it's concepts
 
Loops in Python
Loops in PythonLoops in Python
Loops in Python
 
Successive Approximation ADC
Successive Approximation ADC Successive Approximation ADC
Successive Approximation ADC
 
Food chain
Food chainFood chain
Food chain
 
Edge computing
Edge computingEdge computing
Edge computing
 
Sets and its types-
 Sets and its types- Sets and its types-
Sets and its types-
 

Recently uploaded

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
 
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
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
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
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
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
 
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
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
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
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 

Recently uploaded (20)

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
 
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.
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
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
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
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
 
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
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.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...
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 

Types of grammer - TOC

  • 1. ITM Gwalior 1 INSTITUTE OF TECHNOLOGY AND MANAGEMENT TOPIC: TYPES OF GRAMMAR CS-501(A):Theory of computation Presented to- Presented by- Dr . Deepak Gupta Abhay Dhupar 0905CS191001 Associate Professor Abhay Singh 0905CS191002 (Dept. of CSE) Abhinav Goyal 0905CS191003 Abhinav Gupta 0905CS191004
  • 2. GRAMMARS • Noam Chomsky gave a mathematical model of grammar. This model is used to write computer languages effectively. • Grammar in theory of computation is a finite set of formal rules that are generating syntactically correct sentences. • The formal definition of grammar is that it is defined as four tuples ITM Gwalior 2
  • 3. CONT.  G=(V,T,P,S)  G is a grammar, which consists of a set of production rules. It is used to generate the strings of a language.  T is the final set of terminal symbols. It is denoted by lower case letters.  V is the final set of non-terminal symbols. It is denoted by capital letters.  P is a set of production rules, which is used for replacing non-terminal symbols (on the left side of production) in a string with other terminals (on the right side of production).  S is the start symbol used to derive the string. ITM Gwalior 3
  • 4. CONT. • V = { S , A , B } => Non-Terminal symbols • T = { a , b } => Terminal symbols • P = { S → ABa , A → Ba , B → ab} => Production rules • S = { S } => Start symbol ITM Gwalior 4
  • 7. DIFFERENT TYPES OF GRAMMAR Grammar can be divided on basis of –  Type of Production Rules  Number of Derivation Trees  Number of Strings ITM Gwalior 7
  • 9. TYPES OF GRAMMAR Grammar language Automata Production Rules Type 0 Recursively enumerable Turning machine No restriction Type 1 Context- sensitive Linear-bounded Non- deterministic machine αAβ → αγβ Type 2 Context-free Non-deterministic push down Automata A→γ Type 3 Regular Finite Automata data A→αB A→α ITM Gwalior 9
  • 11. TYPE 0 ITM Gwalior 11 Type 0 grammar language are recognized by turing machine. Grammar Production in the form of where α is ( V + T)* V ( V + T)* β is ( V + T )*. In type 0 there must be at least one variable on Left side of production. Ex - Sab –> ba A –> S.
  • 12. TYPE 1 Type-1 grammars generate the context-sensitive languages. The language generated by the grammar are recognized by the Linear Bound Automata In Type 1, I. First of all Type 1 grammar should be Type 0. II. Grammar Production in the form of |α | <= | β | i.e count of symbol in α is less than or equal to Ex S –> AB AB –> abc B –> b ITM Gwalior 12
  • 13. TYPE 2 Type-2 grammars generate the context-free languages. The language generated by the grammar is recognized by a Pushdown automata. In Type 2, 1. First of all it should be Type 1. 2. Left hand side of production can have only one variable. |α| = 1. Their is no restriction on β . Ex - S –> AB A –> a B –> b ITM Gwalior 13
  • 14. TYPE 3 Type-3 grammars generate regular languages. These languages are exactly all languages that can be accepted by a finite state automaton. Type 3 is most restricted form of grammar. It should be in the given form only : V –> VT / T (left-regular grammar) (or) V –> TV /T (right-regular grammar) Ex - S –> a ITM Gwalior 14
  • 15. APPLICATION OF GRAMMAR • For defining programming languages • For parsing the program by constructing syntax tree • For translation of programming languages • For describing arithmetic expressions • For construction of compilers, etc. ITM Gwalior 15