← RGPV CS-501 Theory of Computation November 2023 Solved Paper
Question
Construct a CFG for aⁿbᵐcⁿ, where m,n≥1.
Asked in: CS-501 | November 2023 | 4(i)
Answer
Use S→aSc|aBc and B→bB|b. Each recursive S step adds a matching a,c pair; the base ensures at least one pair. B generates one or more b symbols. Example S⇒aSc⇒aaBcc⇒aabBcc⇒aabbcc. No other symbol order is possible.
← RGPV CS-501 Theory of Computation November 2023 Solved Paper
Discussion
Ask a question, share your thoughts or report an error.
Sign in to participate in the discussion.
Join the discussion