Einführung in die Informatik 2. Programming Languages, Paradigms and Technology Institut für Informatik und angewandte Mathematik.

Slides:



Advertisements
Similar presentations
1 Scheme and Functional Programming Aaron Bloomfield CS 415 Fall 2005.
Advertisements

Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Introduction to Programming Languages Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
Software Language Levels Machine Language (Binary) Assembly Language –Assembler converts Assembly into machine High Level Languages (C, Perl, Shell)
The Analytical Engine Module 6 Program Translation.
High-Level Programming Languages
The Evolution of Programming Languages
Einführung in die Informatik 2. Programming Languages, Paradigms and Technology Institut für Informatik und angewandte Mathematik.
Programming Languages Structure
6/27/2015G. Levine1 PROGRAMMING LANGUAGES Text: Programming Languages, Design and Implementation Pratt and Zelkowitz 4 th ed. Prentice-Hall.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 1, Lab.
Comp 205: Comparative Programming Languages Imperative Programming Languages Functional Programming Languages Semantics Other Paradigms Lecture notes,
Chapter 1 The Big Picture Chapter Goals Describe the layers of a computer system Describe the concept of abstraction and its relationship to computing.
CS 415: Programming Languages Chapter 1 Aaron Bloomfield Fall 2005.
Programming Languages – Coding schemes used to write both systems and application software A programming language is an abstraction mechanism. It enables.
PZ01A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ01A -- Introduction Programming Language Design and.
High-Level Programming Languages: C++
1Object-Oriented Program Development Using C++ Computer Science and Programming Languages Computers are ubiquitous Computer literacy is essential Computer.
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
CIS Computer Programming Logic
A little bit of history Jordi Cortadella Department of Computer Science.
Chapter 1. Introduction.
BIT 1003 – Presentation 7. Contents GENERATIONS OF LANGUAGES COMPILERS AND INTERPRETERS VIRTUAL MACHINES OBJECT-ORIENTED PROGRAMMING SCRIPTING LANGUAGES.
©Xiaoying Gao, Peter Andreae First Java Program COMP 102 #2 2014T2 Xiaoying Sharon Gao Computer Science Victoria University of Wellington.
Programming Languages –14 David Watt (Glasgow) Steven Wong (Singapore) Moodle : Computing Science → Level 3 → Programming Languages 3 © 2012 David.
Chapter 1 - Introduction
First Java Program COMP 102 #2 2015T2 Xiaoying Sharon Gao Computer Science Victoria University of Wellington.
By Neng-Fa Zhou1 Evolution of programming languages –Machine language –Assembly language –Sub-routines and loop (Fortran) –Procedures and recursion (Algol,
1 Programming Language History and Evolution In Text: Chapter 2.
1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
Introduction to Bash Programming Ellen Zhang. Previous three classes What have we learnt so far ?
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Chapter 12 Computer Programming. Chapter Contents Chapter 12: Computer Programming 2  Section A: Programming Basics  Section B: Procedural Programming.
Chapter 6 Programming Languages (1) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Programming Language 1. Programming language A programming language is a machine-readable artificial language designed to express computations that can.
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
Theory of Programming Languages Introduction. What is a Programming Language? John von Neumann (1940’s) –Stored program concept –CPU actions determined.
Programming Languages
Logical and Functional Programming
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
Programming Languages
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
int k = Integer.MAX_VALUE; k++; int k = Integer.MAX_VALUE; k++; What happens when the following code executes? byte b = someFile.readByte(); b = (byte)(b.
Programming Language Concepts (CIS 635) Elsa L Gunter 4303 GITC NJIT,
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Objective of the course Understanding the fundamentals of the compilation technique Assist you in writing you own compiler (or any part of compiler)
Programming Language Paradigms ITSK2314 Lecture 3.
a medium allowing humans and computers to communicate an abstraction of the real world a notation for expressing algorithms the set of all syntactically.
History. Development Driven by Function Functions of a Programming Language –To describe computation for use by computers –To describe computation and.
Programming Language History and Evolution
Chapter 1. Introduction.
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Programming Languages 2nd edition Tucker and Noonan
Functional Programming
Jordi Cortadella Department of Computer Science
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
PROGRAMMING LANGUAGES
CSCI-235 Micro-Computer Applications
课程名 编译原理 Compiling Techniques
Programming Language History and Evolution
Jordi Cortadella Department of Computer Science
Computer Programming.
Ada – 1983 History’s largest design effort
Einführung in die Informatik
Lecture 8 Programming Paradigm & Languages. Programming Languages The process of telling the computer what to do Also known as coding.
강의 내용 및 방법 접근방법 리포트 시험 Lambda Calculus, Proof of Correctness
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Presentation transcript:

Einführung in die Informatik 2. Programming Languages, Paradigms and Technology Institut für Informatik und angewandte Mathematik

© Oscar Nierstrasz 2 Roadmap  What is a programming language?  Programming = modeling  Evolution  Trends and Challenges Programming Languages, Paradigms and Technology

© Oscar Nierstrasz Programming Languages, Paradigms and Technology 3 Übersicht Informatik Theorie (Automaten und formale Sprachen, Berechenbarkeit, Komplexität, Logik, Algorithmen) Praxis (Programmiersprachen, Betriebssysteme, Netzwerke &Verteilte Systeme, Software Engineering, Datenbanken, Rechnerarchitektur) Schnittstellen zur Aussenwelt (Mensch-Maschine Schnittstelle, Computer- vision, Computergrafik, Sensornetze, Künstliche Intelligenz, Computerlinguistik) Wirtschaftsinformatik Anwendungs- software Wissenschaftliche Anwendungen (Modellierung und Simulation, Biologie, Physik, Chemie, Sozialwissenschaften, etc.) Informatikstudium Andere Studiengänge Mathematik Programmiersprachen formale Sprachen Computerlinguistik Modellierung Software Engineering

© Oscar Nierstrasz 4 Roadmap  What is a programming language?  Programming = modeling  Evolution  Trends and Challenges Programming Languages, Paradigms and Technology

What is a language? © Oscar Nierstrasz Programming Languages, Paradigms and Technology 5 Language = a set of sequences of symbols that we interpret to attribute meaning Jack and Jill went up the hill …

What is a formal language? © Oscar Nierstrasz Programming Languages, Paradigms and Technology 6 A Turing machine reads (and writes) a tape of 0s and 1s The language it accepts is the set of strings that leave it in an accepting state

How can we describe formal languages? © Oscar Nierstrasz Programming Languages, Paradigms and Technology 7 expression  number expression  expression + expression expression  expression  expression number  digit number  digit number expression  number expression  expression + expression expression  expression  expression number  digit number  digit number Use a set of rules (   ) to describe the structure of the language  5 cf. Chomsky

What is a Programming Language? (take 1) © Oscar Nierstrasz Programming Languages, Paradigms and Technology 8.-…-…-….-… l …-…-….-… l … A language to instruct a computer to compute “stuff” … But how does the computer interpret language?

What is a Programming Language? (take 2) © Oscar Nierstrasz Programming Languages, Paradigms and Technology 9.-…-…-….-… l …-…-….-… l What the compiler will handle … … But what about syntax and semantics? parse analyze transform optimize generate

What is a Programming Language? (take 3) © Oscar Nierstrasz Programming Languages, Paradigms and Technology 10.-…-…-….-… l …-…-….-… l Syntax and semantics in a mathematical domain … But what about the programmer?

What is a Programming Language? (take 4) © Oscar Nierstrasz Programming Languages, Paradigms and Technology 11 A language for communicating software designs

© Oscar Nierstrasz 12 Roadmap  What is a programming language?  Programming = modeling  Evolution  Trends and Challenges Programming Languages, Paradigms and Technology

Over 8000 recorded programming languages © Oscar Nierstrasz Programming Languages, Paradigms and Technology 13 Why so many?!

What do programming languages have in common? © Oscar Nierstrasz Programming Languages, Paradigms and Technology 14 # Compute factorials def fact(n) if n == 0 1 else n * fact(n-1) end puts fact(ARGV[0].to_i) # Compute factorials def fact(n) if n == 0 1 else n * fact(n-1) end puts fact(ARGV[0].to_i) comments keywords functions variables control constructs numbers, strings expressions statements A fragment of Ruby code

Expressive power © Oscar Nierstrasz Programming Languages, Paradigms and Technology 15 Formally, all programming languages are equivalent … So what? …

Programming is modeling © Oscar Nierstrasz Programming Languages, Paradigms and Technology 16

How do these languages differ? © Oscar Nierstrasz Programming Languages, Paradigms and Technology 17 Functional Object-oriented Logic Imperative

© Oscar Nierstrasz 18 Roadmap  What is a programming language?  Programming = modeling  Evolution  Trends and Challenges Programming Languages, Paradigms and Technology

Jacquard loom — 1801 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 19 Punch cards are invented

Babbage’s Analytical Engine — 1822 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 20 The first mechanical computer

Church’s Lambda Calculus — 1932 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 21 (λ x. (λ y. x)) a b The first (minimal) language for studying computation  (λ y. a) b  a if true then a else b

Turing machine — 1936 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 22 The first abstract model of a computer

1 st generation: Machine code — 1944 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 23 Machine code is only meant to be read by … machines

Subroutines — 1949 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 24 The subroutine is one of the key concepts of programming call return

2 nd generation: assembler — early 1950s © Oscar Nierstrasz Programming Languages, Paradigms and Technology 25 Assembly code introduces symbolic names (for humans!)

3 rd generation: FORTRAN — 1955 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 26 High-level languages are born C AREA OF A TRIANGLE - HERON'S FORMULA C INPUT - CARD READER UNIT 5, INTEGER INPUT C OUTPUT - LINE PRINTER UNIT 6, REAL OUTPUT C INPUT ERROR DISPAY ERROR OUTPUT CODE 1 IN JOB CONTROL LISTING INTEGER A,B,C READ(5,501) A,B,C 501 FORMAT(3I5) IF(A.EQ.0.OR. B.EQ.0.OR. C.EQ.0) STOP 1 S = (A + B + C) / 2.0 AREA = SQRT( S * (S - A) * (S - B) * (S - C)) WRITE(6,601) A,B,C,AREA 601 FORMAT(4H A=,I5,5H B=,I5,5H C=,I5,8H AREA=,F10.2,12HSQUARE UNITS) STOP END C AREA OF A TRIANGLE - HERON'S FORMULA C INPUT - CARD READER UNIT 5, INTEGER INPUT C OUTPUT - LINE PRINTER UNIT 6, REAL OUTPUT C INPUT ERROR DISPAY ERROR OUTPUT CODE 1 IN JOB CONTROL LISTING INTEGER A,B,C READ(5,501) A,B,C 501 FORMAT(3I5) IF(A.EQ.0.OR. B.EQ.0.OR. C.EQ.0) STOP 1 S = (A + B + C) / 2.0 AREA = SQRT( S * (S - A) * (S - B) * (S - C)) WRITE(6,601) A,B,C,AREA 601 FORMAT(4H A=,I5,5H B=,I5,5H C=,I5,8H AREA=,F10.2,12HSQUARE UNITS) STOP END IF(A.EQ.0.OR. B.EQ.0.OR. C.EQ.0) STOP 1 S = (A + B + C) / 2.0 AREA = SQRT( S * (S - A) * (S - B) * (S - C))

ALGOL — 1958 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 27 begin... end begin... end Block structure ::= |... ::= |... BNF Recursion

Lisp — 1958 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 28 (defun factorial (n) (if (= n 1) 1 (* n (factorial (- n 1))))) (defun factorial (n) (if (= n 1) 1 (* n (factorial (- n 1))))) Programs as data Garbage collection

COBOL — 1959 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 29 modules ADD YEARS TO AGE. MULTIPLY PRICE BY QUANTITY GIVING COST. SUBTRACT DISCOUNT FROM COST GIVING FINAL-COST. ADD YEARS TO AGE. MULTIPLY PRICE BY QUANTITY GIVING COST. SUBTRACT DISCOUNT FROM COST GIVING FINAL-COST.

10 INPUT "What is your name: ", U$ 20 PRINT "Hello "; U$ 30 INPUT "How many stars do you want: ", N 40 S$ = "" 50 FOR I = 1 TO N 60 S$ = S$ + "*" 70 NEXT I 80 PRINT S$ 90 INPUT "Do you want more stars? ", A$ 100 IF LEN(A$) = 0 THEN GOTO A$ = LEFT$(A$, 1) 120 IF A$ = "Y" OR A$ = "y" THEN GOTO PRINT "Goodbye "; U$ 140 END 10 INPUT "What is your name: ", U$ 20 PRINT "Hello "; U$ 30 INPUT "How many stars do you want: ", N 40 S$ = "" 50 FOR I = 1 TO N 60 S$ = S$ + "*" 70 NEXT I 80 PRINT S$ 90 INPUT "Do you want more stars? ", A$ 100 IF LEN(A$) = 0 THEN GOTO A$ = LEFT$(A$, 1) 120 IF A$ = "Y" OR A$ = "y" THEN GOTO PRINT "Goodbye "; U$ 140 END BASIC — 1964 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 30 interactive programming for the masses interactive programming for the masses

JCL — 1964 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 31 //IS198CPY JOB (IS198T30500),'COPY JOB',CLASS=L,MSGCLASS=X //COPY01 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=OLDFILE,DISP=SHR //SYSUT2 DD DSN=NEWFILE, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(40,5),RLSE), // DCB=(LRECL=115,BLKSIZE=1150) //SYSIN DD DUMMY //IS198CPY JOB (IS198T30500),'COPY JOB',CLASS=L,MSGCLASS=X //COPY01 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=OLDFILE,DISP=SHR //SYSUT2 DD DSN=NEWFILE, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(40,5),RLSE), // DCB=(LRECL=115,BLKSIZE=1150) //SYSIN DD DUMMY invented scripting for IBM 360

Semaphores — 1965 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 32 P — acquire resource … critical section V — release resource P — acquire resource … critical section V — release resource radically simplified concurrency control

Planner — 1969 Prolog — 1972 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 33 man(socrates). mortal(X) :- man(X). man(socrates). mortal(X) :- man(X). Facts and rules ?- mortal(socrates). Yes ?- mortal(socrates). Yes Queries and inferences ?- mortal(elvis). No ?- mortal(elvis). No

Pascal — 1970 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 34 Supports structured programming Successful with PCs function gcd (a, b: integer) : result real; var x : integer; begin if b= 0 then gcd := a else begin x := a; while (x >= b) do begin x := x - b end; gcd := gcd(b,x) end function gcd (a, b: integer) : result real; var x : integer; begin if b= 0 then gcd := a else begin x := a; while (x >= b) do begin x := x - b end; gcd := gcd(b,x) end begin end begin

C — 1972 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 35 Good for portable systems programming Bridging low- and high-level programming #include //echo the command line arguments int main (int argc, char* argv[]) { int i; for (i=1; i<argc; i++) { printf("%s ", argv[i]); } printf("\n"); return 0; } #include //echo the command line arguments int main (int argc, char* argv[]) { int i; for (i=1; i<argc; i++) { printf("%s ", argv[i]); } printf("\n"); return 0; } char* i++

Smalltalk — 1972 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 36 Integer»factorial self = 0 ifTrue: [^ 1]. self > 0 ifTrue: [^ self * (self - 1) factorial]. self error: 'Not valid for negative integers' Integer»factorial self = 0 ifTrue: [^ 1]. self > 0 ifTrue: [^ self * (self - 1) factorial]. self error: 'Not valid for negative integers' 5 factorial  120 Everything is an object Everything happens by sending messages “Dynabook” vision self = 0 ifTrue: [^ 1] self > 0 ifTrue: [^ self * (self - 1) factorial].

ML polymorphic type inference — 1973 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 37 length [ ] = 0 length (x:xs) = 1 + length xs length :: [a] -> Int length "hello"  5 length [10..20]  11 length [ ] = 0 length (x:xs) = 1 + length xs length :: [a] -> Int length "hello"  5 length [10..20]  11 generic functions may be applied to many types of arguments

Monitors — 1974 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 38 structured concurrency control public class Account { protected int assets = 0;... public synchronized void withdraw(int amount) { while (amount > assets) { try { wait(); } catch(InterruptedException e) { } } assets -= amount; }... } public class Account { protected int assets = 0;... public synchronized void withdraw(int amount) { while (amount > assets) { try { wait(); } catch(InterruptedException e) { } } assets -= amount; }... }

Bourne shell — 1977 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 39 cat Notes.txt | tr -c '[:alpha:]' '\012' | sed '/^$/d’ | sort | uniq –c | sort –rn | head -5 cat Notes.txt | tr -c '[:alpha:]' '\012' | sed '/^$/d’ | sort | uniq –c | sort –rn | head -5 Scripting pipelines of commands 14 programming 14 languages 9 of 7 for 5 the 14 programming 14 languages 9 of 7 for 5 the

SQL— 1978 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 40 SELECT * FROM Book WHERE price > ORDER BY title; SELECT * FROM Book WHERE price > ORDER BY title; Domain-specific language for relational databases

Miranda — 1985 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 41 fibs = 1 : 1 : fibsAfter 1 1 fibsAfter a b = (a+b) : fibsAfter b (a+b) fibs = 1 : 1 : fibsAfter 1 1 fibsAfter a b = (a+b) : fibsAfter b (a+b) Lazy evaluation take 10 fibs  [1,1,2,3,5,8,13,21,34,55] take 10 fibs  [1,1,2,3,5,8,13,21,34,55] “Pure” functional programming

Perl — 1987 CGI — 1993 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 42 Text manipulation, then web scripting #!/usr/bin/perl -w print "Content-type: text/html\n\n"; print <<'eof' Directory contents Directory contents eof = ; foreach $file { print ' '. $file. " \n"; } print " \n"; __END__ #!/usr/bin/perl -w print "Content-type: text/html\n\n"; print <<'eof' Directory contents Directory contents eof = ; foreach $file { print ' '. $file. " \n"; } print " \n"; = ; foreach $file { print ' '. $file. " \n"; }

JavaScript — 1995 AJAX — 2005 © Oscar Nierstrasz Programming Languages, Paradigms and Technology 43 Client-side browser scripting

© Oscar Nierstrasz 44 Roadmap  What is a programming language?  Programming = modeling  Evolution  Trends and Challenges Programming Languages, Paradigms and Technology

Components, Frameworks, Patterns — 1990s © Oscar Nierstrasz Programming Languages, Paradigms and Technology 45 So far, limited impact on programming languages …

Model-Driven Development — 1980s, 1990s © Oscar Nierstrasz Programming Languages, Paradigms and Technology 46 software developer Platform Independent Model automatic translation

Trends and Challenges © Oscar Nierstrasz Programming Languages, Paradigms and Technology 47 Bridging gap between users and technology yahoo pipes naked objects subtext graph transformation

Conclusions © Oscar Nierstrasz Programming Languages, Paradigms and Technology 48 Programming languages are for humans not just computers Programming is modeling Programming languages have always evolved to bring programming closer to the users’ problems We are still very early in the history of programming