Tex-Core – Understanding the Concept of TeX’s Gullet

bookstex-core

Chapter 7 of The TeXbook famously talks of TeX as having 'eyes', 'mouth' and 'stomach' and goes on to talk of TeX's 'digestive processes' and keeps reusing these terms.

Chapter 8 introduces talk of TeX's 'gullet', apparently a reference back to this extended metaphor, without further explanation. The term sees use in other works: is there an accepted definition for the term?

Best Answer

The terminology isn't that useful really but as far as I can make out.

The mouth is where tokens get recognised so abc becomes three character tokens, and \abc becomes one control token

Unexpandable tokens are handled in the stomach so the gullet is basically the expansion process.

The texbook only uses gullet twice (and tex.web not at all):

expandable tokens are converted to unexpandable ones in TeX's ''gullet'' by a process similar to regurgitation.

and

What would be wrong with

 \def\%{\char`%}

? The % would be treated as a comment character, because its category code is 14; thus, no % token or } token would get through to the gullet of TeX where numbers are treated.

So as well as macros being replaced by their replacement text, the two tokens `a being interpreted as a number (the character code of a) is also being seen as a gullet process. Conversely \char itself is stomach.