Which is the correct statement(s) for Non-Recursive predictive parser? S₁:…
2013
Which is the correct statement(s) for Non-Recursive predictive parser?
S₁: FIRST(α) = { t | α ⇒* tβ for some string β }
S₂: FOLLOW(X) = { a | S ⇒* αXaβ for some strings α and β }
- A.
Both statements S₁ and S₂ are incorrect
- B.
S₁ is incorrect and S₂ is correct
- C.
S₁ is correct and S₂ is incorrect
- D.
Both statements S₁ and S₂ are correct
Attempted by 67 students.
Show answer & explanation
Correct answer: D
The correct answer is Option D: Both statements S₁ and S₂ are correct.
S₁:
FIRST(α) = { t | α ⇒* tβ for some string β }
This is the correct definition of FIRST set. It contains all terminals that can appear first in strings derived from α.
S₂:
FOLLOW(X) = { a | S ⇒* αXaβ for some strings α and β }
This is the correct definition of FOLLOW set. It contains all terminals that can appear immediately to the right of non-terminal X.
Hence, both statements are correct.
Therefore, the correct answer is Option D.
A video solution is available for this question — log in and enroll to watch it.