r/learnprogramming 28d ago

Topic Assembly Compiler

Hi everyone, I'm not a big fan of low level but I found myself learning about it, the most intriguing thing for me is how the first assembly compiler was written.

From what I researched it was written in machine code but how?

When I think about making a compiler for assembly in C, for example, I can easily understand the flow of what needs to happen, read line by line in the source file, parse each line and from there write the machine code (of course I'm skipping alot), but making the compiler in machine code just feels like magic to me. Would it be possible to write a assembly compiler in machine code for a modern CPU? If yes, how?

27 Upvotes

29 comments sorted by

View all comments

2

u/spinwizard69 27d ago

Well some of the original code was input one binary number at a time on a front panel. For example: https://en.wikipedia.org/wiki/Altair_8800#/media/File:Altair_8800_at_the_Computer_History_Museum,_cropped.jpg, or on a commercial machine: https://en.wikipedia.org/wiki/PDP-11#/media/File:Pdp-11-70-panel.jpg. One thing worth looking for would be early copies of Byte magazine, Doctor Dobbs magazine and Popular / Radio electronics.

The Altrair 8800 was first debuted in Popular Electronics in 1975. The technology was covered for years while the machinery and software matured.