In pdftex or luatex the back end is built in to the program but in classic tex (or xetex) the tex program just produces a device independent representation from which pdf or text etc can be constructed, using separate driver programs without needing to extend the main tex executable. texlive comes with dvi2tty.
So for example the standard latex test document small2e
, pdflatex small2e
makes

and latex small2e; dvi2tty small2e
produces
1 Simple Text
Words are separated by one or more spaces. Paragraphs are separated by one
or more blank lines. The output is not affected by adding extra spaces or extra
blank lines to the input file.
Double quotes are typed like this: "quoted text". Single quotes are typed
like this: `single-quoted text'.
Long dashes are typed as three dash characters---like this.
Emphasized text is typed like this: this is emphasized. Bold text is typed
like this: this is bold.
1.1 A Warning or Two
If you get too much space after a mid-sentence period---abbreviations like etc.
are the common culprits)---then type a backslash followed by a space after the
period, as in this sentence.
Remember, don't type the 10 special characters (such as dollar sign and
backslash) except as directed! The following seven are printed by typing a
backslash in front of them: $ & # % _{ and }. The manual tells how to make
other symbols.
Note that this isn't just the raw text some attempt at indicating the layout is made, and line breaks match those in the pdf version.
dvi2tty
– David Carlisle Nov 22 '17 at 16:10