Chapter 4: Syntax Analysis

LR(0) items

. An LR(0) item of a grammar G is a production of G with a special symbol "." at some position of the right side

. Thus production A XYZ gives four LR(0) items

A .XYZ

A X.YZ

A XY.Z

A XYZ.

. An item indicates how much of a production has been seen at a point in the process of parsing

- Symbols on the left of "." are already on the stacks

- Symbols on the right of "." are expected in the input

An LR(0) item represents a production in such a way, that you keep track of the input already read (i.e., present on the stack) and the input yet to be expected. Consider a typical example A Y.XZ , here the special symbol " . " means that the expression to the left of it (i.e., Y ) is present on the stack, while the one of its right is yet expected to complete this production.