0% found this document useful (0 votes)
946 views10 pages

Chomsky Hierarchy

The Chomsky Hierarchy orders formal languages based on the expressive power of the grammars that generate them. Type-0 languages have the most power and are generated by unrestricted grammars. Type-3 languages have the least power and are generated by regular grammars. Type-1 languages are generated by context-sensitive grammars and Type-2 by context-free grammars. Each language type fully contains the languages of the types below it, so a Type-2 language is also Type-1 and Type-0, etc. The document provides examples to illustrate the rules that define each language type's grammars.

Uploaded by

Shreya Kardile
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
946 views10 pages

Chomsky Hierarchy

The Chomsky Hierarchy orders formal languages based on the expressive power of the grammars that generate them. Type-0 languages have the most power and are generated by unrestricted grammars. Type-3 languages have the least power and are generated by regular grammars. Type-1 languages are generated by context-sensitive grammars and Type-2 by context-free grammars. Each language type fully contains the languages of the types below it, so a Type-2 language is also Type-1 and Type-0, etc. The document provides examples to illustrate the rules that define each language type's grammars.

Uploaded by

Shreya Kardile
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Chomsky Hierarchy

Chomsky Hierarchy
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:

Type 0 known as Unrestricted Grammar.


Type 1 known as Context Sensitive Grammar.
Type 2 known as Context Free Grammar.
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 Grammar:
• Type 0 grammar is known as Unrestricted
grammar.
• There is no restriction on the grammar rules of
these types of languages.
• These languages can be efficiently modeled by
Turing machines.
• For example:
bAa → aa
S→s
Type 1 Grammar:
• Type 1 grammar is known as Context Sensitive Grammar. The
context sensitive grammar is used to represent context
sensitive language. The context sensitive grammar follows the
following rules:
– The context sensitive grammar may have more than one symbol on
the left hand side of their production rules.
– The number of symbols on the left-hand side must not exceed the
number of symbols on the right-hand side.
– The rule of the form A → ε is not allowed unless A is a start symbol.
It does not occur on the right-hand side of any rule.
• The Type 1 grammar should be Type 0.
• In type 1, Production is in the form of
V → T where the count of symbol in V is less than or equal
to T.
• For example:
S → AT
T → xy
A→a
Type 2 Grammar:
• Type 2 Grammar is known as Context Free Grammar.
• Context free languages are the languages which can
be represented by the context free grammar (CFG).
• Type 2 should be type 1. The production rule is of the
form
A→α
Where A is any single non-terminal and is any
combination of terminals and non-terminals.
• For example:
A → aBb
A→b
B→a
Type 3 Grammar:
• Type 3 Grammar is known as Regular Grammar.
• Regular languages are those languages which can
be described using regular expressions. These
languages can be modeled by NFA or DFA.
• Type 3 is most restricted form of grammar.
• The Type 3 grammar should be Type 2 and Type 1.
• 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:
A → Xy | y OR A → xY | x

You might also like