Exams › GATE › Technical
Which of the following statement(s) is/are TRUE while computing First and Follow during top down parsing by a compiler?
- For a production A → ε, ε will be added to First(A).
- If there is any input right end marker, it will be added to First(S), where S is the start symbol.
- For a production A → ε, ε will be added to Follow(A).
- If there is any input right end marker, it will be added to Follow(S), where S is the start symbol.
Correct answer: If there is any input right end marker, it will be added to Follow(S), where S is the start symbol.
Solution
The correct option is true because the Follow set of a non-terminal includes the end-of-input marker to indicate that the parsing can successfully complete when reaching the start symbol, allowing the parser to recognize the end of the input.
Related GATE Technical questions
⚔️ Practice GATE Technical free + battle 1v1 →