Chapter 4: Syntax Analysis

Goto operation

. Goto(I,X) , where I is a set of items and X is a grammar symbol,

- is closure of set of item A α X. ß

- such that A α .X ß is in I

. Intuitively if I is a set of items for some valid prefix a then goto(I,X) is set of valid items for prefix α X

. If I is { E' E. , E E. + T } then goto(I,+) is

E E + .T

T .T * F

T .F

F .(E)

F .id

The second useful function is Goto(I,X) where I is a set of items and X is a grammar symbol. Goto(I,X) is defined to be the closure of the set of all items [ A a X. ß ] such that [ A a .X ß ] is in I. Intuitively, if I is set of items that are valid for some viable prefix a , then goto(I,X) is set of items that are valid for the viable prefix a X. Consider the following example: If I is the set of two items { E ' E. , E E. + T }, then goto(I,+) consists of

E E + .T

T .T * F

T .F

F .(E)

F .id

We computed goto(I,+) by examining I for items with + immediately to the right of the dot. E' E. is not such an item, but E E. + T is. We moved the dot over the + to get {E E + .T} and the took the closure of this set.