← RGPV CD-501 Theory of Computation November 2023 Solved Paper
Question
Define ambiguous grammar and test whether S→aAB, A→bC|cd, B→c|d, C→cd is ambiguous.
Asked in: CD-501 | November 2023 | 4(a)
Answer
An ambiguous grammar permits two distinct parse trees for one word. Here A generates bcd or cd, and B generates c or d. The four possible words are abcdc, abcdd, acdc, acdd. They are distinct and each has exactly one choice of A and B; C has only one rule. Therefore the grammar is unambiguous.
← RGPV CD-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