Programming code tells the computer to do something, but what makes the code actually mean anything to the computer?

1.19K views

Programming code tells the computer to do something, but what makes the code actually mean anything to the computer?

In: Engineering

36 Answers

Anonymous 0 Comments

At the human end we have high level languages which are easy for us to understand and write but which need to be interpreted or compiled to machine code before the computer can run it. Interpreted languages are slower but more immediate meaning you can run them straight from the source code (classically BASIC, more recently Python) whereas compiled languages are faster but need to go through a compilation step to be turned into executable code.

The machine code is a sequence of instructions that the CPU understands and would typically be different for each type of CPU. For example, an Intel processor can’t run the same code as an ARM processor even though the source code can be the same and the compiler would turn that into binary machine code for the specific type of CPU. At the CPU level itself there is memory (registers) and instruction decoders which then execute the binary code.

A recent wrinkle would be the Java Virtual Machine where the Java source code is compiled into a special byte code that the JVM understands and then issues CPU specific code so while the Java source code is compiled, it is designed to be an intermediate which can run on the JVM and then you just need a JVM that is compiled for your specific CPU which means languages like Java and their ilk can produce code that runs almost as fast as natively compiled code but will run on any CPU that has their virtual machine.

You are viewing 1 out of 36 answers, click here to view all answers.