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.
A → ε , A → a, A → b, A → aA etc.
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.
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.
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.
The regular grammars generates regular languages which are closed under the following −