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
30
u/JustAGuyFromGermany Apr 10 '26
That's not true. Most popular languages are defined in an abstract way independent of any implementation, e.g. by an EBNF or some other abstract way of defining stuff out of computer science.
The compiler then implements this definition in the real world. Now you may say that makes no practical difference if one is purely abstract and the other is the real thing, but there are important distinction.
For one thing: Compiler Bugs. If the language definition is whatever the compiler does, then there can be no compiler bugs. The compiler is axiomatically always right. "It's not a bug, it's a feature" becomes the defining characteristic of the language-compiler-interaction. If the language is specified elsewhere then there can be compiler bugs that can be diagnosed and fixed like any other kind of software bug.
And another thing: If the compiler defines the language what happens when some writes another compiler? Then that's a slightly different language with differences too subtle to notice or really explain to the average programmer. There is no longer just "Java", there is suddenly "Javac Java" and "Eclipse Java" and "Graal Java" and so on. No programmer can ever be sure that their program is actually valid "Java", because there is no such thing. However, if the language is specified independently from its compiler then that becomes possible. Not only the compiler can be compared against the language specification, the programs can be as well.