Which of the following Grammars is/are only Context Free?

Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: B. C, D Only
Explanation
Grammar A has a non-terminal string (aS) on the left side, so it is not context-free. B (S→Ab, A→Sa|a) and E (S→Sb, A→Aa|ε) are purely left-linear, so they are regular grammars. C uses S→AS (two non-terminals on the right) and D mixes left-linear (S→Ab) and right-linear (S→aA) rules, so C and D are context-free grammars but not regular grammars.
More Theory of Computation and Compilers questions
- Consider the following DFA Which of the following NFA is valid for the given DFA ?
- Consider the following DFA that generates set of Σ = {a, b, c} strings over Now identify that which of the followings is the best descripti…
- Match List I with List II. List I: A. Type 3 Grammar, B. Type 2 Grammar, C. Type 1 Grammar, D. Type 0 Grammar. List II: I. V → (V ∪ Σ)*; II…
- Arrange the following parsers in increasing order of their power of handling grammars i.e. from the least powerful parser to the most power…
- Which of the following is the Optimized version for the given TAC in the passage
- What all blocks does Block 3 and Block 5 dominate in the Flow graph for the TAC given in the passage?