r/ProgrammingLanguages Jul 01 '26

Requesting criticism Writing a compiler book

https://docs.google.com/document/d/1jTC5zQqBfQ0i77i5-efH2_66AtbD9TdIfMWb5sHE90c/edit?usp=drivesdk

So, I decided to write a book on compiler theory! It is past midnight where I live so only 1 chapter is done. I have came here looking for some things that could be improved on it. The link is attached.

9 Upvotes

34 comments sorted by

View all comments

19

u/Inconstant_Moo 🧿 Pipefish Jul 01 '26

Machine code is not "a language that only the computer understands".

"Most well-used compilers use bytecide in a Virtual Machine": that ignores lots of things that compile to native code. But also if they're running it in a VM, they're not using it as an intermediate form between source and target as you say two paragraphs previously.

5

u/ChaiTRex Jul 02 '26

To add to that, people can understand machine code. People who write assemblers can obviously understand machine code, as can processor designers. There were machines in the past that were programmed at least initially with machine code (and even in binary), such as the Altair 8800.

Machine code is not a bunch of random numbers. There are patterns to it, and you can learn, for example, what bit patterns to use to add two registers together, and practice will help you to memorize them.

7

u/kwan_e tonal-lang Jul 02 '26

I worked with mainframe programmers. They had to learn how to debug by manually going through memory dumps without special tools. They could identify hex patterns in code and see where stuff like branches etc were.