Sunday, April 8, 2007

Comparing programming language to human language

There are two types of language: natural and artificial. Natural languages, in large part, are products of evolution — steps taken beyond non-verbal communication by many people. Artificial languages, like Esperanto and BASIC, are in greater part designed consciously by a small group of people. One type of artificial language is computer language. There are two types: those that specify processes and those that specify results. Those that specify a process are instructions (programs). There are two kinds of languages that specify results: those that specify a format (e.g., HTML), and those that something sought (e.g., SQL). But, it is not certain that these are languages. They differ from natural languages in terms of their users, their evolution, and their scope.

Who users are depends on the language. The word language is from the Latin lingua, originally meaning “tongue.” The majority of languages were originally forms of speaking. In contrast, computer languages are not spoken. Many believe that communication with inanimate objects is not language. But in reality, these languages do not even communicate with computers. They first need to be translated to binary code. Computers cannot understand anything besides zeros and ones. This is another problem with the use of this word.

Like natural languages, computer languages are always changing. Many have dialects. For example, FORTRAN has gone through seven major generations since its introduction in 1956. The most recent is almost completely different from the FORTRAN of 1956. To display a message in the FORTRAN of 1956, you typed, PRINT *, 'Lorem ipsum', but today, you type <tabwrite (*,*) 'Lorem ipsum'. The rate of change is much greater than in natural languages because computers are changing much faster. Still, no matter how much they change, the grammar that produces statements in programming is always clear.

The scope of languages differs. One might say that computer language is a type of sub-language because its scope is more limited. They are not nearly as complex as our own. Our languages describe the world, whereas theirs describe their own. The only more-confined language is mathematics. Nevertheless, if any of them were to be expanded, they would be very similar to certain other a priori artificial languages like Lojban.1 These can be used as natural languages, albeit with great difficulty.

In terms of their users, evolution, and scope, natural languages differ more than they resemble the language of computers. Computer languages are not languages much more than algebra. A more-appropriate name would be code, or as Edsger Dijkstra calls them, "notations."2

1. There are two types of artificial languages: a priori and a posteriori. A priori languages like Lojban and FORTRAN are based on logic. A posteriori languages like Esperanto and Interlingua are derived from natural languages.

2. Many thanks to Goulo for letting me know about Lojban and the writings of Edsger Dijkstra.

3 comments:

Fajro said...

Esperanto and Basic! xD

Esperanto
is more like Python! :P


Do you know Lojban?

Russ Williams said...

Edsger Dijkstra argued that "programming language" is an awful misleading phrase, and it would have been better to call them "notations" instead of "languages". I agree, the similarity between FORTRAN, C++, etc and English, Esperanto, etc is purely superficial. ("Hey, they both have syntax!" :)

As far as I know, Volapuk is inspired by natural languages, not logic. Lojban, however, is explicitly modelled on predicate logic.

Richard Maxwell said...

Hey guys. You make some good points! I didn't know about Lojban. I'll change "Volapük" to Lojban. I can also add a note about Dijkstra if you wouldn't mind, Goulo. I agree it is kind of hard to compare Esperanto to BASIC. :)