Presentation is loading. Please wait.

Presentation is loading. Please wait.

David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 12: All About Algol Algol60.

Similar presentations


Presentation on theme: "David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 12: All About Algol Algol60."— Presentation transcript:

1 David Evans http://www.cs.virginia.edu/~evans CS655: Programming Languages University of Virginia Computer Science Lecture 12: All About Algol Algol60 was appreciated, almost immediately, as a rounded work of art.... While Algol60 was no intellectual revolution, it was to become a universal tool with which to view, study and proffer solutions to almost every kind of problem in computation. Rarely has a construction so useful and elegant emerged as the output of a committee of 13 meeting for about 10 days. Alan Perlis, 1978

2 27 Feb 2001University of Virginia CS 6552 Menu PS2, PS3 Algol Background Evolution of Algol Procedures Ambiguities in Algol60 [Knuth] Algol 68

3 27 Feb 2001University of Virginia CS 6553 PS2 Comments Everyone got the quantum scheme interpreter to mostly work – good job! No one wrote one elegantly or concisely enough to get 10/10, or to be worth handing out as solutions (although some came close). No one used deeplistmerge in their solution!

4 27 Feb 2001University of Virginia CS 6554 PS2 Comments This isn’t a software engineering course, if it were I would be appalled at the test cases everyone used! Test cases should always cover: –Error cases (observe failures) –Boundary cases (empty quists, singletons, etc.)

5 27 Feb 2001University of Virginia CS 6555 PS3: Out Today Pick an interesting target –Don’t pick C++ unless you have something creative to say (way too easy) –Best paper will convince me about a language I like (C, CLU, FL, Scheme) Write well –Make a web page for a humanities grad student

6 27 Feb 2001University of Virginia CS 6556 Communications of the ACM January 1963January 2001Advantage Cover Black, white and blue glimpse of Algol 60 Report Glossy frightening colorful cartoon about e-Democracy

7 27 Feb 2001University of Virginia CS 6557 Communications of the ACM January 1963January 2001Advantage Cover Black, white and blue glimpse of Algol 60 Report Glossy frightening colorful cartoon about e-Democracy 1963

8 27 Feb 2001University of Virginia CS 6558 Communications of the ACM January 1963January 2001Advantage Cover Black, white and blue glimpse of Algol 60 Report Glossy frightening colorful cartoon about e-Democracy 1963 Code Excerpts 191 (pseudocode) 1963 Proofs 3None 1963 Algorithms 10None 1963 Letters from US Presidents

9 27 Feb 2001University of Virginia CS 6559 Communications of the ACM January 1963January 2001Advantage CoverBlack, white and blue glimpse of Algol 60 Report Glossy colorful cartoon about e- Democracy 1963 Code Excerpts 191 (pseudocode) 1963 Proofs 3None 1963 Algorithms 10None 1963 Letters from US Presidents 1 (Kennedy, p. 45)0 1963

10 27 Feb 2001University of Virginia CS 65510 Communications of the ACM January 1963January 2001Advantage AdvertisementsMostly sexist ads for programmers, starting salaries $18,000; some adds for languages: “Big computer Fortran for desk-size computer users. Compiles 125 statements per minute!...start as low as $1500/month.” 46 pages of ads for overpayed, cushy academic positions, glossy full-color ads for conferences (CHI, user experience, performance evaluation and telecommunication, etc.), books 2001 Web Version None Yes (if you pay ACM) 2001 Best-Selling Music Beatles, “Please Please Me” Beatles, 1 Tie

11 27 Feb 2001University of Virginia CS 65511 Before Algol Ad hoc syntax descriptions, didn’t pay much attention Operational language descriptions Machine/compiler specific

12 27 Feb 2001University of Virginia CS 65512 IBM 704 Fortran manual, 1956

13 27 Feb 2001University of Virginia CS 65513 Some Fortran Code Loops DO 10 I=1.10 Assigns 1.10 to the variable DO10I DO 10 I=1,10 Loops for I = 1 to 10 (Often blamed for loss of Mariner-I, but probably not true.)

