Sorry to sidetrack, but I'm also interested in implementing a Tex engine (in another language though). Any suggestions on how to learn how an engine works?
TeX's source code is available in a "literate" format, so you can download tex.web, run weave tex.web, and then pdftex tex.tex. This will produce a large book with the TeX source code. A challenge is that the resulting TeX engine won't support LaTeX3, so you'll need to use "changefiles" to modify tex.web to add epsilon-TeX and other updates.
[1] https://github.com/crlf0710/tectonic/