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
-
Economics & Finance
What are the restrictions of regular grammar?
A regular grammar is the one where each production takes one of the following restricted forms −
B → ∧, B → w,
B → A,
B → wA.
(Where A, B are non-terminals and w is a non-empty string of terminals.)
Restrictions of regular grammar
Only one nonterminal can appear on the right-hand side of a production.
Nonterminal must appear on the right end of the right-hand side.
Therefore, the productions are as follows −
A → aBc and S → TU
These are not part of a regular grammar, but the production A → abcA is.
Things like A → aB|cC are allowed because they are actually two separate productions.
For any regular language, we can find a regular grammar which will produce it.
However, there may be other non-regular grammars which also produce it.
Example
For the regular language a*b*

Example
Construct a regular grammar for the language of the regular expression a*bc*
First, the strings of a*bc* start with either a or b.
S → aS | bC.
We can derive strings of the form bC, abC, aabC, and so on.
Now we need a definition for C to derive the language of c* −
C → ∧ | cC.
Therefore, a regular grammar for a *bc* can be written as follows −
S → aS | bC; C → ∧ | cC.
