Consider the standard algorithms for computing FIRST and FOLLOW sets of a CFG.…

Consider the standard algorithms for computing FIRST and FOLLOW sets of a CFG. 

Which of the following statements is/are correct?

  1. A.

    For a production A→αBA, FOLLOW(A) is always a subset of FOLLOW(B).

  2. B.

    FIRST and FOLLOW computation always terminates, but the presence of left recursion or indirect recursion may cause infinite loops unless handled carefully by marking visited symbols.

  3. C.

    If two nonterminals A and B have FIRST(A) ∩ FIRST(B) ≠ ∅, then the grammar cannot be LL(1), but it may still be LR(1).

  4. D.

    FOLLOW sets may have circular dependencies, but since they grow monotonically and are bounded, computation always terminates.

Attempted by 20 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…