The first big computers did not execute code from storage as we see it today, the very early ones were “hard wired” meaning that the hardware was wired to do only one thing, no code required, you program it by connecting relays together in specific ways. Later ones used long strips of cardboard with holes in them that would get fed through a reader. The presence of a hole in the punch card will be detected by the reader and will cause the computer to do something. These were also limited in what they could do. For instance, you could have a computer that can do nothing but solve equation systems and is hard wired to do that, you can then use the punch cards to feed it the numbers you want it to solve.
Newer processors execute something we call “assembly code” which is sort of a modern version of the punch cards. They are small and simple operations such as add 2 numbers together, compare 2 numbers to see which is bigger, take this number and add 1 to it, go to this particular spot in the code, etc…
Code like python or c++ isnt really executed by the cpu, it’s a human readable/understandable translation for assembly code, what a compiler does is take the code text and convert it to assembly code which is directly executable by the cpu but quite difficult to write. For instance, to make the computer do something simple like “if a > b then b = b +1” in assembly would require many lines of code that can’t be understood by just glancing at it quickly like a python program would be. Assembly programs end up having a loooooot of small detailed lines instead of less more concise one
What happened is that people figured out easier ways for humans to tell computers what they want it to do such as the languages we all know and love today. They then wrote compilers in assembly code that can take those new languages and translate them to assembly which allows for the complex programs we see today
Latest Answers