search
Log In
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.
in Compiler Design 201 views

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

so C answer is right

Related questions

4 votes
1 answer
2
4.9k 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) .
asked Dec 27, 2016 in Compiler Design Kapil 4.9k views
1 vote
1 answer
3
6 votes
3 answers
4
4.4k views
Suppose we are given a grammar and asked to find the type of that grammar , what is the algorithm which needs to be followed for each of them? LL(1), OR LR(0) , OR CLR(1) OR LALR(1)
asked Nov 13, 2017 in Compiler Design Parshu gate 4.4k views
...