Official answer: A) FIRST(A) = {a, b, } = FIRST(B) FOLLOW(A) = {a, b} FOLLOW(B) = {a, b, \$}
ParsingTo compute FIRST and FOLLOW sets:
FIRST Sets:
From S→aAbB∣bAaB∣ε, we have FIRST(S)={a,b,ε}.
From A→S, FIRST(A)=FIRST(S)={a,b,ε}.
From B→S, FIRST(B)=FIRST(S)={a,b,ε}.
FOLLOW Sets:
Start symbol is S, so \\in FOLLOW(S)$.
In S→aAbB, after A is bB, so FOLLOW(A) contains FIRST(bB)={b}.
In S→bAaB, after A is aB, so FOLLOW(A) contains FIRST(aB)={a}.
Thus, FOLLOW(A)={a,b}.
In S→aAbB and S→bAaB, B is the last symbol, so FOLLOW(B) contains FOLLOW(S).
Since A→S and B→S, FOLLOW(S) contains both FOLLOW(A) and FOLLOW(B).
Thus, \text{FOLLOW}(S) = \{\\} \cup FOLLOW(A) \cup FOLLOW(B) = \{a, b, \$\},whichgivesFOLLOW(B) = \{a, b, \$\}.
Therefore, FIRST(A)={a,b,ε}=FIRST(B), FOLLOW(A)={a,b}, and \text{FOLLOW}(B) = \{a, b, \\}$, matching (A).