A formal conversion to regular grammar
For any regular formula R selecting a nonterminal Z → Z generation rule R
1. rules of the form A → ab converted into A → aB, B → b
2. the form A → a | b rules, be converted into A → a, A → b (A → a | b)
3. The form A → a * b rules, be converted into A → aA, A → b
The form A → ba * As a rule, be converted into A → Aa, A → b
Continue using the conversion rules, each rule comprising at most until a terminator far .
(1)1(0|1)*101
Regular grammar:
(1)S -> A1
A -> B0
B -> C1
C -> 1(0|1)* -> C(0|1)|1 -> C0|C1|1
(2)(a|b)*(aa|bb)(a|b)*
Regular grammar:
A->(a|b)A A->(aa|bb)(a|b)* A->aA|bA
B->B(a|b) B->(aa|bb) B->Ba|Bb
B->(aa|bb)->aA|bB
A->a
B->b
(3)((0|1)*|(11))*
Regular grammar:
A->((0|1)* | (11))A |ε -> (0|1)*A | (11)A|ε
A->(0|1)*A->(0|1)A|A
A->11A->1B
B->1A
(4)(0|110)
Regular grammar:
A->0|1A
A->1B
B->0
2. automaton M = ({q0, q1, q2, q3}, {0,1}, f, q0, {q3})
Where f:
(q0,0)=q1
(q1,0)=q2
(Q2,0) = q3
(q0,1)=q0
(q1,1)=q0
(Q2,1) = q0
(Q3,0) = q3
(Q3,1) = q3
Now draw the state transition matrix and state transition diagram, identify what language.
A: The state transition matrix
|
0 |
1 |
q0 |
q1 |
q0 |
q1 |
q2 |
q0 |
q2 |
q3 |
q0 |
q3 |
q3 |
q3 |
State transition diagram:
Language: ((1 * 01) * 01) * 0 (0 | 1) *
3. configured by regular automatic machine NFA formula R
( 1 ) (a | b) * abb
(2)(a|b)*(aa|bb)(a|b)*
(3)1(1010*|1(010)*1)*0