Constructing LR (0) Parsing Tables

Jiang Wenhong

Associate Professor

Department of Computer Engineering BJTU

Aims

2

In this unit, we will take the example grammar from the previous unit and show how we can generate the Action and Goto tables that the LR (0) parsing algorithm requires.

Conception of Items

3

o The construction of these parsing tables is based on the notion of

LR (0) item (or configuration) which are grammar rules with a

special dot added somewhere in the RHS

E →• E + B

E →E • + B

E →E + • B

E →E + B •

The rule E →E+B has the four corresponding items above

⮚An exception are rules of the form E →ε with which only the