19

Would it be correct to say that the majority of computer programming languages (such as functional or procedural) are the form of constructed languages? If so, what makes it a constructed language in this case?

Let say a "Hello, World!" program as the example.

Hello World! by Brian Kernighan, from Artsy's Algorythm Auction based on a 1978 Bell Laboratories internal memorandum by Brian Kernighan, Programming in C: A Tutorial, which contains the first known version. 2 lines of C Code

Hello World! by Brian Kernighan, from Artsy's Algorythm Auction based on a 1978 Bell Laboratories internal memorandum by Brian Kernighan, Programming in C: A Tutorial, which contains the first known version. 2 lines of C Code. - Wikipedia

12
  • 3
    People consider Lojban a conlang, so why not? </snark> :P
    – Doorknob
    Commented Feb 8, 2018 at 13:24
  • 1
    Yep, 'Constructs in programming languages have been shown to be translated to Lojban'. Source: Wiki
    – kenorb
    Commented Feb 8, 2018 at 13:35
  • 2
    I think this might make a good meta post if your intention is to see if you can ask about programming languages here (not their usage (SO) but other stuff), but otherwise I think this challenge is a bit too opinion-based to be on-topic for this site, unfortunately. It's a very interesting topic though! Commented Feb 11, 2018 at 4:26
  • 2
    @DLosc Prolog has a syntax, but doesn't really have a vocabulary. As Wikipedia says, "An atom is a general-purpose name with no inherent meaning." Lojban has actual lexemes with fixed sound-meaning pairings.
    – curiousdannii
    Commented May 3, 2018 at 0:24
  • 1
    Isn't this question a little pedantic? The definition of the word language varies a lot based on the context. Are apples vegetables? In any case, I want pineapple on my pizza.
    – Domino
    Commented Feb 18, 2019 at 7:09

8 Answers 8

18

No. "Constructed languages" on this site refers to artificially created languages for intelligent beings, not machine languages. In the absence of another qualifier a "language" is, as I wrote on another site, a system for communicating propositional and conceptual information to other beings. This is different from communication. Programming languages can definitely be used to communicate - and they carry meaning - but that doesn't make them languages. Purely referential communication (using symbols to directly refer to things in the world without metaphorical extension) is not enough to be a language, language must be able to communicate abstract concepts that are beyond any sensory or referential basis. Programming languages are systems for encoding instructions for machines, and not general purpose concept exchange systems.

0
10

Programming languages are constructed, but they are not languages, in the sense English or Esperanto or Klingon are languages, as curiousdannii shows. We cannot translate things like "I will be late for dinner" into a programming "language". And a characteristic of all "languages", properly speaking, is their mutual "translatability".

2
  • 6
    I dunno... logic programming languages like Prolog can come pretty close to representing facts like "I will be late for dinner," if you define the terms properly... something like "I expect to arrive home at a later time than the start of my family's next evening mealtime, but at an earlier time than the end of it" could be represented in Prolog in such a way that the computer could both report the information and make inferences from it.
    – DLosc
    Commented Feb 19, 2018 at 20:43
  • Are languages actually mutually translatable? If a "language" were unable to translate something from another language (or vice versa), would it be disqualified as a language? If we say that a programming language isn't mutually translatable with accepted languages, are we talking about a difference of kind or of degree? Commented Oct 1, 2019 at 23:01
7

As a programmer and a conlanger, I'd say "no". As noted above, programming languages cannot convey metaphor, emotions, sensory impressions, and other such human-relevant messages. Abstraction they can handle, but only abstractions that are relevant to the processing going on inside the machine. Such languages have an extremely limited sphere of reference: bits, bytes, and data structures inside the machine, and operations upon them.

1
  • 2
    Languages are not required to convey metaphors and emotions - when did this become a requirement?
    – qwr
    Commented May 3, 2018 at 16:40
2

In the novel "Autonomy", when robots speak to each other, they author expressed it in a source code-like English, with a few things you'd see in coded implementations, like mentions of files, message headers and acknowledgements, and so on. Obviously this wasn't a full implementation. If a hobbyist did do a working implementation, I figure it would be a conlang.

In Star Wars, the droids are supposed to speak a language. The attested text can't possibly be anything like a conlang, except maybe as a language of just "oh!", "ah!" "ha-ha!" and other emotive exclamations. If someone hobbyist tried to make a droid language, it would be a nice feature if it could both work as a natural language and a programming language.

People have speculated that Lojban could serve as a programming language, as things like Prolog are programs made out of logical statements. I haven't heard of anyone doing so. Lojban syntax is describe with the same tools as are used for writing compilers, YACC.

Obviously, since this website doesn't need to reproduce Stack Overflow, things that are only programming languages and don't have a way to be used as a natural language (except maybe in jest?) are not only not conlangs, but off topic.

2

Going along curiousdannii's idea of languages for human idea exchange, there's an old joke that Python can be used in place of pseudocode, because of its use of English keywords, relatively little punctuation, and ease of understanding.

