To make $LL(1)$ parsing table first we have to find $\text{FIRST}$ and $\text{FOLLOW}$ sets from the given grammar.
- $\text{FIRST}(S)=\{a,b,\epsilon\}$
- $\text{FIRST}(A)=\{a,b,\epsilon\}$
- $\text{FIRST}(B)=\{a,b,\epsilon\}$
- $\text{FOLLOW}(S)= \{a,b,\$\}$
- $\text{FOLLOW}(A)= \{a,b\}$
- $\text{FOLLOW}(B)= \{a,b,\$\}$
Now lets make $LL(1)$ parse table
$$\begin{array}{|c|l|l|l|}\hline \textbf{Non Terminal} & \textbf{a} & \textbf{b} & \textbf{\$} \\\hline
\text{$S$} & \text{$S \rightarrow aAbB$},&\text{$S \rightarrow bAbB$},& \text{$S\rightarrow \varepsilon $}\\
& \text{$S \rightarrow \epsilon$} & \text{$S \rightarrow \epsilon$} & \\\hline
\text{$A$} & \text{$A\rightarrow S$} & \text{$A\rightarrow S$} & \text{} \\\hline \text{$B$} & \text{$B\rightarrow S$} & \text{$B\rightarrow S$} & \text{$B \rightarrow S$} \\\hline \end{array}$$
Here is the explanation of entries asked in question
- For E1 and E2 Look into $\text{FIRST}(S)=\{a,b,\epsilon\}$.
a is because of $S \rightarrow aAbB$ and b is because of $S \rightarrow bAaB$
So $M[S,a]$ and $M[S,b]$ will contain $S \rightarrow aAbB$ and $S \rightarrow bAaB$ respectively. For epsilon look into $\text{FOLLOW}(S)= \{a,b,\$\}$. So $S \rightarrow \epsilon$ will be in $M[S,a]$, $M[S,b]$ and $M[S,\$]$
- Now for E3 look into $\text{FIRST}(B)= \{a,b,\epsilon\}$. $a$ and $b$ are because of $B \rightarrow S$.
So $M[B,a]$ and $M[B,b]$ will contain $B \rightarrow S$ and for $\epsilon$, look into $\text{FOLLOW}(B)= \{a,b,\$\}$. Hence $M[B,\$]$ will contain $B \rightarrow S.$
Now we get the answer as E1 is $S\rightarrow aAbB,$ $S\rightarrow \epsilon,$ E2 is $S\rightarrow bAaB,$ $S\rightarrow \epsilon$ and E3 is $B \rightarrow S.$
Hence, Option (C) is correct.