Programming Languages • What is a programming language? – systematic notation by which we describe computational processes to others – notation for description of algorithms and data structures computational process – set of steps solve a problem • computer’s built-in abilities: PRIMITIVE/ constitute Machine Language – arithmetic and logical operations – I/O – Some “control” functions • High-level programming languages – less primitive notations/ need system software to translate 1 Why study programming languages? • Linguistic theory states: structure of language defines boundaries of thought ?TRUE? • Language can facilitate or impede certain modes of thought • A given programming language can influence class of solutions 2 Benefits of studying languages? • Computer Scientists – – – – – – Improve ability to develop algorithms Improve existing use of language Increase vocabulary of programming constructs Allow choice of language Easier to learn new language Easier to design new language (user interfaces) • Language Designers/Implementers – insights from motivation of language facilities to make implementation tradeoffs 3 Benefits of studying languages? • Hardware Architects – gain insight into ways machines may better support languages – design a semantically coherent machine w/ complete sets of data types and operations • System designers – apply to human interfaces – JCL’s, DB systems, editors, text formatters, debuggers have many characteristics of a programming language – Necessary for file systems, linkage editors to interface with programming languages • Software Managers – choice of language – choice of extension of language or new language and know costs 4 Early History 1500-3000 B.C. earliest know algorithm on clay tablets in Babylon (near Baghdad, Iraq) • produced mathematical tables • solved algebraic equations using an “algorithm” • at end put “this is the procedure” • did not have conditional tests (no 0 or negative numbers) • did have repetition 5 Early History • 300 B.C. Euclid Greece – algorithm for computing GCD of 2 integers (zero still not recognized, so special cases) • 19th, early 20th century – Charles Babbage English – 2 machines: • Difference Engine: finite differences, repeated additions, math tables • Analytical Engine: many principles of modern computer, any calculation Store = main memory Mill=ALU barrel = control unit TABLE 1.2 on Handout – Influences on programming language development 6 7 8 Early Computer programming languages by category • Numerical • WWII 30/40s “electronic calculators” to solve numerical problems • 50s symbolic notations/compilation necessary • 1955-57 Backus’ team – developed FORTRAN – – – – – numerical calculations full-fledged programming language (control structs, cond, I/O statements) to compete w/ assembly made very efficient! Extremely successful 1958 – Fortran II Fortran IV Fortran 77, 90 backwards compatible 9 Early Computer programming languages by category • Success of FORTRAN -> fear in Europe of domination of IBM – – – – – leader Naur of (German Math Society) joined by ACM despite fear ALGOL (Algorithmic Language) 58, 60 Standard in “academia” GOALS (4) • • • • Close to standard math Useful to describe algorithm Compilable Machine independent (no I/O) – Not successful – MAJOR IMPACT – syntactic notation BNF 10 Early Computer programming languages by category • AI Languages 50s – IPL – Info Processing language by Rand Corp (widely known, but use limited) – John McCarthy of MIT designed LISP (List Processing) for IBM 704 => Scheme and Common Lisp • list processing FUNCTIONAL Language • usual problems: searching text processing => SNOBOL – Prolog – special purpose based on math logic 11 Early Computer programming languages by category • Systems Languages – – – Assembly language CPL, BCPL – not widespread C – Unix written mostly in C in 1970s 12 ROLE of Programming Languages •Early: efficient design computers and time expensive vs programmers minor cost • 60s: machines less expensive, programmers more => need portability, maintainability, ease of use • programming languages evolving • COBOL dropping => application generators • APL, PL/1, SNOBOL – practically disappeared • Pascal – past prime, but continued in Ada • Ada – ground lost to C++ and Java • Delphi and C++ Builder • Fortran revised (for supercomputers) Influences • capabilities of computers • applications: now games, PCs • programming methods: environment changes, good methods known now • implementation methods -> effect choices of features • theory: deepened understanding of strengths and weaknesses • standards 14 Historical Development of Java C++ 1983 Java 1991 Smalltalk-80 1980 Java 1 1995 Java 1.2 1998 Java 1.3 2000 Java 1.4 2002 Java 5.0 2005 Java SE 6 2007 Java SE 7 2011 7.25 2013 Java SE 8 Mar 2014 Scheme 1984 Lisp1.5 1962 Other references: • • • http://www.java.com/en/javahistory/index.jsp http://ils.unc.edu/blaze/java/javahist.html http://ei.cs.vt.edu/~wwwbtb/book/chap1/java_hist.html 15 Historical Languages • C - general-purpose, imperative computer programming language • C++- Based on C, but has imperative, objectoriented and generic programming feature • Smalltalk - object-oriented, dynamically typed, reflective programming language. It was designed and created in part for educational use, more so for constructionist learning • Lisp - practical mathematical notation for computer programs, influenced by Church's lambda calculus. It quickly became the favored programming language for artificial intelligence (AI) research • Scheme - a minimalist, multi-paradigm dialect of Lisp 16 Historical Development of Python B 1981 Modula 1975 BCPL 1967 Modula 2 1979 ABC 1987 Modula 3 1988 B 1969 Pascal 1970 C 1971 Pascal AFNOR 1983 C (K&R) 1978 Reference: http://www.levenez.com/lang Python 1991 ANSI C 1989 Python 2 1999 Python3 2008 Ruby 1993 17 Historical Languages • BCPL - Originally intended for writing compilers for other languages • B - recursive, non-numeric, machine independent applications, such as system and language software • C - general-purpose, imperative computer programming language • Pascal - small and efficient language intended to encourage good programming practices using structured programming and data structuring. • Modula - main innovation of Modula over Pascal is a module system, used for grouping sets of related declarations into program units 18