Here is an example of Kadane's algorithm, expressed in Python (from Wikipedia):

def max_subarray(A):
    max_ending_here = max_so_far = A[0]
    for x in A[1:]:
        max_ending_here = max(x, max_ending_here + x)
        max_so_far = max(max_so_far, max_ending_here)
    return max_so_far

aruslanovych asserts that languages have to convey emotion, metaphor, sensory impressions, etc. but I think this is a Romantic view. Is the Greek Linear B was used to write not a language since it was used for administrative record-keeping and probably tax purposes?

I take a liberal view in that yes, programming languages can represent metaphors, abstraction, and idioms, just maybe not in the sense we're used to. In fact, computers are excellent at abstract concepts and generalizing, with duck typing, object-oriented programming and reflection. Off-topic, I daresay with deep learning, computers can generalize even better than humans can. And, sci-fi speculation, when robots become just as intelligent as humans, we have to consider their languages as "real".

1
  • 1
    Writing isn't language proper either ;)
    – kaleissin
    Commented May 3, 2018 at 20:36
2

Conlangs and programming languages are different things. Conlangs are languages designed for human communication. For human to human communication.

No programming language can be regarded as a language in that sense.

Riley Martine's example uses python-like syntax. But at the same time it uses real English words to convey the meaning.
Computer is not able to understand the meaning of these words, it just runs code.

Simple Python example:

greetingString = "Hello"

print(greetingString)

Computer just set string "Hello" to variable greetingString and prints it to the screen.
Computer does NOT understand the meaning of the word . For computer it's just a computer variable value, nothing else.

1
  • It doesn't matter if a computer understands the meaning. No computer understands the meaning of La suno brilas, but it is still a valid conlang sentence! Your python example can easily be translated into English as "Take the sequence 'Hello' and write it down", so you could argue it has a meaning that can be interpreted by an entity capable of doing so. Commented Aug 19, 2019 at 17:01
2

I'm trying to be Devil's Advocate here: In a way programming languages are constructed languages, but they are usually very specific and narrow in focus: one could view them as sublanguages aimed at expressing algorithms or annotating other information. An example for a human sublanguage would be the language of recipes. Words that have multiple meanings in English generally have only one specific meaning in a sublanguage. The syntactic structures are simplified, and often different from general English. Certain aspects of the range of human expressions are left out or limited (you might talk about emotions or feelings, but they would only relate to the food mentioned).

You could design a programming language that is suited to expressing recipes, and it could be used to drive a cooking robot. That programming language could also be read by humans, who would understand the meaning of it, and could translate it into other languages. In this sense 'programming language' is a bit of a red herring: it's just a formal representation of meaning. And (propositional) meaning can easily be expressed in predicate calculus or related formalisms. Is CD representation a conlang, or just an abstract representation of actions/states? It can certainly be transformed into any number of other languages (natural or constructed), and it can express a reasonable range of human activity.

Where do you draw the line? At what point does a constructed language cross the boundary between being simply a mark-up or programming language to being suitable for human communication? What is the essence that, say, HTML, is missing, but that toki pona, Klingon, or Esperanto have? Note: I'm not suggesting that HTML is a conlang, but it can be used to encode a specific kind of meaning, and XML can even encode semantic relationships. But they might not be very suitable for inter-human communication.

You could, though, envisage two people with no common language between them who use a programming language to work together on solving a problem. It would be tough, but should be possible.

In my view there is a continuum between 'fully formed' languages on the one hand, and restricted or sublanguages on the other. While it is difficult to formally represent the more complex languages (because they are so complex), the simpler end of the spectrum can be encoded in such a representation. Predicate calculus is one representation, and any programming language is another one. There is no hard boundary between the two, so in a way (even though nobody would really 'speak' in a programming language) the answer is: yes, programming languages can be categorised as conlangs.

1

I would say, to a very limited extent, that yes, they can be, but only as a proxy grammar for other languages. For example,

from sys import exit as stops ; import os
thing = [] ; me = can = remember = False ; this = open(__file__)
def terrible(v): return v

# ==== start song snippet

me = can = remember = not any(thing)
can = not this.tell(), [True, "dream"]
locals()["deep"] = {"down":{"inside":{"feel_to":"scream"}}}
if `this` + (terrible("silence")): stops(me)

# ===== end song snippet

(source: Coding in song - Representing music lyrics in a programming language of your choosing)

However, this isn't a great method of communication. Programming languages are not designed with the same intentions as conlangs.

2
  • 6
    -1: This isn't really an example of a programming language in use, but rather some English that's formatted in such a way that it doesn't cause any errors when run as a program. It's a bit like stitching together random Vietnamese words into a poem that can be read in English and calling it an example of Vietnamese.
    – DLosc
    Commented Feb 19, 2018 at 20:42
  • That's fair. Thinking about it, I mostly just wanted to share something interesting I thought could push the edges of the other answers. Commented Feb 21, 2018 at 19:35

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.