Consider the language and the following statements.
- is deterministic context-free.
- is context-free but not deterministic context-free.
- is not for any .
Which of the above statements is/are TRUE?
View worked solution
Answer: C
To determine which statements are true, let us analyze the language .
Statement I is TRUE (and Statement II is FALSE):
We can construct a Deterministic Pushdown Automaton (DPDA) that accepts by final state:
- Start state is accepting (to accept ).
- For each read, push onto the stack and transition to state (which is an accepting state). This ensures any string of the form is accepted.
- If a is encountered while in , transition to state (non-accepting) and pop from the stack.
- For subsequent 's, stay in and pop .
- If the stack becomes empty (only remains) after reading all 's, transition to state (accepting).
Since all transitions are deterministic, is a Deterministic Context-Free Language (DCFL).
Statement III is TRUE:
For any fixed lookahead , if the parser sees , it cannot determine whether the string is of the form (with no 's) or (where 's appear after symbols). Since this ambiguity cannot be resolved with a finite lookahead of symbols, is not for any .
Thus, statements I and III only are TRUE.
Free practice · Your answers on this page are not saved.
