Thursday 10 August 2017

Bizarre programming languages

A casual reference to INTERCAL (number one on the list to which this is a link) intrigued me. There was a period towards the end of the last century when every man and his dog (especially if the man and his dog had just graduated in computer science) produced a new computer language or operating system. I should have realised a long time ago that, considering the obscure syntax and/or special application of these languages, it was inevitable that some spoof languages would be devised. Moreover, some established languages were ripe for spoofing: consider a sample of APL:

[6]    L←(Lι':')↓L←,L       ⍝ drop To:
 [7]    L←LJUST VTOM',',L    ⍝ mat with one entry per row
 [8]    S←¯1++/∧\L≠'('       ⍝ length of address
 [9]    X←0⌈⌈/S
 [10]   L←S⌽(−(⍴L)+0,X)↑L    ⍝ align the (names)
 [11]   A←((1↑⍴L),X)↑L       ⍝ address
 [12]   N←0 1↓DLTB(0,X)↓L    ⍝ names)
 [13]   N←,'⍺',N
 [14]   N[(N='_')/ι⍴N]←' '   ⍝ change _ to blank
 [15]   N←0 ¯1↓RJUST VTOM N  ⍝ names
 [16]   S←+/∧\' '≠⌽N         ⍝ length of last word in name

 
- which is difficult to understand even with the comments to the right of each line of code.

On the other hand, there are descriptive languages like COBOL, which was designed to read like English, presumably so that managers of any intelligence or accountants could gain at least a superficial understanding of what a program did. My favourite on the Listverse list is therefore Shakespeare, which is surely inspired by COBOL:

The first line in a Shakespeare program is called the “title” and acts as a comment. The “Dramatis Personae” is the section
where variables are declared. Each variable name must be the name of a character from a Shakespeare play.
A piece of code in Shakespeare is broken into “Acts”, which contain “Scenes”, in which characters (variables) interact.
Each Act and Scene is numbered with a roman numeral and serves as a GOTO label. They are written in the form:
Act I: Hamlet’s insults and flattery.
Scene I: The insulting of Romeo.
Before “characters” (variables) can “act” (be acted upon) they must first be “on stage”.
To call a variable to the stage the “Enter” command is used. To tell characters to leave the stage, use the “Exit” command.
“Exeunt” calls more than one character to leave, or in the case that no characters are listed all the characters
will leave the stage.



I look forward to the movie (cinema, TV or Netflix) where the technical consultant manages to insinuate a screenful of INTERCAL at a critical point in the plot.

No comments: