How Many Programming Languages are there in this CS 199 Computers Unplugged World? Course Notes1 Week 4: Natural and Programming Languages Lecture 2: Programming Languages

Anton Setzer I Number of languages linked from at HOPL: http://www.cs.swan.ac.uk/∼csetzer/index.html I Same problems as for natural languages: I Families of languages. http://www.cs.swan.ac.uk/∼csetzer/lectures/ I Dialects. computersUnplugged/10/index.html I Different versions. I Different compilers for the same language execute differently.

November 5, 2010

1Substantially based on Stephen Anderson: How many languages are there in the world. Available from http://www.lsadc.org/info/pdf files/howmany.pdf CS 199 1/ 30 CS 199 2/ 30

What is a ? What is a Programming Language?

I Britannica Online I The Free Dictionary http://www.thefreedictionary.com: http://www.britannica.com/EBchecked/topic/130670/computer- programming-language I An artificial language used to write instructions that can be translated into machine language and then executed by a computer. I Computer programming language, any of various languages for I Wikipedia http://en.wikipedia.org/wiki/Programming language expressing a set of detailed instructions for a digital computer. I A programming language is an artificial language designed to express computations that can be performed by a machine, particularly a I Webopedia computer http://www.webopedia.com/TERM/P/programming language.html I A vocabulary and set of grammatical rules for instructing a computer to perform specific tasks

CS 199 3/ 30 CS 199 4/ 30 What is a Programming Language? What is a Language?

I My definition: I An ::::::::::alphabet is a finite set. I A ::::::::::::::programming::::::::::language is a set of descriptions such that each description can be used to instruct a computer or other mechanical I A :::::::formal:::::::::::language is a set of strings over a given alphabet. device to perform a specific task.

CS 199 5/ 30 CS 199 6/ 30

What is a Programming Language? Adjustment Mechanism of a Mechanical Watch – An Analogue Programming Language

I Is mp3 a programming language? I Analogue computer languages.

I Not formal languages.

I Is English a programming language?

CS 199 7/ 30 CS 199 7a/ 30 Vynil Record – Analogue Programming Language Antikythera Mechanism

CS 199 7b/ 30 CS 199 8/ 30

Antikythera Mechanism Antikythera Mechanism (around 150 - 100 BCE)

I From http://en.wikipedia.org/wiki/Computer programming: I The Antikythera mechanism from ancient Greece was a calculator utilizing gears of various sizes and configuration to determine its operation, which tracked the metonic cycle still used in lunar-to-solar calendars, and which is consistent for calculating the dates of the Olympiads. I From Mark Wonnacott: Analogue Computers: The First Declarative Programming. http://ragzouken.com/compsci/languages.pdf I The first machine computable delcarative program is within the earliest mechanical computer, the Antikythera mechanism (. 70 BC). Changing the date with the mechanism’s hand-crank turned a complex arrangement of gears to compute astronomical positions. Different gearing rations between connected gears dictate the relationships between them and ultimately between the date and calculated astronomical positions. These relationships are invariantly satisfied by the turning of the gears, making the gears a form of declarative program. CS 199 9/ 30 CS 199 10/ 30 Al-Jazari Musical Robots – A Digital Programming History of Programming Languages Language

I Wikipedia, http://en.wikipedia.org/wiki/Al-Jazari

I l-Jazari created a musical automaton, which was a boat with four automatic musicians that floated on a lake to entertain guests at royal drinking parties. Professor Noel Sharkey has argued that it is quite likely that it was an early programmable automata and has produced a possible reconstruction of the mechanism; it has a programmable drum machine with pegs (cams) that bump into little levers that operated the percussion. The drummer could be made to play different rhythms and different drum patterns if the pegs were moved around. According to Charles B. Fowler, the automata were a ”robot band” which performed ”more than fifty facial and body actions during each musical selection.”

CS 199 11/ 30 CS 199 12/ 30

Jacquard Loom (Invented 1801) Babbage’s Analytical Engine (1834)

Jacquard Loom, invented by Joseqph Marie Jacquard 1801

CS 199 13/ 30 CS 199 14/ 30 Babbage’s Analytical Engine – First Turing Complete Ada Lovelace - The first Computer Programmer Language

I It’s Turing complete.

I More in CS-236 Lanugage and Computation.

I Any computable function can be computed in principle using Babbage’s Analytical Engine.

I The language for Babbage’s Analytical Engine is probably the first Turing-Complete Programming Language.

CS 199 15/ 30 CS 199 16/ 30

Hello World Program 99 Bottles of Beer

CS 199 17/ 30 CS 199 18/ 30 Popular Languages Scripting Languages

I Java I I C I Python I C++

I Pascal

CS 199 19/ 30 CS 199 20/ 30

Easy to Use Languages Functional Programming Languages

I Haskell I BASIC I SML I Visual Basic I Coq (dependently typed)

CS 199 21/ 30 CS 199 22/ 30 Logic Programming Markup Languages/Spreadsheets

I HTML I I Excel

CS 199 23/ 30 CS 199 24/ 30

Misc Historically Famous Languages

I Babbage’s Analytical Language

I Database Languages I ENIAC I SQL I I Graphical Languages I LISP I LabVIEW I Cobol

I

CS 199 25/ 30 CS 199 26/ 30 Assembler Theoretical Languages

I Turing Machine

I CSP

CS 199 27/ 30 CS 199 28/ 30

Extreme Languages Esoteric Languages

I SheerPower.

I Aimed at having the fastest compilation. I Cow. I What does this mean? I LOLCODE. I Brainfuck.

I Aimed at having thesmallest compiler. I Piet. I What does this mean? I Whitespace. I Malbolge

I Aimed at having the most incomprehensible language.

CS 199 29/ 30 CS 199 30/ 30