SlideShare a Scribd company logo
2
Most read
3
Most read
11
Most read
DETERMINISTIC CONTEXT-FREE GRAMMARS
&NON-DETERMINISTIC
GRAMMARS
 Deterministic context-free grammars are always
unambiguous and are an important subclass of
unambiguous CFGs;
 there are non-deterministic unambiguous CFGs,
Recognizing ambiguous grammars;
 Inherently ambiguous languages ... also has the
unambiguous grammar, consisting of a single
production rule:
AMBIGUOUS GRAMMAR
 In computer science, an ambiguous grammar is a
context-free grammar for which there exists a string
that can have more than one leftmost derivation
 while an unambiguous grammar is a context-free
grammar for which every valid string has a unique
leftmost derivation.
CONTEXT FREE GRAMMAR
 A context-free language (CFL) is a language
accepted by a push-down
 automaton (PDA). Alternatively, a context-free
language is one that
 has a context-free grammar (CFG) describing it.
 A CFG is a structure (N, Σ, P, S) where N is a set of
symbols known
 as non-terminals, Σ is a set of symbols known as
terminals, S ∈ N is
 called the start symbol, and P is a finite set of production
rules. Each
 production rule is of the form
 L → R1 R2 . . . Rn,
 where L ∈ N is a non-terminal and each Ri belongs to N
∪ Σε. We
 will now present several context-free grammars through
examples, and
 then proceed to examine their properties
 Here is a simple grammar for arithmetic
expressions built from numbers out of a
 given range. Let Σ contain the symbols (, ), +, −, ×, /
and the numbers in the desired range,
 and let N = {S, B}. The production rules are as
follows
Deterministic context free grammars &non-deterministic
Deterministic context free grammars &non-deterministic
A PARSE TREE
 The language generated by a grammar G is the set
of all strings α over Σ which are
 generated by G.
 9 Languages generated by context-free grammars
are called context-free.
DETERMINISTIC CONTEXT-FREE GRAMMARS
ARE ALWAYS UNAMBIGUOUS,
RECOGNIZING AMBIGUOUS GRAMMARS
 OR Non-deterministic
 The general decision problem of whether a
grammar is ambiguous is undecidable because it
can be shown that it is equivalent to the Post
correspondence problem.[1] At least, there are tools
implementing some semi-decision procedure for
detecting ambiguity of context-free grammars.[2]
 Many languages admit both ambiguous and
unambiguous grammars, while some languages
admit only ambiguous grammars. Any non-empty
language admits an ambiguous grammar by taking
an unambiguous grammar and introducing a
duplicate rule or synonym (the only language
without ambiguous grammars is the empty
language). A language that only admits ambiguous
grammars is called an inherently ambiguous
language, and there are inherently ambiguous
context-free languages.
 Thank you

More Related Content

PPTX
CPU Scheduling in OS Presentation
PPT
Turing Machine
PDF
OS Unit 3 - Interprocess Communication
PDF
Automata theory
PPTX
Minmax Algorithm In Artificial Intelligence slides
PPTX
N queens using backtracking
PPTX
Turing Machine
PPTX
Design and Analysis of Algorithms.pptx
CPU Scheduling in OS Presentation
Turing Machine
OS Unit 3 - Interprocess Communication
Automata theory
Minmax Algorithm In Artificial Intelligence slides
N queens using backtracking
Turing Machine
Design and Analysis of Algorithms.pptx

What's hot (20)

PPTX
Types of grammer - TOC
PPTX
Pushdown Automata Theory
PPTX
push down automata
PDF
UNIT-V.pdf daa unit material 5 th unit ppt
PPTX
Introduction to Genetic Algorithms
PPTX
Chomsky classification of Language
PPTX
Hidden surface removal
PPTX
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
PPTX
Genetic Algorithm by Example
PDF
NFA to DFA
PPT
EULER AND FERMAT THEOREM
PPTX
Scaling and shearing
PDF
PPT
Communication primitives
PDF
Deadlock Avoidance - OS
PDF
9. chapter 8 np hard and np complete problems
PPTX
First order predicate logic (fopl)
PPTX
Stochastic Gradient Decent (SGD).pptx
PPTX
Turing machine
PPTX
Automata Theory - Turing machine
Types of grammer - TOC
Pushdown Automata Theory
push down automata
UNIT-V.pdf daa unit material 5 th unit ppt
Introduction to Genetic Algorithms
Chomsky classification of Language
Hidden surface removal
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Genetic Algorithm by Example
NFA to DFA
EULER AND FERMAT THEOREM
Scaling and shearing
Communication primitives
Deadlock Avoidance - OS
9. chapter 8 np hard and np complete problems
First order predicate logic (fopl)
Stochastic Gradient Decent (SGD).pptx
Turing machine
Automata Theory - Turing machine
Ad

Viewers also liked (20)

PPT
Class7
PDF
Lecture: Context-Free Grammars
PPT
Context free languages
PPT
Grammar
PPT
2. context free langauages
PDF
Context free langauges
PPTX
Context free grammars
PPT
Context free grammars
PPTX
Incompleteness without Godel Numberings
PDF
Reintroducing Web Technology
PPTX
4 compiler lab - Syntax Ana
PPTX
Network essentials chapter 2
PPT
Properties of cfg
PDF
PPT
Qa conf 2011_ads
PPT
Introduction to fa and dfa
DOCX
Network technology Paper 2
PPT
Network Fundamentals – Chapter 1
PPT
Network Fundamentals – Chapter 2
PPTX
Best Practice - Learning CCNA E1 module using Mind Maps
Class7
Lecture: Context-Free Grammars
Context free languages
Grammar
2. context free langauages
Context free langauges
Context free grammars
Context free grammars
Incompleteness without Godel Numberings
Reintroducing Web Technology
4 compiler lab - Syntax Ana
Network essentials chapter 2
Properties of cfg
Qa conf 2011_ads
Introduction to fa and dfa
Network technology Paper 2
Network Fundamentals – Chapter 1
Network Fundamentals – Chapter 2
Best Practice - Learning CCNA E1 module using Mind Maps
Ad

