What happens inside yex#
This is what happens when you run yex on a TeΧ document:
Firstly, we create a Document object. This contains the system's state. It's passive: the other parts of the system act upon it.
Next, we create a parser. This reads the
.tex file off disk, and turns it into a series of tokens.
Inside the Document object, there is a set of controls, each of which maps to a handler. If the parser sees the names of any of these controls, it will run the handler and parse the results.
The Document object also contains a Mode object, which receives all the finished work from the parser. The Mode does all the work of putting the finished results into boxes, working out where those boxes should go on the page, and doing wordwrap. It stores all its results back into the Document.
Finally, an output driver writes the finished results to to a file of the correct format.