14 27 Feb 2001University of Virginia CS 65514 Procedures in Fortran Original “Programmer’s Reference Manual” [1956] – no way to define a function; could call pre-defined functions Revised in 1957: –Define a function on a single line, with arguments Call-by-reference: SUBROUTINE INCR(I) I = I + 1 RETURN END CALL INCR (2) N = 2 + 2

15 27 Feb 2001University of Virginia CS 65515 Algol Background 1955: GAMM (European association of applied mathematics and mechanics) sets up committee to study development of a universal machine-independent programming language May 1957: ACM forms committee to study universal programming language October 4, 1957:

16 27 Feb 2001University of Virginia CS 65516 1958 Oct 1957: agree to joint effort 1958: Preliminary Report – International Algebraic Language. Objectives: –As close as possible to standard mathematical notation, readable with little further explanation –Useable for describing computing processes in publications –Mechanically translatable into machine programs

17 27 Feb 2001University of Virginia CS 65517 Algol 58 FunctionProcedure BodyExpressionCompound Statement ParametersCall-by-valueCall-by-name IdentifiersNon-parameters are global Only use parameters Syntactic UseOnly as an expression operand Statement or expression operand

18 27 Feb 2001University of Virginia CS 65518 Zürich Report (1959) Removed distinction between functions and procedures: allow procedures to return a value, blocks Separate input and output parameter lists procedure F (P i0, P i1,...) =: (P p0, P p1,...) Can list parameter as both input and output Procedure call by text replacement, replace return to go to to statement after procedure Didn’t support recursion (proprosal to add recursive delimiter rejected)

19 27 Feb 2001University of Virginia CS 65519 Algol 60 Committee Committee consisting of 7 Europeans and 6 Americans (William Turanski died) –Europeans wanted a language to use –Americans using Fortran, other languages, etc. “It is probably true to say that the collective knowledge of the total group of participants in the development of Algol 60 included all there was to be known about programming languages at the time.” [Naur 78] John Backus (Fortran), Alan Perlis (first Turing award), Peter Naur (ACM President), John McCarthy (LISP)

20 27 Feb 2001University of Virginia CS 65520 Three Languages Reference Language –For use by committee, described in report and used in official Algol publications Publication Language –Variations on reference language for publication, close correspondence to reference language Hardware Representations –Condensed languages for machine input

21 27 Feb 2001University of Virginia CS 65521 Why three languages? “After two days of probing attitudes and suggestions, the meeting came to a complete deadlock with one European member pounding on the table and declaring: “No! I will never use a period for a decimal point”. Naturally the Americans considered the use of comma as decimal point to be beneath ridicule. That evening Wegstein visited the opposing camps and proposed defining the three levels of language.” Alan Perlis, The American Side of the Development of Algol, ACM SIGPLAN Noticies, August 1978.

22 27 Feb 2001University of Virginia CS 65522 Algol60 Procedures Call-by-value or call-by-name determined by specifications –Removed need for distinction between input and output parameters Defined by text replacement: –Value: additional block, local variables assigned to parameter –Name: replace throughout body enclosed parameter in parentheses “whenever syntactically possible” Modified body inserted in place of call

23 27 Feb 2001University of Virginia CS 65523 Jensen’s Device real procedure InnerProduct (z, y,n, j); value n; integer n; begin real a; a := 0; for j = 1 step 1 until n do a := a + z * y; InnerProduct := a end Sample calls: InnerProduct (A[i], B[i], 10, i) InnerProduct (M1[i,i], M2[k,i], 10, i)

24 27 Feb 2001University of Virginia CS 65524 Call: InnerProduct (A[i], B[i], 10, i) begin real a; a := 0; for i = 1 step 1 until 10 do a := a + A[i] * B[i]; InnerProduct := a end Call: InnerProduct (M1[i,i], M2[k,i], 10, i) begin real a; a := 0; for i = 1 step 1 until 10 do a := a + M1[i,i] * M2[k, i]; IP := a end

25 27 Feb 2001University of Virginia CS 65525 Ambiguity 1: Side Effects If side effects are permitted, order of evaluation matters! begin integer a; integer procedure double(n) value n; integer n; double := n := n * 2; a := 2; outint (a * double(a) * double(a)); end. Question: Have modern languages resolved this?

