Home › GATE CSE › computerscience › Compiler Design › In an LL(1) language, the scanner produces token…
In an LL(1) language, the scanner produces tokens that the parser examines
Aone token, 1-token lookahead
Ball at once
Cbackwards (right to left)
Dwith infinite lookahead
Answer & Solution
Correct answer: A. one token, 1-token lookahead
1. LL(k) parser: Left-to-right scan, Leftmost derivation, with $k$ tokens of LOOKAHEAD.
2. LL(1) — the most common case — looks at the NEXT ONE token to decide which production to apply.
3. Tokens are produced ON DEMAND by the scanner: the parser asks 'give me the next token', the scanner consumes characters until it has one to return.
4. This streaming interaction is memory-efficient and matches modern compiler architecture.
5. Other options don't describe LL(1) parsing.
_Source: Bob Nystrom, "Crafting Interpreters", Ch 6.2 (Recursive Descent Parsing — overview)._
Related questions
The FOLLOW(A) set in LL parsing isThe FIRST(α) set of a string α in LL parsing isAfter the parser produces an AST, the next compiler phase is typicallyA SHIFT/REDUCE CONFLICT in an LR parser occurs whenWhich of these is a BOTTOM-UP (LR) parser feature?An LL(1) grammar requires that, given the leftmost non-terminal and ONE token of lookaheadLL parsers (recursive descent) parse from thePANIC MODE error recovery in a parser works by