CS334 Principles of Programming Languages

Lecture 1

Dan Norcross is TA - will arrange for a few evening hours when learning a new language.

Does the language matter?

Absolutely!!!

Otherwise, why would the Java folks have rejected C++ for their programming language?

Explore in this course all aspects of programming languages, including their features, type systems, programming styles supported, and implementations.

Programming languages mediate between computers and humans, allowing us to express or understand algorithms to be executed by the computer.

By providing abstractions (or mechanisms to create abstractions) they influence the way we think about problems.

Data abstractions:

  • basic data types: integers, reals, booleans, characters, pointers

  • structured: arrays, records

  • unit: E.g., support for ADT's, modules, packages, classes

  • Control abstractions:

  • basic: assignment, goto, sequencing

  • structured: if..then..else.., loops, procedures & functions

  • unit: separately compiled units, modules, packages, concurrent tasks

  • For all constructs need to have clearly specified syntax and semantics:

  • syntax: what is a legal expression?

  • semantics: what is the result when it is executed?

  • Syntax always given formally (as well as informally).

    Semantics usually given informally (English), but more and more formally.

    Both necessary in order to ensure programs give predictable results.

    How can programming languages support the software development process?

    Phases in the development process are:

  • Requirements
  • Specification
  • Implementation
  • Certification or Validation (includes testing and verification)
  • Maintenance
  • Need to evaluate languages with respect to overall picture. Not good if just supports one aspect. Important to evaluate language based on what its goals are. I.e.,
  • BASIC - quick development of interactive programs

  • Pascal - instruction

  • C - low-level systems programming

  • Languages which are good for quick hacking together of programs may not be suitable for large-scale software development.

    Ada, Modula-2, Clu, object-oriented languages like C++, Eiffel, etc.

    Most languages today designed to support specific software development methodology or philosophy. E.g., top-down design, object-based design, encapsulation, information-hiding.

    Languages influence the way people think about programming process.

    Faculty always complain about BASIC hackers.

    Important to be aware of different programming language paradigms, allow one to think about problems in different ways.

    Partially driven by new architectures (or at least not constrained by old).

    Imperative is closest to machine architecture.

    Other paradigms:

  • Functional - Popular in AI (LISP & Scheme) and theoretical prog. lang. community.
    Closest to theoretical models and mathematics.

  • logic - Originally of interest in AI (though fading).
    Also important as database query languages.
    Now shifting to "constraint" languages.
    Declarative, control implicit in search.

  • object-oriented - Latest fad. All major systems must be "object-oriented" to be up-to-date. Important, but current languages have some flaws.
    Based on discrete simulation, objects responsible for knowing what to do.
    Package state with appropriate operations.
  • Minimum requirements for programming languages:
  • Universal - if can solve on computer then can program it in the language
  • Natural (expressive) - easy to express ideas.
  • Implementable
  • Efficient (for writing, compilation, or execution?)
  • Reliable - writeable (high-level), readable, ability to deal with exceptional behavior)
  • Maintainable - Easy to make changes, decisions compartmentalized, clean interfaces.
  • History of Programming Languages

    Machine language -> Assembly language -> High-level languages

    Programmers: Single highly trained programmer -> large teams which must cooperate

    Early:

  • FORTRAN - Backus @ IBM, 1957, 18 person-years to write first compiler,
    Goals & contributions: numerical problems, very efficient compiler, separate compilation
    Many revisions FORTRAN II, IV, 66, 77, 9x

  • ALGOL 60 - Committee, 1960
    Goals & contributions: numeric, block structure, recursion, elegant, very influential
    Ancestor of ALGOL W, ALGOL 68, Pascal, Modula, Ada, etc.

  • COBOL - Committee, 1960
    Goals & contributions: business data processing, records
    Several revisions

  • Early Schisms:

  • LISP - McCarthy @ MIT, 1962, core is functional
    Goals & contributions: List processing and symbolic manipulation, AI
    Scheme & Common LISP are modern descendents

  • APL - Iverson @ Harvard, IBM, 1960 (for notation),
    calculator language for array computations.

  • SNOBOL 4 - Griswold @ Bell Labs, 1966 - string processing via pattern matching
    modern successor is ICON

  • Consolidation:

  • PL/I - IBM committee, 1967 - combine FORTRAN, COBOL, ALGOL 60 - but not integrated, now considered a failure.
    Multipurpose - include ptrs, records, exceptions, etc.

  • Next Leap Forward:

  • ALGOL 68 - Committee, "orthogonal" elements, elegant but very hard to understand

  • Simula 67 - precursor of object-oriented languages - designed for simulation, coroutines

  • Pascal - Wirth, ETH, 1971 - designed only as a teaching language
    Support structured programming, spare & elegant
    Successful beyond expectations

  • Abstract Data Types:

  • Clu, Mesa, Modula-2, Ada
    Supports modules for encapsulation and information hiding

  • Other paradigms:

  • Object-oriented: Smalltalk (1972), Eiffel, C++, Object Pascal, and now Java.

  • Functional: Scheme (1985?), ML (1978), Miranda (1986) & Haskell (1991).

  • Logic: PROLOG (1972), newer constraint programming languages.

    4th generation languages: Important in business applications

    Specialized packages of powerful commands w/simplified "user-friendly" syntax.

  • Family tree of important programming languages

    Topics to be covered in course:

  • Programming language features and organization, including modules, classes, exception handlers, generic types

  • functional, object-oriented, and logic, as well as imperative paradigms

  • Programming language support for reliable programming:

    abstraction, encapsulation, information hiding, polymorphism, higher-order operators.

  • Language support for concurrency

  • Formal definitions of programming languages

  • Compilers and interpreters

  • Run-time behavior of programming languages, including impact of binding time.
  • Start out by learning ML so can explore some new ideas & rapidly program interesting applications.

    Write our own interpreters for simple languages so can see impact of various design decisions.