Similar to Deterministic context free grammars &non-deterministic (20)

PDF
Chomsky hierarchy
PPTX
Types of Language in Theory of Computation
PPT
Normal-forms-for-Context-Free-Grammars.ppt
PDF
Flat unit 3
PDF
contextfreegrammars-120925004035-phpapp02.pdf
PPT
context free language
PDF
ChomskyPresentation.pdf
PPTX
Context Free Grammar
PDF
Regular Language and Regular Grammar Lecture
PDF
Lecture Notes-Are Natural Languages Regular.pdf
DOCX
Context Free Grammer .docx
PPTX
Decidability and Reducability related to TM
PPTX
Context free grammars
PDF
Mba ebooks ! Edhole
PDF
Free Ebooks Download ! Edhole
PPTX
Derivation of Context Free Grammars (CFG)
PPT
Automata_and_Complexity_Theommmmmmmry-RevisionforExitExam.ppt
PPTX
CS911-Lecture-21_43709.pptx
PPTX
hghghghhghghgggggggggggggggggggggggggggggggggg
PPTX
Lecture 1 of automata theory where .pptx
Chomsky hierarchy
Types of Language in Theory of Computation
Normal-forms-for-Context-Free-Grammars.ppt
Flat unit 3
contextfreegrammars-120925004035-phpapp02.pdf
context free language
ChomskyPresentation.pdf
Context Free Grammar
Regular Language and Regular Grammar Lecture
Lecture Notes-Are Natural Languages Regular.pdf
Context Free Grammer .docx
Decidability and Reducability related to TM
Context free grammars
Mba ebooks ! Edhole
Free Ebooks Download ! Edhole
Derivation of Context Free Grammars (CFG)
Automata_and_Complexity_Theommmmmmmry-RevisionforExitExam.ppt
CS911-Lecture-21_43709.pptx
hghghghhghghgggggggggggggggggggggggggggggggggg
Lecture 1 of automata theory where .pptx

Recently uploaded (20)

DOCX
573137875-Attendance-Management-System-original
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
additive manufacturing of ss316l using mig welding
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
Digital Logic Computer Design lecture notes
PPTX
Welding lecture in detail for understanding
PPTX
web development for engineering and engineering
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
PPT on Performance Review to get promotions
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Geodesy 1.pptx...............................................
573137875-Attendance-Management-System-original
Model Code of Practice - Construction Work - 21102022 .pdf
Lecture Notes Electrical Wiring System Components
Internet of Things (IOT) - A guide to understanding
Embodied AI: Ushering in the Next Era of Intelligent Systems
R24 SURVEYING LAB MANUAL for civil enggi
additive manufacturing of ss316l using mig welding
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
bas. eng. economics group 4 presentation 1.pptx
Digital Logic Computer Design lecture notes
Welding lecture in detail for understanding
web development for engineering and engineering
CH1 Production IntroductoryConcepts.pptx
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPT on Performance Review to get promotions
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Geodesy 1.pptx...............................................

Deterministic context free grammars &non-deterministic

  • 2.  Deterministic context-free grammars are always unambiguous and are an important subclass of unambiguous CFGs;  there are non-deterministic unambiguous CFGs, Recognizing ambiguous grammars;  Inherently ambiguous languages ... also has the unambiguous grammar, consisting of a single production rule:
  • 3. AMBIGUOUS GRAMMAR  In computer science, an ambiguous grammar is a context-free grammar for which there exists a string that can have more than one leftmost derivation  while an unambiguous grammar is a context-free grammar for which every valid string has a unique leftmost derivation.
  • 4. CONTEXT FREE GRAMMAR  A context-free language (CFL) is a language accepted by a push-down  automaton (PDA). Alternatively, a context-free language is one that  has a context-free grammar (CFG) describing it.
  • 5.  A CFG is a structure (N, Σ, P, S) where N is a set of symbols known  as non-terminals, Σ is a set of symbols known as terminals, S ∈ N is  called the start symbol, and P is a finite set of production rules. Each  production rule is of the form  L → R1 R2 . . . Rn,  where L ∈ N is a non-terminal and each Ri belongs to N ∪ Σε. We  will now present several context-free grammars through examples, and  then proceed to examine their properties
  • 6.  Here is a simple grammar for arithmetic expressions built from numbers out of a  given range. Let Σ contain the symbols (, ), +, −, ×, / and the numbers in the desired range,  and let N = {S, B}. The production rules are as follows
  • 10.  The language generated by a grammar G is the set of all strings α over Σ which are  generated by G.  9 Languages generated by context-free grammars are called context-free.
  • 12. RECOGNIZING AMBIGUOUS GRAMMARS  OR Non-deterministic
  • 13.  The general decision problem of whether a grammar is ambiguous is undecidable because it can be shown that it is equivalent to the Post correspondence problem.[1] At least, there are tools implementing some semi-decision procedure for detecting ambiguity of context-free grammars.[2]
  • 14.  Many languages admit both ambiguous and unambiguous grammars, while some languages admit only ambiguous grammars. Any non-empty language admits an ambiguous grammar by taking an unambiguous grammar and introducing a duplicate rule or synonym (the only language without ambiguous grammars is the empty language). A language that only admits ambiguous grammars is called an inherently ambiguous language, and there are inherently ambiguous context-free languages.