The UnpackGrammarLine() function and its subordinate functions read the grammar table, which is generated by the I6 compiler. The grammar table’s structure is described in inform-fiction.org/source/tm/chapter8.txt (section 8.6).
Note that modern games always use the “GV2” option. Also, in Glulx, the format is slightly different (see eblong.com/zarf/glulx/technical.txt).
So the line in AnalyseToken takes apart the token-type byte (as described in the first link). found_ttype winds up as 2 for a fixed word, 4 for an attribute filter (usually “animate”), 3 for a grammar token, 5 for a grammar token, 6 for a general parsing routine.
The PrepositionChain routine is going through a list of fixed word alternatives (e.g. “in”/“on”/“into”/“onto”). These are marked by the “next two bits” (as described in the first link).
My guess is that 6222 must be the preposition token, and is the address to the dictionary word ‘to’?
I still don’t really understand what 66 represents, but it did show up in the AnalyseTokens routine debug output as the second token. But it’s always 66, even when topic is ‘hello’ instead of ‘hi’.
The “token” argument of AnalyseToken is the address of the grammar token. (token->0) is a packed field of three values.
Have you looked at the Inform Technical Manual page? The 66 breaks down into 01 / 00 / 0010 (binary). The third field is type 2, meaning preposition; the second indicates that it’s a single preposition rather than a list of alternatives; the first field is not used in parsing. The preposition word address is the two (or four) bytes after the 66 byte; it winds up in found_tdata.
The top two bits indicate that found_tdata is a dictionary word address. The bottom four bits indicate that it is a preposition. A preposition always has a dict word in found_tdata, so the parser doesn’t really have to look at the top two bits (and it doesn’t).
I re-wrote that parser in Inform 7 under the extension “Original Parser”, which might help you understand how it works, being that Inform 7 is rather English-like. It’s on the Inform 7 extensions page.
but yeah, zarf is right: bitfields and bitwise ANDing.