Intrigued by a strange question (how to produce a [La]TeX representation of a Texinfo source file, under the assumption that the Texinfo source file would yield somehow a lower level document in "pure" TeX [presumably \ { } notation] macros), I wonder now how could I redirect the byproduct of macro expansion in TeX's gullet to, say, stdout or console or a text file, before it is fed to the typesetter (the "stomach"). I do not think anything in the \tracing* family of debugging control sequences does that job, as I'd like to see the actual stream of tokens.
I guess I could do that with some arcane LuaTeX callback, but I wonder if a dirty dekTeX macro (with \immediate\write or something like that) would do the trick.
For instance: if we feed pdfinitex with the following minimal input
\pdfoutput 1
\font\myfont ptmr8y
\myfont
Hi!
\end
we may produce a very minimal PDF file (with some errors). I assume these tokens go straight into the typesetter guts, as there are no macros, to produce the PDF output.
If, on the contrary, we run pdftex with the Plain format (loading, presumably, the etex.src macros) with the following input
Hi!
\bye
I conjecture the typesetter shall be fed with at least the following tokens:
\pdfoutput 1
\font\tenrm=cmr10
\tenrm
Hi!
\par \vfill \par \penalty -\@MM \end
How to show (on console, in aux file, anything...) the exact stream of tokens?
Perhaps dekTeX (and derivatives) can't do it; but LuaTeX may have some way.
Hi!\byeprocessed withpdftex, the instructions\pdfoutput=1and\font\tenrm=cmr10 \tenrmare not executed: they're already stored in memory when TeX starts up and loads the specified format,plain.fmtin this case. And much more than expanding\byeis done, because the output routine enters into action and several macros are expanded as a consequence. – egreg Feb 06 '22 at 14:45\dumpwas executed. The internal register for\pdfoutputalready has the value 1, no need to set it again. – egreg Feb 06 '22 at 17:10\byeindeed expands to much more things, like the output routine. That's why I said »at least« o_- – jarnosc Feb 06 '22 at 17:13