# List of tokens from TeX mouth

Is it possible to get list of tokens which comes from TeX "mouth"? If I understand correctly: in mouth all macros, conditionals and special operations (like \the and \input) are expanded and then goes to "stomach".

-
I think this two links are related: All LaTeX commands list and this looks like what you want: TeX Primitive Control Sequences. –  m0nhawk Mar 25 '13 at 18:35

As far as I understand, Knuth didn't use formal language techniques to parse TeX, just ad-hoc methods. I doubt such a list exists formally (just a few dozen scattered facts in his brain some years back...), I'm afraid to get it you'd have to get a fine comb, much patience, and a copy ot TeX's source.

(I'd like to be proven wrong, though.)

-
You don't need the tex source to understand TeX's parser (although it is available of course) The grammar of every TeX command is given in the TeXBook. –  David Carlisle Mar 25 '13 at 18:43

The question is rather under specified. TeX's macro processor is not like (say) the C pre-processor where all macro expansion happens first and then an expanded source is passed to the compiler. In TeX macros are just expanded as needed and are interleaved with non-expandable assignments, which can change the result of future macro expansion.

So it is not possible to take a latex document and expand it out to just consist of TeX primitives.

It is possible to force the expansion of the following token until the next token is non expandable, so that you may then inspect that non-expandable token, but perhaps that isn't what you want.

-