A grammar G is LL(1) if and only if the following conditions hold for two…

2014

A grammar G is LL(1) if and only if the following conditions hold for two distinct productions A → α | β

I. First (α) ∩ First (β) ≠ {a} where a is some terminal symbol of the grammar.

II. First (α) ∩ First (β) ≠ λ

III. First (α) ∩ Follow (A) = φ if λ ∈ First (β)

  1. A.

    I and II

  2. B.

    I and III

  3. C.

    II and III

  4. D.

    I, II and III

Attempted by 159 students.

Show answer & explanation

Correct answer: D

A grammar G is LL(1) if and only if the following conditions hold for two distinct productions:

A to alpha mid beta

  1. First (alpha) and First (beta) must be disjoint if none of alpha and beta contains NULL move.

  2. At most one of the strings $\alpha$ or $\beta$ can drive NULL move i.e. alpha to NULL (since First (alpha) and First (beta) are disjoint). In this case, First (beta) and Follow(A) must be disjoint.

    Hence the answer is option(D).

Explore the full course: Mppsc Assistant Professor