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 (β)
- A.
I and II
- B.
I and III
- C.
II and III
- 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
First (alpha) and First (beta) must be disjoint if none of alpha and beta contains NULL move.
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).