CFG for strings without bbb

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

Share on WhatsApp

← RGPV CS-501 Theory of Computation November 2023 Solved Paper

Question

Specify a CFG as a four-tuple (V,T,P,S) over {a,b} for strings without the substring bbb.

Asked in: CS-501 | November 2023 | 6(b)(ii)

Answer

G=({S,A,B},{a,b},P,S), where S→aS|bA|ε, A→aS|bB|ε, B→aS|ε. The variables represent zero, one or two trailing b symbols. No b production exists from B, so three consecutive b symbols are impossible. Every valid string follows these rules and can terminate in any state.

← 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