Introduction The aim of the course is to offer a comparative overview of the main programming paradigms: Functional Logical Imperative / Object-Oriented Concurrent / Distributed (time permitting) For each paradigm, we will examine: Main characteristics Syntax Semantics Formal methods Implementation aspects Typical applications For each paradigm we will consider one or two real programming language for exercises and practice. We will not study any particular programming language in detail: The purpose of the course is not to learn the skills of programming in a particular language, but rather to understand the general principles of programming languages. This course should provide the ability to: learn new programming languages / new features choose the most appropriate language for a given problem/resources Overview of programming paradigms The languages in blue indicate the languages which we will probably choose for exercises and practice during the course Functional Programming Close to mathematical specification Declarative: Program = specification of the problem (as opposed to the imperative style where Program = specification of the sequence of steps which the machine should perform in order to solve the problem) A program is a function/set of functions, usually defined recursively Computation is the evaluation (simplification) of expressions to values Languages: Lisp, Scheme, FP, Standard ML, Askell,... Logic Programming and Constraint Logic Programming Declarative. Even more declarative than functional programming thanks to the following additional features: automatic backtracking unification / constraint solving A program is a logical theory Computation is proof search Languages: Prolog, Lambda Prolog, CLP(X)... Imperative Programming State and sharing. Efficient implementations (space, time). A program is a sequence of commands (operations which modify the state) Computation is state transformation Languages: Ada, Fortran, Basic, Algol, Pascal, Cobol, Modula, C, ... Object-Oriented Programming Like imperative programming, has notions of state and command. Efficient implementations. A program is the specification of a set of objects: their attributes, and the way they interact with each other Computation is transformation of the state of objects Languages: Small Talk, C++, Java, ... Concurrent and Distributed Programming Several approaches, both from the declarative and the imperative traditions A program is the specification of a set of processes and the way they communicate / interact with each other. Processes are autonomous activities, in principle executed in parallel by different processors Languages: Most commercial languages have concurrent extensions (Parallel Pascal, ADA, Java, Concurrent ML,...) but they offer only a very limited view of the aspects of Concurrent Programming. For practice, we will consider some experimental language like PICT. Levels of programming Languages We can trace a brief history of programming languages according to their generations. First Generation: Machine Languages. The native language of machines. Binary representation. Machine dependent Second Generation: Assembly Languages. Uses Mnemonics to abstract from binary representation Uses symbolic addresses to abstract from absolute adressing Third Generation: High-level Languages. Uses Data and Control structures as high-level abstractions of programming concepts coded directly in assembly languages Machine independence Examples: FORTRAN, Algol60, Algol68, Pascal, C, Ada, ... Fourth Generation: Declarative Languages. Departs from traditional approach to programming languages by using declarative notions from mathematics to provide the notion of computation. Not an abstraction of a previous generation. Much harder to produce efficient implementations. Examples: Standard ML, Lisp, Haskel, Prolog, lambdaProlog Fifth Generation Languages. Term coined by the Japanese in the early 1980's ("Fifth Generation Project) during their attempt to develop of new style of programming languages and new hardware on which to implement these languages. Examples: Constraint Logic Programming (CLP)? ---