Kleene Star Closure of Regular Grammars
Algorithm
Given regular grammar G, we would like to construct a regular grammar
G' such that L(G') = (L(G))*:
- construct the kleene plus of the regular grammar
(see the relevant section);
- add
to the language
(see the relevant section)
Example
Give a regular grammar recognising the Kleene star closure of the
language recognised by the following grammar:
S |  | aA | bB |
A |  | aA | a |
B |  | c | bS |
where S is the start symbol.
- Construct the Kleene plus closure of the language:
S |  | aA | bB |
A |  | a | aA | aS |
B |  | c | cS | bS |
where S is the start symbol.
- Add
to the language:
S1 |  | | aA | bB |
S |  | aA | bB |
A |  | a | aA | aS |
B |  | c | cS | bS |
where S1 is the start symbol.
Exercises
Construct regular grammars which recognise the Kleene star closure of the
languages described using the following regular grammars:
-
G = < | { a, b, c }, |
| { S, A, B, C }, |
|
{ |
S |
 |
aA | bC, |
|
A |
 |
aA | bB |
, |
|
B |
 |
bB | b |
, |
|
C |
 |
cB | cC |
}, |
|
| S > |
-
G = < | { a, b, c }, |
| { S, A, B, C }, |
|
{ |
S |
 |
aA | bC |
, |
|
A |
 |
aA | aS, |
|
B |
 |
b, |
|
C |
 |
cB | cS }, |
|
| S > |
-
G = < | { a, b, c }, |
| { S, A, B, C }, |
|
{ |
S |
 |
aA | bC |
, |
|
A |
 |
aA | aS, |
|
B |
 |
b, |
|
C |
 |
cB | cS }, |
|
| S > |
-
G = < | { a, b }, |
| { S, A }, |
| |
| S > |
-
G = < | { a }, |
| { S }, |
| { S },
|
| S > |