Artificial Languages

Natural Languages

English, French, Spanish, Arabic, Chinese, Hebrew, Italian… Languages spoken throughout the world are known as natural languages. These are languages that evolved naturally through everyday communication between people over hundreds of years. These languages are complex, but also structured. Each has its own set of specialized vocabulary, grammatical structure, and syntax that distinguishes it from another. Because these languages grew around human communication, they usually have both written and spoken forms. In addition, the formality of the language can vary by usage (e.g., the way you might talk to your grandmother vs. your friends, “lol t3xtsp34k”).

Despite all their differences, the one thing that natural languages have in common is their potential for ambiguity. Ambiguity makes natural languages a very poor means of communicating clear and precise instructions to be interpreted and executed exactly as intended. In short, natural languages make lousy programming languages. As computer scientists, we need something better.

Artificial Programming Languages

Enter artificial languages! Unlike a natural language that develops gradually and informally among whole societies, artificial languages are usually developed relatively quickly by small groups for very specific purposes. While they can be complex, just like the natural language you might use to communicate at home, they are usually much simpler and structured.

Over the years, a number of attempts have been made to develop and popularize a single, “universal” written/spoken language that could cross cultures and political borders. Esperanto is one such attempt. To date, only about two million people speak the language (and most of those as a second language).

But for human-to-computer interactions, Artificial languages designed specifically for programming include Java, C++, Swift, Python, BASIC, Pascal, Cobol, and Fortran. These languages are usually characterized by their textual nature (i.e., letters, digits, and punctuation typed into a computer with a keyboard). They use a certain set of keywords and punctuation in order for the programmer express each instruction in a form that can be interpreted and executed without any ambiguity. Here are a few examples of the varying syntax between different programming languages and the forms that an equivalent instruction to print the word “Hello” might be written in each language.

10 PRINT “Hello"
print “Hello"
System.out.print("Hello");

Notice how even without knowing the language or what all of the special punctuation might mean, each of these statements is relatively readable to any English speaker (yes, most keywords in these programming languages tend to be English, as opposed to another natural language). Compare these to the way we’ve seen algorithms informally expressed throughout this unit:

1) Print the word “Hello.”

We will revisit textual programming languages later in Unit 4: Digital Media Processing, where you’ll get to try your hand at writing programs in the Processing programming language.

Visual Programming Languages

One of the biggest challenges learning to work with textual programming languages is the problem of syntax—these languages are demanding about every little thing. If the programmer doesn’t use the exact spelling, capitalization, and punctuation required by that specific programming language, the computer won’t do what he/she wants it to do.

To combat this problem, a number of visual programming languages have been developed to allow programmers to drag and drop pictures or icons into organized blocks that represent the different parts of a program. Blocks-based programming tools automatically handle all the grammar and syntax the programming language requires. This allows novice programmers to focus on the logic of their programs, rather than the syntax, spelling, capitalization, etc.

The example above shows how individual programming “blocks” can be assembled in a language like Scratch. In Unit 2: Programming, you will get to build your first interactive programs using Scratch.