Suppose we have the following CFG:
A → Bd
B → dA|a|ɛ
Now if I try to calculate FIRST and FOLLOW sets, I think I can get it done as follows:
First(A) = { d, a }
First(B) = { d, a, ɛ }
FOLLOW(A) = { d, $ }
FOLLOW(B) = { d }
And the parser table must be this:
+---+--------+------------------+---+
| | a | d | $ |
+===+========+==================+===+
| A | A → Bd | A → Bd | |
+---+--------+------------------+---+
| B | B → a | B → dA and B → ɛ | |
+---+--------+------------------+---+
Now we have multiple entries for our table.
What is the correct way to build an LL(1) parsing table for this grammar?