Unusual Paradigms

Languages That Read Like Prose

A look at programming languages whose source resembles sentences, recipes or stage plays, why designers make them, and what they teach about readability.

On this page
  1. When the surface is the experiment
  2. Programs as stage plays
  3. Programs as recipes
  4. Near-English and mock-casual syntax
  5. What prose style gets wrong and right
  6. Related ideas
  7. Trying one

When the surface is the experiment

Most of the unusual paradigms in this section change how computation works underneath. Prose-like languages usually do the opposite: the machinery is often ordinary, such as variables, stacks, input and output, and the experiment is in how the source looks. A program may be written as a recipe, a play or a series of near-English sentences.

That raises a useful question about syntax and semantics. The meaning of a program is what it does. The syntax is how you write it. Prose-like languages show that those can be separated sharply, and that changing only the syntax can change the experience of programming a great deal.

Programs as stage plays

One well-known example is a language whose programs look like a Shakespearean play. The cast list declares characters, and each character is a variable. Acts and scenes act as labels you can jump between. A character speaks lines to another character, and those lines change the other’s stored value. Positive nouns and negative nouns stand for positive and negative numbers, so a longer or more flattering string of adjectives can stand for a larger number.

The result reads like a parody of an old play and is intentionally absurd. Underneath, it is a fairly ordinary imperative language: assignment, arithmetic, conditionals, labels and input and output. The charm comes from tracing a numerical algorithm through pages of dramatic speeches.

Programs as recipes

Another language writes programs as cooking recipes. Variables are ingredients, with quantities as their values. Instructions take the form of kitchen steps such as mixing, stirring or putting items into bowls, and output comes from a final serving step. A program can be run as an actual recipe, at least in spirit, with the convention that a clever author tries to make the program also look like something one could cook.

The goal is a joke, and the pleasure is in the double reading. Behind it sits a stack-like model, so a programmer must still think about order and leftover values.

Near-English and mock-casual syntax

Other languages swap keywords for phrases borrowed from internet slang, movie quotes or everyday speech. Instruction names might be catchphrases, and program structure might read like a chat. These are usually classed as joke languages. Their humor depends on a shared culture, so the effect can fade as references age.

It is worth separating them from serious attempts at English-like programming. Some older business-oriented languages were designed so that code looked like English sentences, in the hope that non-programmers could read it. Those efforts were meant sincerely, and the lessons were mixed: statements read well, but precision still required learning exact rules, and verbose code can be harder to scan than compact notation.

What prose style gets wrong and right

Prose-like syntax has some clear costs.

  • Ambiguity of expectation. Because it looks like English, readers assume it behaves like English. It does not accept paraphrases, and an error in a single word may break the program.
  • Verbosity. Sentences are longer than symbols, so short operations need many words.
  • Hidden structure. The grammar is strict even when the text looks loose, so the structure is not always obvious.

And some real benefits.

  • Memorable names. Characters and ingredients can make variable roles easier to remember, which is the same reason good naming helps in any language.
  • A way in for newcomers. A program that looks like a recipe can lower the intimidation of a blank screen, even if the underlying ideas are the same.
  • Playfulness. Writing code in a deliberately odd voice makes the exercise memorable, and many people remember such languages for years.

Compared with languages that are hard to read because they are dense, as discussed under code readability, prose-like languages are hard for the opposite reason: they hide a small amount of logic in a lot of words.

Literate programming is a different tradition, where explanatory prose and code are woven together in the same document. There the prose is commentary, not the code itself, but the ambition of making programs readable by humans is shared. Likewise, domain-specific languages designed for specialists often adopt vocabulary from their field so that experts feel at home.

Trying one

If you want to experiment, choose a theme and design only the syntax. Decide what a “sentence” does, whether each sentence maps to one operation, and how you will show structure such as loops. Then write a small interpreter that translates the sentences into an ordinary internal form. It is a good exercise in separating the grammar of a language from its meaning, and a reminder that readability is a property of the reader as much as the text.

The complete guide to unusual paradigms

Unusual Programming Paradigms in Esoteric Languages
Read the guide

Keep exploring

Guides from other topics

All topics →

What Is Befunge?

A plain introduction to Befunge, the esoteric language where code lives on a two-dimensional grid and an instruction pointer moves in four directions.

Befunge Basics 5 min read