/    /  Compiler Design-Canonical collection of LR(0) items

Canonical collection of LR(0) items

 

A production with a dot at some position on the right-hand side of the production is called the LR (0) item.

 

Example: The possible LR (0) items for a production A → BCD

A → • BCD

A → B • CD

A → BC • D

A → BCD

And for the production A → ∈, LR (0) item

 

At any point of the parsing process, LR (0) item indicates how much portion of a production we have seen.

 

A collection of sets of LR (0) items is called Canonical LR(0) collection which is used in the construction of SLR functions closure and goto in order to construct canonical LR (0) collection for a grammar G. 

 

An augmented grammar G for a grammar G is G with a new start symbol s’ defined using production as S’ → S • 

The string is accepted by the parser if and only if the reduction S’ → S takes place.

 

 

Reference Link

Canonical collection of LR(0) items