Computer Sciences > GATE 2025 SET-1 > Parsing
Which of the following statement(s) is/are TRUE while computing First and Follow during top down parsing by a compiler?
A
For a production A→ε, ε will be added to First.
B
If there is any input right end marker, it will be added to First(S), where S is the start symbol.
C
For a production A→ε, ε will be added to Follow(A).
D
If there is any input right end marker, it will be added to Follow(S), where S is the start symbol.

Correct : a

Statement A: For a production A→ε, ε will be added to First(A) — This is TRUE. The First set of a non-terminal A includes ε if A can derive the empty string directly.

Statement B: If there is any input right end marker, it will be added to First(S), where S is the start symbol — This is FALSE. The end marker ($) is never added to the First set of any symbol. First sets contain only terminals that can begin strings derived from that symbol.

Statement C: For a production A→ε, ε will be added to Follow(A) — This is FALSE. The fact that A can produce ε does not mean ε is added to Follow(A). Follow sets contain terminals that can appear immediately after a non-terminal, not ε itself.

Statement D: If there is any input right end marker, it will be added to Follow(S), where S is the start symbol — This is TRUE. The end marker ($) is always added to Follow(S) for the start symbol S, indicating the end of input.

✅ Final Answer: Statements A and D are TRUE.

Reason: First sets include ε for productions that derive empty strings, and Follow sets for the start symbol always include the end marker ($). However, end markers are never in First sets, and ε is never in Follow sets.

Similar Questions

Which one of the following is True at any valid state in shift-reduce parsing?
#76 MCQ
Which of the following statements about the parser is/are correct? I. Canonical LR is more powerful than SLR. II. SLR is more powerful than LALR. III. SLR is...
#161 MCQ
Consider the augmented grammar given below: S′ → S S → ⏐id L → L, S⏐S Let I0= CLOSURE ({[S′ → S]}). The number of items in the set GOTO (I0,
#620 Fill in the Blanks

Related Topics

top down parsing First and Follow sets GATE Computer Science 2025 compiler design gate production rules parser right end marker start symbol follow set computer science gate questions

Unique Visitor Count

Total Unique Visitors

Loading......