
110 Compilers – Principles and Practice
q
p
r
i
j
A
b
a
1
, a
2
…
next
nex
A
α
→
α
εε
4.3.11 Look-ahead (LA) Sets
For all LR(k) type parser construction, LR(0) is a good starting point. Each inadequate state q
in the LR(0) finite-state machine for the grammar requires some look-ahead information for its
resolution. Note that for any state with conflict, there should be at least one reduce operation
associated with that state.
To find the look-ahead (LA) sets
Here, δα accesses the state q means that beginning with the start state of the FSM, scanning of the
string δα will put the machine in state q.
Assuming that LR(0) item sets are already computed, we define ...