I'd like to try to create a document structure and table of contents in pure TeX. Does anyone know of any resources or examples to do this? My purpose is mainly educational, to learn how to write macros and structure documents in pure TeX.
I know how to define basic commands using
\def, and I've written documents in plain TeX but I don't understand enough about programming in TeX to feel able to tackle a big task like this.