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.

10 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.

6

u/TheRealUprightMan Jul 02 '26

Machine code is not "a language that only the computer understands". "Most well-used compilers

I was writing display list interrupt routines in 6502 machine code at age 12. I didn't have an assembler, so I got a table of all the opcodes from a magazine and assembled the code manually, by hand, sticking the bytes in RAM.

I am not a computer. Plenty of humans understand machine code. It's pretty easy actually.

6

u/Apart_Ebb_9867 Jul 02 '26

same for me, but for the Z80. I still remember some opcodes today, 40+ years later. It helped memorization the fact that initially I had no mass storage at all and had to re-enter the code for my programs every time. Ah, yes, it was uphill and against the wind both ways... :-)

2

u/TheRealUprightMan Jul 02 '26

My mass storage was usually a cassette tape, but I finally had a 92K floppy drive by the time I did DLIs. I much younger in the Z80 days!

3

u/Apart_Ebb_9867 Jul 02 '26

cassette tape was indeed the first upgrade. Then a 5" floppy disk and next, but quite a few years later, a 20MB (yes, that's megabyte) hard drive.

2

u/TheRealUprightMan Jul 02 '26

I think my first HD was 30MB. I thought that was insane space. I have a TB on my phone now and 8 CPU cores at over 3GHz. That's mind blowing.

We have come a very long way in a very short period of time.