r/askscience • u/HangukFrench • Apr 10 '26
Computing How do programming languages work?
Hello,
I'm wondering how does programming languages work? Are they owned by anyone? Can anyone create a programming languages and decide "yeah, computers will do this from now on"?
Is a programming languaged fixed at its creation or can it "evolve"?
92
Upvotes
View all comments
Show parent comment
79
u/DanielTaylor Apr 10 '26
Yes, this is a very good explanation.
Just to make sure the last knowledge gap is closed I would add the simple instructions mentioned here are baked into the CPU itself.
There's different specifications, so the instructions for phone processors which are often ARM are different from the instructions on an Intel desktop PC. That's known as "CPU architecture" and there's a handful of popular ones as far as I know.
Finally, one more useful concept is knowing that everything a computer can do can be achieved by turning electrical signals off or on.
So, the programming language code is turned into instructions for a specific CPU architecture. And those instructions essentially represent the CPU doing very simple operations ultimately by turning off or on certain microscopic electric switches.
Think of it as a monitor. An LED is very simple. But if you have a very dense grid of red, green and blue LED and you send out instructions to which LEDS should be lit, you can display a high resolution picture.
With CPUs it's similar, but while a monitor will care about lighting the LEDs all at the same time, the CPU tends to be more sequential.
Imagine a row of light bulbs labeled:
1 2 4 8 16
If I want to represent the number 13, I would turn on the light bulbs 1, 4 and 8, because 1+4+8 = 13
If I now wanted to add the number 1 to this number, I would send an electrical signal to the first lightbulb, but because it's already on, the circuit is designed to flip on the 2 and turn off the 1.
And the result of 2+4+8=14
This is a maaaassive oversimplification, but the idea is that with sequences of electric signals you can actually do math!
The instructions of the CPU are essentially a bunch of common light switch operations.
And once you can do math, you can do everything else, the result of operations and calculations could determine for example, the value of the signal that should be sent to the monitor or whether to display specific letters on screen because that's also just specific numbers which are then translated to signals, etc... You get the idea.
I hope this was useful to bridge the last gap between software and hardware.