cs 199 computers unplugged · cs 199 computers unplugged course notes1 week 4: natural and...

of 32 /32
CS 199 Computers Unplugged Course Notes 1 Week 4: Natural and Programming Languages Lecture 2: Programming Languages Anton Setzer http://www.cs.swan.ac.uk/csetzer/index.html http://www.cs.swan.ac.uk/csetzer/lectures/ computersUnplugged/10/index.html November 5, 2010 1 Substantially 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

Author: others

Post on 11-Aug-2020




0 download

Embed Size (px)


  • CS 199 Computers UnpluggedCourse Notes1

    Week 4: Natural and Programming LanguagesLecture 2: Programming Languages

    Anton Setzerhttp://www.cs.swan.ac.uk/∼csetzer/index.html


    November 5, 2010

    1Substantially based on Stephen Anderson: How many languages are there in theworld. Available from http://www.lsadc.org/info/pdf files/howmany.pdf

    CS 199 1/ 30


  • How Many Programming Languages are there in thisWorld?

    I Number of languages linked from at HOPL:I Same problems as for natural languages:

    I Families of languages.I Dialects.I Different versions.I Different compilers for the same language execute differently.

    CS 199 2/ 30

  • What is a Programming Language?

    I The Free Dictionary http://www.thefreedictionary.com:I An artificial language used to write instructions that can be translated

    into machine language and then executed by a computer.

    I Wikipedia http://en.wikipedia.org/wiki/Programming languageI A programming language is an artificial language designed to express

    computations that can be performed by a machine, particularly acomputer

    CS 199 3/ 30

  • What is a Programming Language?

    I Britannica Onlinehttp://www.britannica.com/EBchecked/topic/130670/computer-programming-language

    I Computer programming language, any of various languages forexpressing a set of detailed instructions for a digital computer.

    I Webopediahttp://www.webopedia.com/TERM/P/programming language.html

    I A vocabulary and set of grammatical rules for instructing a computerto perform specific tasks

    CS 199 4/ 30

  • What is a Programming Language?

    I My definition:I A


    ::::::::::language is a set of descriptions such that each

    description can be used to instruct a computer or other mechanicaldevice to perform a specific task.

    CS 199 5/ 30

  • What is a Language?

    I An::::::::::alphabet is a finite set.

    I A:::::::formal

    :::::::::::language is a set of strings over a given alphabet.

    CS 199 6/ 30

  • What is a 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

  • Adjustment Mechanism of a Mechanical Watch – AnAnalogue Programming Language

    CS 199 7a/ 30

  • Vynil Record – Analogue Programming Language

    CS 199 7b/ 30

  • Antikythera Mechanism

    CS 199 8/ 30

  • Antikythera Mechanism

    CS 199 9/ 30

  • 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 itsoperation, which tracked the metonic cycle still used in lunar-to-solarcalendars, and which is consistent for calculating the dates of theOlympiads.

    I From Mark Wonnacott: Analogue Computers: The First DeclarativeProgramming.http://ragzouken.com/compsci/languages.pdf

    I The first machine computable delcarative program is within the earliestmechanical computer, the Antikythera mechanism (c. 70 BC).Changing the date with the mechanism’s hand-crank turned a complexarrangement of gears to compute astronomical positions. Differentgearing rations between connected gears dictate the relationshipsbetween them and ultimately between the date and calculatedastronomical positions. These relationships are invariantly satisfied bythe turning of the gears, making the gears a form of declarativeprogram.

    CS 199 10/ 30

  • Al-Jazari Musical Robots – A Digital ProgrammingLanguage

    CS 199 11/ 30

  • History of Programming Languages

    I Wikipedia, http://en.wikipedia.org/wiki/Al-JazariI l-Jazari created a musical automaton, which was a boat with four

    automatic musicians that floated on a lake to entertain guests at royaldrinking parties. Professor Noel Sharkey has argued that it is quitelikely that it was an early programmable automata and has produced apossible reconstruction of the mechanism; it has a programmable drummachine with pegs (cams) that bump into little levers that operated thepercussion. The drummer could be made to play different rhythms anddifferent drum patterns if the pegs were moved around. According toCharles B. Fowler, the automata were a ”robot band” which performed”more than fifty facial and body actions during each musical selection.”

    CS 199 12/ 30

  • Jacquard Loom (Invented 1801)

    Jacquard Loom, invented by Joseqph Marie Jacquard 1801

    CS 199 13/ 30

  • Babbage’s Analytical Engine (1834)

    CS 199 14/ 30

  • Babbage’s Analytical Engine – First Turing CompleteLanguage

    I It’s Turing complete.I More in CS-236 Lanugage and Computation.

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

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

    CS 199 15/ 30

  • Ada Lovelace - The first Computer Programmer

    CS 199 16/ 30

  • Hello World Program

    CS 199 17/ 30

  • 99 Bottles of Beer

    CS 199 18/ 30

  • Popular Languages

    I Java

    I C

    I C++

    I Pascal

    CS 199 19/ 30

  • Scripting Languages

    I Perl

    I Python

    CS 199 20/ 30

  • Easy to Use Languages


    I Visual Basic

    CS 199 21/ 30

  • Functional Programming Languages

    I Haskell

    I SML

    I Coq (dependently typed)

    CS 199 22/ 30

  • Logic Programming

    I Prolog

    CS 199 23/ 30

  • Markup Languages/Spreadsheets

    I HTML

    I Excel

    CS 199 24/ 30

  • Misc

    I Database LanguagesI SQL

    I Graphical LanguagesI LabVIEW

    CS 199 25/ 30

  • Historically Famous Languages

    I Babbage’s Analytical Language



    I LISP

    I Cobol

    I Simula

    CS 199 26/ 30

  • Assembler

    CS 199 27/ 30

  • Theoretical Languages

    I Turing Machine

    I CSP

    CS 199 28/ 30

  • Extreme Languages

    I SheerPower.I Aimed at having the fastest compilation.I What does this mean?

    I Brainfuck.I Aimed at having thesmallest compiler.I What does this mean?

    I MalbolgeI Aimed at having the most incomprehensible language.

    CS 199 29/ 30

  • Esoteric Languages

    I Cow.


    I Piet.

    I Whitespace.

    CS 199 30/ 30