I am confused about how epsilon works in parsing tables (or my book is wrong)?

145 Views Asked by At

So I'm reading my lecture notes and something really confuses me:

enter image description here

Shouldn't the [Y,+] entry produce an error as there is no possible way you can get the string '+' from Y? Why then does it say it produces an epsilon? Is this a mistake?

1

There are 1 best solutions below

0
On

This $Y→^*T|\in$ has two production one is $Y→^*T$ and second is $Y→\in$.

$^*T$ will be in $[Y, *]$ in $LL(1)$ parsing table and $\in$ will be in all place $Follow(Y)$, as you know the rule of $LL(1)$ parsing table for any such production $Y→\in$.

So, from given grammar, we have :

$Follow(Y)=Follow(T)=First(X)=\{+, Follow(E)\}=\{+, ), \$\}$

Therefore, why terminal $\in$ is present in place of $\{+, ), \$\}$ for the non-terminal $Y$.