When a person designs something like a CPU, they very deliberately arrange all the transistors do do very specific things. You have those that are responsible for doing math, those that specifically read and write memory and so on. It gets super complicated, but enough said that for very specific inputs, the circuit will perform very specific operations.
How this physically operates is rather complicated, but it comes down to using transistors letting a signal through or not, which translates to a 1 or a 0. By arranging those transistors appropriately (into Logic Gates), you can design a circuit that puts them in a specific order based on an input. And 1s and 0s in a specific order are a number. So by shuffling them around in the circuit in a controlled way, you can do math.
Then the designers tell everyone exactly what those inputs and operations are.
So someone then designs a program to translate a human-readable programming language (what you see programmers using) into those inputs (machine code). That program is the Compiler.
Latest Answers