A programming language is basically a notation for problem solving using computers. What does the programming language give to the programmer? Power? Power to compute functions? NO. All the PLs are equivalent in their computational power -- that of the Turing machine. Let us now look at "problem solving". The following are some of the problem domains and their needs. numerical - algorithms text processing - pattern matching database - search networking - mobility, security graphics - event-driven So programming languages offer notations which make the above tasks simple for the programmer. Over the years, PLs have evolved so that they are put to multiple uses. (1) tool for instructing machine - in a robust, machine independent manner (2) communication between programmers - software reuse (3) expression of higher level designs (4) tool for experimentation (5) general purpose commodity - reduction in development costs A PL should not only provide "raw features" for problem solving, but also a convenient notation. Example: roman and conventional number representation How much difference does the notation make? According to strong Sapir-Whorf hypothesis, "language influences thought". So the language used matters a lot! Consider the number representation systems: roman and the positional. Both of them can represent natural numbers equally well. 9 IX 19 XIX Many operations are easy with the positional system. The positional notation "suggests" the notion of addition (at least with hindsight!). --------------------------------------------------------------------------- Some important languages in the history of PL Fortran (1956, 1958): Fortran was designed by a small group lead by John Backus at IBM. The aim was to develop a language to facilitate scientific computation. Fortran's contributions are: arrays, procedures, formatted I/O, and branchs and loops. Cobol (1959): Cobol was designed on the initiative of Department of Defense. It was targeted to business applications. It used noise words to improve program readability. Lisp (1969): Lisp was developed by John McCarthy at MIT. The aim was to develop a mathematically sound language for AI applications. Lisp introduced and implemented recursion. Programs and data were identical. Algol (1960+): Algol was designed by a group of researchers to provide a "clean" language for algorithms. Algol pioneered many of the concepts of stuctured programming: structured types, structured control, lexical scoping, readability, etc. There were very few implementations of Algol. Simula (1967): Simula was developed by Kristen Nygaard and Ole-Johan Dahl for simulations. Many of the notions of object oriented programming have their roots in Simula. Prolog (1972): Prolog was develped by Alain Colmerauer and Philippe Roussel. The application area was AI (natural language understanding). In Prolog, facts and rules are declared and the computer finds the answer through search. So Prolog is a classic case of a "declarative language". Prolog has its roots in logic and it is also a logic programming language. ------------------------------------------------------------------------- Why new languages? new application areas changing perspectives single programmer multiple programmers - design & development maintainance reuse automatic provability/testing => there will be always be new languages ------------------------------------------------------------------------- Course objectives (1) study existing languages (2) design new language features "analysis by synthesis" Languages: C - imperative Java - OOP ML - functional Perl/awk - scripting "programming about PL" Schedule: ------------------------------------------------------------------------- PL PARADIGMS Programming language is a notation (for programmers) to solve problems using computers. So a programming language has at least three aspects. [programmer] / \ / \ / \ / \ / \ / \ / \ [problems] [computer] [computer]: There are many models of computation. Each model has inspired a programming language. The models and the languages are: Turing machine/von Neumann architecture: imperative languages (C) lambda calculus - functional languages (Lisp) production systems, predicate calculus - logic languages (Prolog) [problems]: As discussed above, each PL is designed for a particular problem domain. Is there a PL which is suitable for *all* domains? The answer comes from Simula - which was designed for simulation. A simulation language should be able to model any aspect of the world. At a high level, the world is a collection of objects. Each object has a state (internal) and a behavior (external). For example, human beings have the states: happy, hungry, etc and behaviors: smiling, eating, etc. The state is available only to the object itself and other objects can observe only the behavior. This leads to the notion of object data (state) which is private and object methods (behavior) which are public. This is the foundation of object oriented programming. OOP also has the benefits of: class hierarchy (a concept borrowed from AI), code reuse, etc. ---------------------------------------------------------------------------