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


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

  • 1
    @ColinFine What about defining a class? The name of a class surely gives it a meaning because it defines functions and variables for a specific name so it has a meaning now
    – ThreeFx
    Jul 20, 2014 at 13:18
  • 3
    It's the same difference as between worms and pitchforks. One is evolved, the other's engineered. They both do similar things in one context, but they are otherwise wildly different in nature, structure, and use. Think of English, if you like, as a programming language with 200,000 reserved words, each of which has its own usage syntax and requirements. Not really a helpful metaphor.
    – jlawler
    Jul 20, 2014 at 15:16
  • 2
    @ThreeFx: No it can't. Imagine the language has keywords the and hte and a class named eht. How would this "better compiler" know which one of these to correct teh 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 up DWIM, a term in computing that stands for "do what I mean". Jul 20, 2014 at 22:49
  • 1
    I think this question is too broad. There are far more differences between natural and programming languages than similarities.
    – curiousdannii
    Jul 21, 2014 at 1:20
  • 2
    Any difference between chalk and cheese? As an experiment try translating your question to a programming language of your choice. Jul 21, 2014 at 12:30

2 Answers 2


All three of your assumptions about natural languages are questionable. They describe models used by linguists very many of which have been inspired by computer-like algorithms not language itself:

  1. Natural language does not "strongly distinguish between syntax and semantics". In fact, they are very closely interlinked. Syntactic constructions are used to express all kinds of meanings.

  2. Natural language is used to communicate much more than "to explain what something is or what is to be done". It's not even clear that communicating that kind of information is what language evolved to do (see e.g. Dunbar's thesis). Nevertheless, focusing on the kind of semantics that can be expressed by a programming language is what has been keeping the developments in semantics back.

  3. Natural and programming languages are compositional in very different ways. While you can define all the compositional rules in a programming language, a natural language is much freer - which is what makes language change possible. It also makes the expressive potential of a natural language significantly larger than that of a programming language. There's no irony in a programming language (that's not to say that programmers cannot express puns or even parody each other's code - but they're communicating those to other humans, not the computer).

In summary, while the language as computer code metaphor has some limited aptness and utility, it is more misleading than useful. Most linguists will have long rejected it if they ever maintained the mapping. If natural and programming languages were even a little alike, we would have working algorithm-based parsers and full-blown AI, already. But natural languages are not algorithmic at all. Understanding and speaking them is more akin to pattern recognition than feature analysis.

What I think is a much more interesting subject for research (and greatly understudied) is the rich and complex ways in which programmers use programming languages to communicate with the computer and each other. In that, programming languages are much more like natural language. For instance, we could find parallels of dialects, accents, and registers in programmer communities. We will find eloquent programmers and those who struggle to get their meaning out there. Not understanding the complexity, often leads people to erroneous statements that one can learn to code in a day. But it is no truer to say that memorizing and German dictionary and learning the rules of German syntax will make you 'speak German' than to say that learning all the rules of C will enable you to write a computer program.

  • I've been programming for 34 years and have never communicated with a computer or communicated with another programmer in a programming language. Jul 21, 2014 at 12:32
  • Surely, you've left comments in your code. And surely you've observed coding standards to make sure that someone reviewing your code understands it and/or thinks of you as a member of the community. Those are forms of communication. Jul 21, 2014 at 17:19
  • 2
    My comments are in English and are not part of the code. Comments are not compiled. Machine code has no comments. You cannot write a program or script using just comments. The code and the comments have no equivalence. The comments do not have to match the code or be in a human language or make sense or tell the truth. Jul 22, 2014 at 0:25
  • Comments are certainly part of the language spec and the compiler interprets them as blobs of data to not interpret (just like anything in quotes in print('Some text') - but some text is part of the software code, just not the interpreted part). So I think you can't just ignore them - although they were not central my argument. The design of programming languages is a complex interchange between human and machine-oriented intentionality. Which is why I think it's worth a study. I wasn't making any deeper points about people having routine conversations in code. Jul 22, 2014 at 6:40
  • Well there's a pretty big "any difference" right there. Neither people nor computers can have routine or nonroutine conversations in code. Computers can't have conversations at all. The only similarities are extremely shallow, such as potentially being describable in terms of some kind of recursive grammar. Everything else is totally dissimilar, yet people seem to keep inferring there's something deeper. Jul 22, 2014 at 8:43

An integration of a 'formalized' subset of natural languages and programming languages should be possible. Don't start with a full natural language.

In the programming language Python 'everything is an object', whereas there are a few standard objects. I think there are good reasons to extent programming languages, such as Python, with formalized natural languages by adding more standard objects. It would improve interoperability and save time when standard objects would be added that represents the concepts. As a first proposal for example: person, organization, and ISO standardized concepts such as countries, currencies, unit of measure, etc. For each formalized natural language a dictionary could be added with the name(s) and synonym names in that language that refer to the identifier of the object in the programming language. For each name a given language community could be added to enable and distinguish homonyms. Also standard kinds of binary relation could be added, such 'is a kind of' and 'is classified as a' (to represent instantiations). The Gellish family of formalized languages might be used to provide ideas.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.