Multiple choice

Direction: For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as El, E2, and E3. is the empty string, $ indicates end of input, and I separates alternate right hand sides of productions.

The First and Follow sets for the non-terminals A and B are

  1. FIRST(A) = {a, b,$\in$} = FIRST (B) FOLLOW(A) = {a, b} FOLLOW(B) = {a, b, \$}
  2. FIRST(A) = {a, b, \$} FIRST(B) = {a, b,$\in$} FOLLOW(A) = {a, b} FOLLOW(B) ={\$}
  3. FIRST(A) = {a, b,$\in$} = FIRST(B) FIRST(A) = {a, b} FOLLOW(B) = $\phi$
  4. FIRST(A) = {a, b,} = FIRST(B) FIRST(A) = {a, b} FOLLOW(B) = {a, b}

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

First(A) = First(S) = First(aAbB) $\cup$First(bAaB) $\cup$First($\in$) = {a}$\cup${b}$\cup${$\in$} = {$\in$,a, b} First(B)I = First(S) = {$\in$,a, b} Follow (A) = First(bB) $\cup$ First(aB) = {a, b} Follow (B) = Follow(S) = {\$} $\cup$ Follow(A) = {$, a, b}