Algebra of the LR lookahead buffer #
These lemmas isolate the finite-control arithmetic used by the marked-input
machine. They state that a refill implements exactly one logical shift of
observe, including the final no-refill phase after the marker has entered the
buffer.
Appending the next unread physical symbol after shifting the observed head produces the observation of the remaining logical input.
If EOF is already visible at the back of the buffer, no physical refill is needed: padding with EOF still implements the same logical shift.
Physical input still unread after preloading a k-symbol observation.
If the word is shorter than the buffer, its marker has already been consumed;
otherwise the suffix is embedded and followed by the fresh marker.
Equations
Instances For
While the old buffer still ends in a real terminal, the unread marked
input has a head. Reading that head is exactly the refill required by
shiftBuffer, and its tail is the unread input for the logical suffix.