nonterminal following a '•' have to be recursively included into the item set until all of those nonterminals are dealt with. The resulting item set is called the closure of the item set we began with. For LR(1) for each production rule an item has to be included for each possible lookahead terminal following the rule. For more complex languages this usually results in very large item sets, which is the reason for the large memory requirements of LR(1) parsers. In our example, the starting symbol requires the nonterminal 'E' which in turn requires 'T', thus all production rules will appear in item set 0. At first, we ignore the problem of finding the lookaheads and just look at the case of an LR(0), whose items do not contain lookahead terminals. So the item set 0 (without lookaheads) will look like this: [S → • E] [E → • T] [E → • ( E )] [T → • n] [T → • + T] [T → • T + n] FIRST and FOLLOW sets To determine lookahead terminals, so-called FIRST and FOLLOW sets are used. FIRST(A) is the set of terminals which can appear as the first element of any chain of rules matching nonterminal A. FOLLOW(I) of an Item I [A → α • B β, x] is the set of terminals that can appear immediately after nonterminal B, where α, β are arbitrary symbol strings, and x is an arbitrary lookahead terminal. FOLLOW(k,B) of an item set k and a nonterminal B is the union of the follow sets of all items in k where '•' is followed by B. The FIRST sets can be determined directly from the closures of all nonterminals in the language, while the FOLLOW sets are determined from the items under usage of the FIRST sets. In our example, as one can verify from the full list of item sets below, the first sets are: FIRST(S) = { n, '+', '(' } FIRST(E) = { n, '+', '(' } FIRST(T) = { n, '+' } Determining lookahead terminals Within item set 0 the follow sets can be found to be: FOLLOW(0,S) = { $ } FOLLOW(0,E) = { $, ')'} FOLLOW(0,T) = { $, '+', ')' } From this the full item set 0 for an LR(1) parser can be created, by creating for each item in the LR(0) item set one