Chapter 4: Syntax Analysis

Closure(I)

repeat

for each item [A α .B ß , a] in I

for each production B γ in G'

and for each terminal b in First( ß a)

add item [B . γ , b] to I

until no more additions to I

To find closure for Canonical LR parsers:

Repeat

for each item [A α .B ß , a] in I

for each production B γ in G'

and for each terminal b in First( ß a)

add item [B . γ , b] to I

until no more items can be added to I