RGPV 2020
How can we construct regular grammar from regular expression?
Ans. Lets take an regular expresion example: 0*(1(0+1))*
Now convert above example in to regular language.
0*(1(0+1))*
Conver above regular expression into Right linear regular grammar in step by step.
Step 01:
S --> 0S
Step 02:
S --> 0S | A | ∈
Step 03:
S --> 0S | A | ∈
A --> 1B
Step 04:
S --> 0S | A | ∈
A --> 1B
B --> 0A | 1A | 0 | 1
Conver above regular expression into Left linear regular grammar in step by step.
Step 01:
S --> A | ∈
Step 02:
S --> A | ∈
A --> A10 | A11 | B
Step 03:
S --> A | ∈
A --> A10 | A11 | B
B --> B0 | 0
Post a Comment
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.