Word order in programming and human languages

In linguistics human languages can be classified by word order, and interestingly enough, a similar pattern can be seen in programming languages.

The clearly most popular word orders are subject-verb-object and subject-object-verb, and notably subject-verb-object languages include Mandarin, Spanish and English which is the three languages with most native speakers. There are also some language with verb-subject-object order, and very few with v-o-s, o-v-s, or o-s-v word order.

Looking at programming language there is a similare structure:

  • verb-subject-object structure are common with functional programming, and procedural programming. Lisp takes this to an extreme, where everything is prefix-operators (print (+ 1 (* 2 3)), but function application in most languages are written in this form (ie. in C snprintf(target, strlen(blah), "content"); every function-calls(verbs) are followed by the subject and objects, – not the case for infix-operators though which has the form subject-verb-object) .
  • subject-verb-object are popular with object oriented languages, ie. turtle.forward(10); list.append("hello"); clearly has this format, and is also the case with infix operators such as +,* etc. in most programming languages, independet of paradigm.
  • object-subject-verb is much more rare, but occurs in stack oriented languages like FORTH, PostScript, etc. 1 2 + and "Hello World" PRINT.

This might extend explain to some extend why functional, and stack-based language, feels difficult to some people, – as the sentence structure that you are expressing yourself in, is most likely different from your natural language.

When making new (programming) languages, this can also be worth remembering when deciding on the syntax.