26 27 Feb 2001University of Virginia CS 65526 Ambiguity 3: For Loops Overly general and complicated –What were they (over) reacting to? Semantics defined by formal translation (but they probably didn’t really mean it) for V := A step B until C do S  V := A; L1: if (V – C) * sign(B) > 0 then go to done; S; V := V + B; go to L1;

27 27 Feb 2001University of Virginia CS 65527 Ambiguity 4: Specifications 5.4.5: “Specifications (type declarations) of formal parameters called by value must be supplied and specifications of formal parameters called by name may be omitted.” (I don’t understand Knuth’s confusion.) What are the advantages and disadvantages of not specifying call-by- name parameters?

28 27 Feb 2001University of Virginia CS 65528 Ambiguity 8: Numeric Labels ::= | begin integer val; val := 7 go to val; 7: val := 8; go to val; comment yikes! val: … end

29 27 Feb 2001University of Virginia CS 65529 Correction 1: if/else definition “The construction else is equivalent to else if true then ” (4.5.3.2) LISP (before Algol 60): (cond (p1 e1) (p2 e2)... (pn en)) Go from left to right, first p i that is true, value is e i ; If no p i is true, value of expression is undefined

30 27 Feb 2001University of Virginia CS 65530 Influence of Algol FORTRAN Algol60 Simula67 CLU Pascal C 1954 1960 1970 1980 CPL BCPL Algol68 Committee Algol68 Classes PL/I Modula-2 Oberon Smalltalk Algol-W C++ Modula-3 2000 Java

31 27 Feb 2001University of Virginia CS 65531 Algol 68 Committee Unruly, political, infighting, unresolved conflicts 1965 Meeting: two proposals –Wirth and Hoare: extend Algol 60 with records –van Wijngaarden: design new language, minimal concepts combined in orthogonal way, describe using W-grammar, incomplete and incomprehensible Kept postponing meetings because drafts weren’t ready Accepted report (18 of 28 original members) First implementation: 1970 Revised Report: 1975 (first readable presentation)

32 27 Feb 2001University of Virginia CS 65532 Othogonality in Design m n Combination Techniques Building Blocks m*n things Some of those m*n things will be hard to understand or implement, so you end up with either exceptions or complexity.

33 27 Feb 2001University of Virginia CS 65533 Orthogonality in Algol68 References ref x was a type, so ref ref x was a type. refs for parameters, so refs for local varaibles. Procedures procs for parameters, so proc variables, parameters, results and in-line constructors Compare to Pascal: “References are dangerous and complicated, so only allow them where they are absolutely necessary.” –Functions can only return simple types, passed procedures cannot have ref parameters, etc.

34 27 Feb 2001University of Virginia CS 65534 W-Grammars Invented by Van Wijngaarden Can describe any computable language! (Contrast BNF: only context-free languages) Simplified example: reference to MODE assignation :: reference to MODE destination, :=, MODE source. MODE :: real ; integral ; reference to MODE; …

35 27 Feb 2001University of Virginia CS 65535 Minority Report Signed by Edsger Dijkstra, C. A. R. Hoare and 5 others Some complaints about complexity of language (reference concept taken too far) Many complaints about description of language (complexity of W-Grammars) Controversy over publication (suppressed by IFIP) Copy on your manifest

36 27 Feb 2001University of Virginia CS 65536 Doomed to Failure Algol 68 69Published first report 75 Published revised report “one of the most unreadable documents which has ever been printed” 76“Algol 68 with Fewer Tears” 77Tanenbaum’s Tutorial (See Knuth’s quote on Manifest.)

37 27 Feb 2001University of Virginia CS 65537 What things in Java did not come directly from Algol 60? Garbage collection (Lisp [1959]) Exceptions (CLU [1977] had better) User-defined types, structs (Algol 68 had these “better” than Java) Data abstraction (confused in Pascal, better in CLU) Objects, Dynamic Dispatch (Simula [1967]) Concurrency (Algol 68 had better (?))

38 27 Feb 2001University of Virginia CS 65538 Charge Lots of reading to do... –Problem Set 3 –Read Gifford’s notes on Operational Semantics –Read about Algol68 if you have time Pick your target and content for PS3 carefully...


Download ppt "David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 12: All About Algol Algol60."

Similar presentations


Ads by Google