I would like to verify that I am converting this regex to a right-linear grammar correctly based on the information from this previous question and the wonderful answer by Grijesh: Left-Linear and Right-Linear Grammars
Here is the question: "Write a regular (right linear) grammar that generates the set of strings denoted by the regular expression ((10)+ (011 + 1)+)* (0 + 101)*."
And here are the grammars I built up, with my final one being on the bottom:
1:
S --> 1
0:
S --> 0
10:
S --> 1A
A --> 0
(10)+:
S --> 1A
A --> 0 | 0S
011:
S --> 0A
A --> 1B
B --> 1
(011 + 1):
S --> 0A | 1
A --> 1B
B --> 1
(011 + 1)+:
S --> 0A | 1 | 1S
A --> 1B
B --> 1 | 1S
(10)+ (011 + 1)+:
S --> 1A
A --> 0S | 0B
B --> 0C | 1 | 1B
C --> 1D
D --> 1 | 1B
((10)+ (011 + 1)+)*:
S --> 1A | ε
A --> 0S | 0B
B --> 0C | 1 | 1B
C --> 1D
D --> 1 | 1B
0:
S --> 0
101:
S --> 1A
A --> 0B
B --> 1
(0 + 101):
S --> 0 | 1A
A --> 0B
B --> 1
(0 + 101)*:
S --> 0 | 1A | ε
A --> 0B
B --> 1
((10)+ (011 + 1)+)* (0 + 101)*:
S --> 1A | ε | E
A --> 0S | 0B
B --> 0C | 1 | 1B
C --> 1D
D --> 1 | 1B | 1E
E --> 0 | 1F | ε
F --> 0G | 0E
G --> 1 | 1E
Could anyone help me verify whether this is correct? Thanks bunches! :D