Organization of Programming Languages CSE 452 Instructor Dr

  • Slides: 58
Download presentation
Organization of Programming Languages (CSE 452) Instructor: Dr. B. Cheng Fall 2004 Organization of

Organization of Programming Languages (CSE 452) Instructor: Dr. B. Cheng Fall 2004 Organization of Programming Languages-Cheng (Fall 2004) 1

Evolution of Programming Languages u Purpose: to give perspective of: l where we’ve been,

Evolution of Programming Languages u Purpose: to give perspective of: l where we’ve been, l where we are, and l where we might be going. Take away the mystery behind programming languages Fun lecture. u Acknowledgements: R. Sebesta u u Organization of Programming Languages-Cheng (Fall 2004) 2

Genealogy of Common Languages Organization of Programming Languages-Cheng (Fall 2004) 3

Genealogy of Common Languages Organization of Programming Languages-Cheng (Fall 2004) 3

History of Programming Languages http: //www. webopedia. com/TERM/P/programming_language. html Organization of Programming Languages-Cheng (Fall

History of Programming Languages http: //www. webopedia. com/TERM/P/programming_language. html Organization of Programming Languages-Cheng (Fall 2004) 4

Zuse’s Plankalkül - 1945 u Never implemented u Advanced data structures l floating point,

Zuse’s Plankalkül - 1945 u Never implemented u Advanced data structures l floating point, arrays, records u Invariants Organization of Programming Languages-Cheng (Fall 2004) 5

Evolution of software architecture u 1950 s - Large expensive mainframe computers ran single

Evolution of software architecture u 1950 s - Large expensive mainframe computers ran single programs (Batch processing) u 1960 s - Interactive programming (time-sharing) on mainframes u 1970 s - Development of Minicomputers and first microcomputers. Apple II. Early work on windows, icons, and PCs at XEROX PARC u 1980 s - Personal computer - Microprocessor, IBM PC and Apple Macintosh. Use of windows, icons and mouse u 1990 s - Client-server computing - Networking, The Internet, the World Wide Web Organization of Programming Languages-Cheng (Fall 2004) 6

Pseudocodes - 1949 u What was wrong with using machine code? l Poor readability

Pseudocodes - 1949 u What was wrong with using machine code? l Poor readability l Poor modifiability l Expression coding was tedious l Machine deficiencies--no indexing or floating point Organization of Programming Languages-Cheng (Fall 2004) 7

Pseudocodes u Short code; 1949; BINAC; Mauchly l Expressions were coded, left to right

Pseudocodes u Short code; 1949; BINAC; Mauchly l Expressions were coded, left to right l Some operations: 1 n => (n+2)nd power 2 n => (n+2)nd root 07 => addition Organization of Programming Languages-Cheng (Fall 2004) 8

Pseudocodes u Speedcoding; 1954; IBM 701, Backus l Pseudo ops for arithmetic and math

Pseudocodes u Speedcoding; 1954; IBM 701, Backus l Pseudo ops for arithmetic and math functions l Conditional and unconditional branching l Autoincrement registers for array access l Slow! l Only 700 words left for user program Organization of Programming Languages-Cheng (Fall 2004) 9

Pseudocodes u Laning and Zierler System - 1953 l Implemented on the MIT Whirlwind

Pseudocodes u Laning and Zierler System - 1953 l Implemented on the MIT Whirlwind computer l First "algebraic" compiler system l Subscripted variables, function calls, expression translation l Never ported to any other machine Organization of Programming Languages-Cheng (Fall 2004) 10

