The structure is defined using the begin and stack data fields of a given token. The begin points to the index of the current token's parent and the stack describes the structure contained by that parent. Items in the global space have no parent, so I assign a begin value of -1 and stack value of global. I use -1 because there is no such index in an array.