First of all, as a native German speaker, I apologise for my incorrect use of the English language.
After thinking about some different languages and wandering astray on this exact Stack Exchange, I began to notice similarities between natural languages and programming languages:
- Both languages strongly distinguish between syntax and semantics.
- Both of them serve the purpose of communication to explain what something is or what is to be done.
- Both types of languages have a base composition
If we imagine the human mind as a very advanced compiler for all the natural languages, then we can see that:
book
, Buch
and something along the lines of
ADT Book
{
variables
title;
pageCount;
publicationDate;
content;
rating;
...
functions
read;
rate;
...
}
all describe one and the same thing: a book, or specifically an object with a title and so on. It might seem like the definition of a book is much more complicated in a programming language rather than a natural language but what we forget is that for our human-compiler-mind book
is a shortcut for an object with the specific properties as described in the ADT.
Now one could object that the two types react differently to syntax errors, because a syntax error in typing (teh
) is still correctly recognised as the
whereas a missing semicolon will cause a compile error in programming languages. What we forget however is that this implicit correction of syntax is just a "feature" of the human-compiler-mind because it is already about 200000 years old and has evolved a great deal.
Another noteworthy objection is that while a programming language is designed by us humans, the origin of natural languages is unknown although theories exist. Based on these theories, one can assume that the natural languages have evolved from some kind of pre-lingustic forms of communication, just like the programming languages have evolved from someone soldering something on a board to writing code on machines running with those soldered boards.
Now regarding everything I have tried to say, my questions are: Are there really any differences between natural and programming languages? If yes, which ones are there and how big of a difference do they make?
Links used:
Programming and natural languages, Alex Chen, September 16, 2004
Natural vs Programming Languages, Rajesh Kumar, December 22, 2012
Artificial Language vs. Natural Language, Cornell University, Fall 1994
The Similarities and differences between languages and programming, Jeff Lau, December 29, 2012
the
andhte
and a class namedeht
. How would this "better compiler" know which one of these to correctteh
to? It turns out ambiguity is seldom trivial. Something similar has been tried in command line interpreters by the way, with catastrophic results. You can also look upDWIM
, a term in computing that stands for "do what I mean".