Unit 3
Unit 3
Example
Consider, for example, the grammar G with N =
{S, B}, Σ = {a, b, c}, P consisting of the
following production rules
1. S -> aBSc
2. S -> abc
3. Ba -> aB
4. Bb -> bb
Lecture #16
Chomsky's four types of grammars
• Type-0 grammars (unrestricted grammars)
languages recognized by a Turing machine
• Type-1 grammars (context-sensitive grammars)
Turing machine with bounded tape
• Type-2 grammars (context-free grammars)
non-deterministic pushdown automaton
• Type-3 grammars (regular grammars)
regular expressions, finite state automaton
Grammars, Languages, Machines
Type-0
Recursively enumerable Turing machine No restrictions
Type-1
Context-sensitive Linear-bounded αAβ -> αγβ
non-deterministic
Turing machine
Type-2
Context-free Non-deterministic A -> γ
pushdown automaton
Type-3
Regular Finite state automaton A -> aB
A -> a
• Production Rule: aAb->agb belongs to
which of the following category?
a) Regular Language
b) Context free Language
c) Context Sensitive Language
d) Recursively Ennumerable Language
Type 2
Type 3
• . The entity which generate Language is
termed as:
a) Automata
b) Tokens
c) Grammar
d) Data
Questions
• With reference to the process of conversion of a context
free grammar to CNF, the number of variables to be
introduced for the terminals are:
S->ABa
A->aab
B->Ac
a) 3
b) 4
c) 2
d) 5
Recursive and Enumerable Sets
The Chomsky Hierarchy
Non Turing-Acceptable
Turing-Acceptable
decidable
Context-sensitive
Context-free
Regular
Which of the following statement is false?
a) Context free language is the subset of context sensitive language
b) Regular language is the subset of context sensitive language
c) Recursively ennumerable language is the super set of regular
language
d) Context sensitive language is a subset of context free language
LANGUAGES AND AUTOMATON
Converting Regular Expressions
to Regular Grammars
RE to RG
RE to RG
Recursive and Recursive Enumerable
Languages in TOC
• Recursive Enumerable (RE) or Type -0 Language
• RE languages or type-0 languages are generated by type-0 grammars. An RE
language can be accepted or recognized by Turing machine which means it
will enter into final state for the strings of language and may or may not enter
into rejecting state for the strings which are not part of the language. It means
TM can loop forever for the strings which are not a part of the language. RE
languages are also called as Turing recognizable languages.
• Recursive Language (REC)
• A recursive language (subset of RE) can be decided by Turing machine which means it
will enter into final state for the strings of language and rejecting state for the strings
which are not part of the language. e.g.; L= {a nbncn|n>=1} is recursive because we can
construct a turing machine which will move to final state if the string is of the form
anbncn else move to non-final state. So the TM will always halt in this case. REC
languages are also called as Turing decidable languages. The relationship between RE
and REC languages can be shown in Figure 1.