0% found this document useful (0 votes)
64 views

Presentation On Production Rule of All The Grammers

This document discusses Chomsky hierarchy, which classifies formal languages according to the type of grammar used to generate them. It presents the four types of grammars in Chomsky hierarchy from least to most restricted: Type-0 unrestricted grammars, Type-1 context-sensitive grammars, Type-2 context-free grammars, and Type-3 regular grammars. Each type builds on the previous one and has more restrictions on production rules. Examples and characteristics are provided for each type of grammar.

Uploaded by

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

Presentation On Production Rule of All The Grammers

This document discusses Chomsky hierarchy, which classifies formal languages according to the type of grammar used to generate them. It presents the four types of grammars in Chomsky hierarchy from least to most restricted: Type-0 unrestricted grammars, Type-1 context-sensitive grammars, Type-2 context-free grammars, and Type-3 regular grammars. Each type builds on the previous one and has more restrictions on production rules. Examples and characteristics are provided for each type of grammar.

Uploaded by

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

Presentation

on
Production rule of all the
grammers
NAME-SUSHIL JASWAL SUBMITTED TO-Dr BRIJESH BAKARIYA
ROLL NO-1916413
NAME-SIMRAN KAUR
ROLL NO-1916410
NAME-RADHIKA
ROLL NO-1916405
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.
Comparision between four types of
grammars
 According to Noam Chomosky, there are four types of grammars − Type 0, Type 1, Type 2, and
Type 3. The following table shows how they differ from each other −
Type - 0 Grammar

Type-0 grammars generate recursively enumerable languages.


The productions have no restrictions.
They are any phase structure grammar including all formal grammars.
They generate the languages that are recognized by a Turing machine.
The productions can be in the form of α → β where α is a string of terminals and
nonterminals with at least one non-terminal and α cannot be null. β is a string of
terminals and non-terminals.
Example
S → ACaB
Bc → acB

CB → DB aD → Db
Rules for 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 grammars generate context-sensitive languages. The productions must be in the


form
αAβ→αγβ
where A ∈ N (Non-terminal)
and α, β, γ ∈ (T ∪ N)* (Strings of terminals and non-terminals)
The strings α and β may be empty, but γ must be non-empty.
The rule S → ε is allowed if S does not appear on the right side of any rule. The languages
generated by these grammars are recognized by a linear bounded automaton.
Example
AB → AbBc
A → bcA
B → b
Rules for 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 grammars generate context-free languages.


The productions must be in the form A → γ
where A ∈ N (Non terminal)
and γ ∈ (T ∪ N)* (String of terminals and non-terminals).
These languages generated by these grammars are be recognized by a non-
deterministic
pushdown automaton.
Example
S → X a
X → a
X → aX
X → abc
X → ε
Rules for 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 grammars generate regular languages. Type-3 grammars must have a


single non-terminal on the left-hand side and a right-hand side consisting of a single
terminal or single terminal followed by a single non-terminal.
The productions must be in the form X → a or X → aY
where X, Y ∈ N Non terminal)
and a ∈ T (Terminal)
The rule S → ε is allowed if S does not appear on the right side of any rule.
Example
X → ε
X → a | aY
Y → b
Rules for 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 should be in the form of
 V → T*V / T*  
 For example:
 A → xy  

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy