LL(1) Parsing

1 vote
201 views

To compute FOLLOW(A) for any grammar symbol A

a) We must compute FIRST of some grammar symbols.

b) No need of computing FIRST of some symbols.

c) Maybe compute FIRST of some symbols.

d) None of the above.

The answer is given as option (A) but if we take start symbol(say S), we know that $will definitely in FOLLOW(S) and we didn't computed FIRST of any symbol for it. So option (C) should be the answer. 1 Answer 1 vote lets take a grammer S->a so to compute follow of S no need to compute the first of any symbol because follow of S is$ and S is not present anywhere in the right side

now take another geammer S->SA/a , A->b  so now to compute follow of S we have to compute the first of A

Related questions

1
1.2k views
Consider a Grammar G as follows : $S\rightarrow W$ $W \rightarrow ZXY / XY$ $Y\rightarrow c/\epsilon$ $Z\rightarrow a/d$ $X\rightarrow Xb/\epsilon$ Draw the LL(1) parsing table for the given grammar ? NOTE :- The above grammar is NOT LL(1) .