MY Converting Regular Grammars To Regular Expressions
MY Converting Regular Grammars To Regular Expressions
Regular grammar generates regular language. They have a single non-terminal on the left-
hand side and a right-hand side consisting of a single terminal or single terminal followed by a
non-terminal.
The productions must be in the form:
A ⇢ xB
A ⇢ x
∑ = {a,b}
Initial state(q ) = A 0
Final state(F) = B
The RLG corresponding to FA is
B ⇢ ∈/aB/bB
A ⇢ bB
The above grammar is RLG, which can be written directly through FA.
This grammar derives strings that are stated with B
The above RLG can derive strings that start with b and after that any input symbol(i.e. ∑ ={a, b}
can be accepted).
The regular language corresponding to RLG is
L= {b, ba, bb, baa, bab ,bba,bbb ..... }
If we reverse the above production of the above RLG, then we get
B ⇢ ∈/Ba/Bb
A ⇢ Bb
This represents the same procedure as above for converting RLG to LLG
B ⇢ ∈
A ⇢ 0A/1B/0B
For production B ⇢ ∈, this means there is no need for state transition. This means it
take place from State A to B.
would be the final state in the corresponding FA as RHS is terminal.
So the final NFA for the corresponding RLG is
A ⇢ ∈
B ⇢ Ba/Bb/Ab
Step 1: Convert the LLG into FA(i.e. the conversion procedure is the same as above)
Step 2: Reverse the FA(i.e. initial state is converted into final state and convert final state to
initial state and reverse all edges)