You are on page 1of 9

School of Computer Science and Engineering

Course Code:- BTCS3501 Course Name:- TOC

Topic:- Alphabets, Strings and Languages, Chomsky Hierarchy of


Grammar

Name: - Adarsh Kumar Singh, Krishna


Admission No.: - 19SCSE1260006 , 19SCSE1260012
Enrollment No.: - 19021260002, 19021260008
Section: - CSE-CSDF-1
Submitted To: - Mr. Abhay Kumar

Faculty Name: Mr. Abhay Kumar Program Name: Toc


Automata

Automata (also known as Theory Of Computation) is a theoretical branch of Computer Science and
Mathematics, which mainly deals with the logic of computation with respect to simple machines, referred to as
automata.
Automata enables the scientists to understand how machines compute the functions and solve problems. The
main motivation behind developing Automata Theory was to develop methods to describe and analyse the
dynamic behavior of discrete systems.
Now, let’s understand the basic terminologies, which are important and frequently used in Theory of Computation.

Alphabet
● Definition − An alphabet is any finite set of symbols.
● Example − ∑ = {a, b, c, d} is an alphabet set where ‘a’, ‘b’, ‘c’, and ‘d’ are symbols.
String
● Definition − A string is a finite sequence of symbols taken from ∑.
● Example − ‘cabcad’ is a valid string on the alphabet set ∑ = {a, b, c, d}
Language
● Definition − A language is a subset of ∑* for some alphabet ∑. It can be finite or infinite.
● Example − If the language takes all possible strings of length 2 over ∑ = {a, b}, then L = { ab, aa, ba, bb }
Chomsky Hierarchy of Grammar

Chomsky Hierarchy represents the class of languages that are accepted by the different machine. The category of language in Chomsky's Hierarchy is as
given below:

1. Type 0 known as Unrestricted Grammar.


2. Type 1 known as Context Sensitive Grammar.
3. Type 2 known as Context Free Grammar.
4. Type 3 Regular Grammar

This is a hierarchy. Therefore every language of type 3 is also of type 2, 1 and 0. Similarly, every language of type 2 is also of type 1 and type 0, etc.
Type 0: Unrestricted Grammar:
Type-0 grammars include all formal grammars. Type 0 grammar language are recognized by turing machine. These languages are also known as the
Recursively Enumerable languages.
Grammar Production in the form of

where
is ( V + T)* V ( V + T)*
V : Variables
T : Terminals.
is ( V + T )*.
In type 0 there must be at least one variable on Left side of production.
For example,
Sab –> ba
A –> S.
Here, Variables are S, A and Terminals a, b.
Type 1: Context Sensitive Grammar)
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


For Example,
S –> AB
AB –> abc
B –> b
Type 2: Context Free Grammar:
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 .
For example,
S –> AB
A –> a
B –> b
Type 3: Regular Grammar:
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.
Type 3 should be in the given form only :
V –> VT / T (left-regular grammar)
(or)
V –> TV /T (right-regular grammar)
for example: S –> a
The above form is called as strictly regular grammar.
There is another form of regular grammar called extended regular grammar. In this form :
V –> VT* / T*. (extended left-regular grammar)
(or)
V –> T*V /T* (extended right-regular grammar)
for example :
S –> ab.
THANK YOU

You might also like