Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
What is type 3 grammar? Explain its properties
Type 3 grammars are regular grammars that describe regular / formal languages.
These grammars contain production rules consisting of the following −
Only one non-terminal at the left hand side,
The right hand side has a single terminal and may or may not be followed by non terminals.
Example
A → ε , A → a, A → b, A → aA etc.
Types
There are two types of regular grammars namely −
Right linear / Right regular grammar
Left linear / Left regular grammar
Let us learn about these two types of grammar in detail.
Right linear grammar
This is a regular grammar with the production rules of the form
A → α (or) A → α B
Where, A, B → non terminal symbols α → terminal symbol
These grammars are right-branching in nature, since the substitution is done for the right most non terminal, if available.
Left linear grammar
This is a regular grammar with the production rules of the form −
A → α (or) A → B α
Where, A and B are non terminals and α is a terminal symbol.
Since the substitution is done for the leftmost non-terminal, these grammars are left branching in nature.
Properties of Regular grammars
The regular grammars generates regular languages which are closed under the following −
Union
Concatenation
Intersection
Complementation
Difference
Reversal
Reversal
Closure
Homomorphism
Inverse homomorphism.
