Let be a context free grammar where the rule set R is
Which of the following statements is true?
View worked solution
Answer: C
The given grammar is:
This grammar generates the language of balanced parentheses (often called the Dyck language ), where represents the opening parenthesis and represents the closing parenthesis.
Let's analyze each option:
- Option A: is not ambiguous
The grammar is highly ambiguous. For example, the string has multiple derivations: - Option B: There exist such that
Since the grammar contains the rule , if and , we can derive starting from via . Thus, is closed under concatenation, meaning for all . This statement is false. - Option C: There is a deterministic pushdown automaton that accepts
The language of balanced parentheses is a well-known Deterministic Context-Free Language (DCFL). A Deterministic PDA (DPDA) can accept it by pushing onto the stack and popping when is encountered. If the stack is empty at the end of the input, the string is accepted. This statement is true. - Option D: We can find a deterministic finite state automaton that accepts
The language requires matching an arbitrary number of nested 's and 's, which requires infinite memory. Since it is not a regular language, no DFA can accept it. This statement is false.
Free practice · Your answers on this page are not saved.
