Multiple choice

Consider the following grammar:A $\rightarrow$ BCC $\rightarrow$ +$A| \epsilon$B $\rightarrow$ id In the predictive parser table, m, of grammar the entire M [A, id] and M [C, $] respectively, is

  1. {A $\rightarrow$ BC} and {C $\rightarrow$$\epsilon$}
  2. {A $\rightarrow$ BC} and { }
  3. {A $\rightarrow$ BC} and {C $\rightarrow$+A}
  4. {B $\rightarrow$ id} and {C $\rightarrow$ $\epsilon$}
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

First (A) = first (B) = id     First (C) = {+, $\epsilon$}$\therefore$ For the production A$\rightarrow$ BC, as terminal id is in the first (A), M [A, id] = {A $\rightarrow$ BC}As $\epsilon$ is in first (C), M [C, \$] = {C$\rightarrow$+A}