Constructing regular grammar from regular expression

December 4, 2026 · Team EasyExamNotes · 1 min read (est.) · 0 comments

Share on WhatsApp

← RGPV CS-501-CBGS Theory of Computation June 2020 Solved Paper

← RGPV CS-501-CBGS Theory of Computation December 2020 Solved Paper

Question

How can we construct regular grammar from regular expression?

Asked in: CS-501 | June 2020 | 7(a)

How can we construct regular grammar from regular expression? Explain.

Asked in: CS-501 | December 2020 | 6(b)

Answer

First convert the expression to an ε-NFA using Thompson construction. Remove ε-transitions or convert to a DFA by subset construction. For each state q create a variable A_q; for every transition q —a→ r add A_q→aA_r. For each accepting state add A_q→ε. Use the initial state variable as start symbol. This right-linear grammar generates exactly the accepted strings because each derivation follows an automaton path and terminates only in a final state. Example for a*b: S→aS | bF, F→ε. The word aab has derivation S⇒aS⇒aaS⇒aabF⇒aab. This method applies to every regular expression, including those containing union, concatenation and star.

← RGPV CS-501-CBGS Theory of Computation June 2020 Solved Paper

← RGPV CS-501-CBGS Theory of Computation December 2020 Solved Paper

Discussion

Ask a question, share your thoughts or report an error.

Sign in to participate in the discussion.

Join the discussion