A grammar G is LL(1) if and only if which of the following conditions hold for every pair of distinct…
A context-free grammar is LL(1) if and only if for every pair of distinct productions \(A \to \alpha \mid \beta\), all three conditions hold: (I) \(\alpha\) and \(\beta\) do…
Choose your answer
A grammar G is LL(1) if and only if which of the following conditions hold for every pair of distinct productions A → α | β?
I. a ∉ First(α) ∩ First(β) for any terminal symbol a of the grammar.
II. λ ∉ First(α) ∩ First(β).
III. First(α) ∩ Follow(A) = φ if λ ∈ First(β) (and First(β) ∩ Follow(A) = φ if λ ∈ First(α)).
Answer and explanation
Correct answer D
A context-free grammar is LL(1) if and only if for every pair of distinct productions , all three conditions hold: (I) and do not derive strings beginning with the same terminal symbol , (II) at most one of and can derive the empty string , and (III) if one alternative derives , the First set of the other alternative is disjoint from . Therefore, all of I, II and III are required.
Practice for these exams
-
RPSC Assistant Professor (College Education)
-
UGC NET Computer Science and Applications