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 β }

  1. A.

    Both statements S₁ and S₂ are incorrect

  2. B.

    S₁ is incorrect and S₂ is correct

  3. C.

    S₁ is correct and S₂ is incorrect

  4. 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.

Explore the full course: Mppsc Assistant Professor