IBM 704 and FORTRAN u FORTRAN I - 1957 (FORTRAN 0 - 1954 -

IBM 704 and FORTRAN u FORTRAN I - 1957 (FORTRAN 0 - 1954 - not implemented) l Designed for the new IBM 704, which had index registers and floating point hardware l Environment of development: u Computers were small and unreliable u Applications were scientific u No programming methodology or tools u Machine efficiency was most important Organization of Programming Languages-Cheng (Fall 2004) 11

IBM 704 and FORTRAN u Impact of environment on design of FORTRAN I l

IBM 704 and FORTRAN u Impact of environment on design of FORTRAN I l No need for dynamic storage l Need good array handling and counting loops l No string handling, decimal arithmetic, or powerful input/output (commercial stuff) Organization of Programming Languages-Cheng (Fall 2004) 12

IBM 704 and FORTRAN u First implemented version of FORTRAN l Names could have

IBM 704 and FORTRAN u First implemented version of FORTRAN l Names could have up to six characters l Post-test counting loop (DO) l Formatted I/O l User-defined subprograms l Three-way selection statement (arithmetic IF) l No data typing statements Organization of Programming Languages-Cheng (Fall 2004) 13

IBM 704 and FORTRAN u First implemented version of FORTRAN l No separate compilation

IBM 704 and FORTRAN u First implemented version of FORTRAN l No separate compilation l Compiler released in April 1957, after 18 worker-years of effort l Programs larger than 400 lines rarely compiled correctly, mainly due to poor reliability of the 704 l Code was very fast l Quickly became widely used Organization of Programming Languages-Cheng (Fall 2004) 14

IBM 704 and FORTRAN u FORTRAN II - 1958 l Independent compilation l Fix

IBM 704 and FORTRAN u FORTRAN II - 1958 l Independent compilation l Fix the bugs Organization of Programming Languages-Cheng (Fall 2004) 15

IBM 704 and FORTRAN u FORTRAN IV - 1960 -62 l Explicit type declarations

IBM 704 and FORTRAN u FORTRAN IV - 1960 -62 l Explicit type declarations l Logical selection statement l Subprogram names could be parameters l ANSI standard in 1966 Organization of Programming Languages-Cheng (Fall 2004) 16

IBM 704 and FORTRAN u FORTRAN 77 - 1978 l Character string handling l

IBM 704 and FORTRAN u FORTRAN 77 - 1978 l Character string handling l Logical loop control statement l IF-THEN-ELSE statement Organization of Programming Languages-Cheng (Fall 2004) 17

IBM 704 and FORTRAN u FORTRAN 90 - 1990 l Modules l Dynamic arrays

IBM 704 and FORTRAN u FORTRAN 90 - 1990 l Modules l Dynamic arrays l Pointers l Recursion l CASE statement l Parameter type checking Organization of Programming Languages-Cheng (Fall 2004) 18

IBM 704 and FORTRAN u FORTRAN Evaluation l Dramatically changed forever the way computers

IBM 704 and FORTRAN u FORTRAN Evaluation l Dramatically changed forever the way computers are used Organization of Programming Languages-Cheng (Fall 2004) 19

LISP - 1959 u LISt Processing language (Designed at MIT by Mc. Carthy) u

LISP - 1959 u LISt Processing language (Designed at MIT by Mc. Carthy) u AI research needed a language that: l Process data in lists (rather than arrays) l Symbolic computation (rather than numeric) u Only two data types: atoms and lists u Syntax is based on lambda calculus Organization of Programming Languages-Cheng (Fall 2004) 20

Representation of Two LISP Lists Organization of Programming Languages-Cheng (Fall 2004) 21

Representation of Two LISP Lists Organization of Programming Languages-Cheng (Fall 2004) 21

LISP u Pioneered functional programming l No need for variables or assignment l Control

LISP u Pioneered functional programming l No need for variables or assignment l Control via recursion and conditional expressions u Still the dominant language for AI u COMMON LISP and Scheme are contemporary dialects of LISP u ML, Miranda, and Haskell are related languages Organization of Programming Languages-Cheng (Fall 2004) 22

ALGOL 58 and 60 u Environment of development: l FORTRAN had (barely) arrived for

ALGOL 58 and 60 u Environment of development: l FORTRAN had (barely) arrived for IBM 70 x l Many other languages were being developed, all for specific machines l No portable language; all were machinedependent l No universal language for communicating algorithms Organization of Programming Languages-Cheng (Fall 2004) 23

ALGOL 58 and 60 u ACM and GAMM met for four days for design

ALGOL 58 and 60 u ACM and GAMM met for four days for design u Goals of the language: l Close to mathematical notation l Good for describing algorithms l Must be translatable to machine code Organization of Programming Languages-Cheng (Fall 2004) 24

ALGOL 58 and 60 u ALGOL 58 Language Features: l Concept of type was

ALGOL 58 and 60 u ALGOL 58 Language Features: l Concept of type was formalized l Names could have any length l Arrays could have any number of subscripts l Parameters were separated by mode (in & out) l Subscripts were placed in brackets l Compound statements (begin. . . end) Semicolon as a statement separator Organization ofl. Programming Languages-Cheng (Fall 2004) 25

ALGOL 58 u Comments: l Not meant to be implemented, but variations of it

ALGOL 58 u Comments: l Not meant to be implemented, but variations of it were (MAD, JOVIAL) l Although IBM was initially enthusiastic, all support was dropped by mid-1959 Organization of Programming Languages-Cheng (Fall 2004) 26

ALGOL 58 and 60 u ALGOL 60 l Modified ALGOL 58 at 6 -day

ALGOL 58 and 60 u ALGOL 60 l Modified ALGOL 58 at 6 -day meeting in Paris l New features: u Block structure (local scope) u Two parameter passing methods u Subprogram recursion u Stack-dynamic arrays u Still no I/O and no string handling Organization of Programming Languages-Cheng (Fall 2004) 27

ALGOL 60 u Successes: l It was the standard way to publish algorithms for

ALGOL 60 u Successes: l It was the standard way to publish algorithms for over 20 years l All subsequent imperative languages are based on it l First machine-independent language l First language whose syntax was formally defined (BNF) Organization of Programming Languages-Cheng (Fall 2004) 28

ALGOL 60 u Failure: l Never widely used, especially in U. S. u Reasons:

ALGOL 60 u Failure: l Never widely used, especially in U. S. u Reasons: l No I/O and the character set made programs non-portable l Too flexible--hard to implement l Entrenchment of FORTRAN l Formal syntax description l Lack of support of IBM Organization of Programming Languages-Cheng (Fall 2004) 29

COBOL - 1960 u Environment of development: l UNIVAC was beginning to use FLOWMATIC

COBOL - 1960 u Environment of development: l UNIVAC was beginning to use FLOWMATIC l USAF was beginning to use AIMACO l IBM was developing COMTRAN Organization of Programming Languages-Cheng (Fall 2004) 30

COBOL u Based on FLOW-MATIC u FLOW-MATIC features: l Names up to 12 characters,

COBOL u Based on FLOW-MATIC u FLOW-MATIC features: l Names up to 12 characters, with embedded hyphens l English names for arithmetic operators (no arithmetic expressions) l Data and code were completely separate l Verbs were first word in every statement Organization of Programming Languages-Cheng (Fall 2004) 31

COBOL u u First Design Meeting (Pentagon) - May 1959 Design goals: l Must

COBOL u u First Design Meeting (Pentagon) - May 1959 Design goals: l Must look like simple English l Must be easy to use, even if that means it will be less powerful l Must broaden the base of computer users l Must not be biased by current compiler problems Design committee members were all from computer manufacturers and Do. D branches Design Problems: arithmetic expressions? subscripts? Fights among manufacturers Organization of Programming Languages-Cheng (Fall 2004) 32

COBOL u Contributions: l First macro facility in a high-level language l Hierarchical data

COBOL u Contributions: l First macro facility in a high-level language l Hierarchical data structures (records) l Nested selection statements l Long names (up to 30 characters), with hyphens l Separate data division Organization of Programming Languages-Cheng (Fall 2004) 33

COBOL u Comments: l First language required by Do. D; would have failed without

COBOL u Comments: l First language required by Do. D; would have failed without Do. D l Still the most widely used business applications language Organization of Programming Languages-Cheng (Fall 2004) 34

BASIC - 1964 u Designed by Kemeny & Kurtz at Dartmouth u Design Goals:

BASIC - 1964 u Designed by Kemeny & Kurtz at Dartmouth u Design Goals: l Easy to learn and use for non-science students l Must be “pleasant and friendly” l Fast turnaround for homework l Free and private access l User time is more important than computer time u Current popular dialect: (Fall Visual Organization of Programming Languages-Cheng 2004) BASIC 35

PL/I - 1965 u Designed by IBM and SHARE u Computing situation in 1964

PL/I - 1965 u Designed by IBM and SHARE u Computing situation in 1964 (IBM's point of view) l Scientific computing u IBM 1620 and 7090 computers u FORTRAN u SHARE user group l Business computing u IBM 1401, 7080 computers u COBOL u GUIDELanguages-Cheng user group (Fall 2004) Organization of Programming 36

PL/I u By 1963, however, l Scientific users began to need more elaborate I/O,

PL/I u By 1963, however, l Scientific users began to need more elaborate I/O, like COBOL had; Business users began to need floating point and arrays (MIS) l It looked like many shops would begin to need two kinds of computers, languages, and support staff--too costly u The obvious solution: l Build a new computer to do both kinds of applications Organization of Programming Languages-Cheng (Fall 2004) 37 l Design a new language to do both kinds of

PL/I u Designed in five months by the 3 X 3 Committee u PL/I

PL/I u Designed in five months by the 3 X 3 Committee u PL/I contributions: l First unit-level concurrency l First exception handling l Switch-selectable recursion l First pointer data type l First array cross sections Organization of Programming Languages-Cheng (Fall 2004) 38

PL/I u Comments: l Many new features were poorly designed l Too large and

PL/I u Comments: l Many new features were poorly designed l Too large and too complex l Was (and still is) actually used for both scientific and business applications Organization of Programming Languages-Cheng (Fall 2004) 39

APL and SNOBOL u Characterized by dynamic typing and dynamic storage allocation u APL

APL and SNOBOL u Characterized by dynamic typing and dynamic storage allocation u APL (A Programming Language) 1962 l Designed as a hardware description language (at IBM by Ken Iverson) l Highly expressive (many operators, for both scalars and arrays of various dimensions) l Programs are very difficult to read Organization of Programming Languages-Cheng (Fall 2004) 40

APL and SNOBOL u SNOBOL(1964) l Designed as a string manipulation language (at Bell

APL and SNOBOL u SNOBOL(1964) l Designed as a string manipulation language (at Bell Labs by Farber, Griswold, and Polensky) l Powerful operators for string pattern matching Organization of Programming Languages-Cheng (Fall 2004) 41

SIMULA 67 - 1967 u Designed primarily for system simulation (in Norway by Nygaard

SIMULA 67 - 1967 u Designed primarily for system simulation (in Norway by Nygaard and Dahl) u Based on ALGOL 60 and SIMULA I u Primary Contribution: l Co-routines - a kind of subprogram l Implemented in a structure called a class l Classes are the basis for data abstraction l Classes are structures that include both local data and functionality l Objects and inheritance Organization of Programming Languages-Cheng (Fall 2004) 42

ALGOL 68 - 1968 u From the continued development of ALGOL 60, but it

ALGOL 68 - 1968 u From the continued development of ALGOL 60, but it is not a superset of that language u Design is based on the concept of orthogonality u Contributions: l User-defined data structures l Reference types l Dynamic arrays (called flex arrays) Organization of Programming Languages-Cheng (Fall 2004) 43

ALGOL 68 u Comments: l Had even less usage than ALGOL 60 l Had

ALGOL 68 u Comments: l Had even less usage than ALGOL 60 l Had strong influence on subsequent languages, especially Pascal, C, and Ada Organization of Programming Languages-Cheng (Fall 2004) 44

Important ALGOL Descendants u Pascal - 1971 l Designed by Wirth, who quit the

Important ALGOL Descendants u Pascal - 1971 l Designed by Wirth, who quit the ALGOL 68 committee (didn't like the direction of that work) l Designed for teaching structured programming l Small, simple, nothing really new l From mid-1970 s until the late 1990 s, it was the most widely used language for teaching programming in colleges Organization of Programming Languages-Cheng (Fall 2004) 45

Important ALGOL Descendants u. C - 1972 l Designed for systems programming (at Bell

Important ALGOL Descendants u. C - 1972 l Designed for systems programming (at Bell Labs by Dennis Richie) l Evolved primarily from B, but also ALGOL 68 l Powerful set of operators, but poor type checking l Initially spread through UNIX Organization of Programming Languages-Cheng (Fall 2004) 46

Important ALGOL Descendants u Modula-2 - mid-1970 s (Wirth) l Pascal plus modules and

Important ALGOL Descendants u Modula-2 - mid-1970 s (Wirth) l Pascal plus modules and some low-level features designed for systems programming u Modula-3 - late 1980 s (Digital & Olivetti) l Modula-2 plus classes, exception handling, garbage collection, and concurrency Organization of Programming Languages-Cheng (Fall 2004) 47

Important ALGOL Descendants u Oberon - late 1980 s (Wirth) l Adds support for

Important ALGOL Descendants u Oberon - late 1980 s (Wirth) l Adds support for OOP to Modula-2 l Many Modula-2 features were deleted (e. g. , for statement, enumeration types, with statement, noninteger array indices) Organization of Programming Languages-Cheng (Fall 2004) 48

Prolog - 1972 u Developed at the University of Aix-Marseille, by Comerauer and Roussel,

Prolog - 1972 u Developed at the University of Aix-Marseille, by Comerauer and Roussel, with some help from Kowalski at the University of Edinburgh u Based on formal logic u Non-procedural u Can be summarized as being an intelligent database system that uses an inferencing process to infer the truth of given queries Organization of Programming Languages-Cheng (Fall 2004) 49

Ada - 1983 (began in mid-1970 s) u Huge design effort, involving hundreds of

Ada - 1983 (began in mid-1970 s) u Huge design effort, involving hundreds of people, much money, and about eight years u Environment: More than 450 different languages being used for DOD embedded systems (no software reuse and no development tools) u Contributions: l Packages - support for data abstraction l Exception handling - elaborate l Generic program units Organization of Programming Languages-Cheng (Fall 2004) l Concurrency - through the tasking model 50

Ada u Comments: l Competitive design l Included all that was then known about

Ada u Comments: l Competitive design l Included all that was then known about software engineering and language design l First compilers were very difficult; the first really usable compiler came nearly five years after the language design was completed Organization of Programming Languages-Cheng (Fall 2004) 51

Ada u Ada 95 (began in 1988) l Support for OOP through type derivation

Ada u Ada 95 (began in 1988) l Support for OOP through type derivation l Better control mechanisms for shared data (new concurrency features) l More flexible libraries Organization of Programming Languages-Cheng (Fall 2004) 52

Smalltalk - 1972 -1980 u Developed at Xerox PARC, initially by Alan Kay, later

Smalltalk - 1972 -1980 u Developed at Xerox PARC, initially by Alan Kay, later by Adele Goldberg u First full implementation of an object-oriented language (data abstraction, inheritance, and dynamic type binding) u Pioneered the graphical user interface everyone now uses Organization of Programming Languages-Cheng (Fall 2004) 53

C++ - 1985 u u u u Developed at Bell Labs by Stroustrup Evolved

C++ - 1985 u u u u Developed at Bell Labs by Stroustrup Evolved from C and SIMULA 67 Facilities for object-oriented programming, taken partially from SIMULA 67, were added to C Also has exception handling A large and complex language, in part because it supports both procedural and OO programming Rapidly grew in popularity, along with OOP ANSI standard approved in November, 1997 Organization of Programming Languages-Cheng (Fall 2004) 54

C++ Related Languages u Eiffel - a related language that supports OOP l (Designed

C++ Related Languages u Eiffel - a related language that supports OOP l (Designed by Bertrand Meyer - 1992) l Not directly derived from any other language l Smaller and simpler than C++, but still has most of the power u Delphi (Borland) l Pascal plus features to support OOP l More elegant and safer than C++ Organization of Programming Languages-Cheng (Fall 2004) 55

Java (1995) u Developed at Sun in the early 1990 s u Based on

Java (1995) u Developed at Sun in the early 1990 s u Based on C++ l Significantly simplified (does not include struct, union, enum, pointer arithmetic, and half of the assignment coercions of C++) l Supports only OOP l Has references, but not pointers l Includes support for applets and a form of concurrency Organization of Programming Languages-Cheng (Fall 2004) 56

Scripting Languages for the Web u Java. Script l Used in Web programming (client-side)

Scripting Languages for the Web u Java. Script l Used in Web programming (client-side) to create dynamic HTML documents l Related to Java only through similar syntax u PHP l Used for Web applications (server-side); produces HTML code as output Organization of Programming Languages-Cheng (Fall 2004) 57

C# u Part of the. NET development platform u Based on C++ and Java

C# u Part of the. NET development platform u Based on C++ and Java u Provides a language for component-based software development u All. NET languages (C#, Visual BASIC. NET, Managed C++, J#. NET, and Jscript. NET) use Common Type System (CTS), which provides a common class library u Likely to become widely used Organization of Programming Languages-Cheng (Fall 2004) 58