Question 21
An LL(1) parser is a:
LL(1) stands for Left-to-right scan, Leftmost derivation, with 1 token lookahead (Top-down parsing).
An LL(1) parser is a:
LL(1) stands for Left-to-right scan, Leftmost derivation, with 1 token lookahead (Top-down parsing).
A Context-Free Grammar G is LL(1) if, for each pair of distinct alternatives A -> $\alpha$ and A -> $\beta$, which condition is required?
For LL(1) parsing, competing alternatives must have disjoint FIRST sets. If one alternative can derive $\epsilon, its use$ is selected from FOLLOW(A), so the other alternative's FIRST set must be disjoint from FOLLOW(A); the condition is symmetric.
Which class of context-free grammars cannot be parsed by ANY top-down predictive parser (including LL(1))?
Left-recursive rules cause top-down predictive parsers to enter an infinite loop during expansion, making left-recursion impossible for LL(1) parsing.
What parsing conflict occurs in an LR(0) item set containing both A -> alpha . a beta and B -> gamma .?
Item A -> alpha . a beta indicates a Shift action on input a, while B -> gamma . indicates a Reduce action. Presenting both in the same state causes a Shift-Reduce conflict.
What parsing conflict occurs in an LR(0) item set containing both A -> alpha . and B -> beta .?
When two completed production items A -> alpha . and B -> beta . exist in the same LR item set, the parser cannot decide which production to reduce by, creating a Reduce-Reduce conflict.