I found the following question

Let G be a grammar with the following productions:
If $LR(1)$ parser is used to construct the $DFA$ using the above productions, how many look-aheads are present for the item $T→.T∗F$ in the initial state?

Now, what I have been doing so far, which I learnt from Ullman, is to add ahead $x$ in production $A->B$ is $x \in first(\beta)$ of $S->\alpha.B \beta \ [x]$. By doing that I get $\$$ to be the only lookahead for the given production but answer given is $T→.T∗F. \{$,+,∗,−}⇒4 $

Am I missing something? How can it be wrong? What's correct way to solve this?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.