Top Banner
1 The Evolution of Major Programming Languages Concepts of Programming Languages
108

1 The Evolution of Major Programming Languages Concepts of Programming Languages.

Dec 26, 2015

Download

Documents

Johnathan Cain
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

1

The Evolution of MajorProgramming Languages

Concepts of Programming Languages

Page 2: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

2

Objectives

• Learn about the language of a computer• Learn about the evolution of programming

languages• Examine high-level programming languages• Discover what a compiler is and what it

does

Page 3: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

3

An Overview of the History of Computers

• 1950s: Very large devices available to a few • 1960s: Large corporations owned computers• 1970s: Computers get smaller and cheaper• 1990s: Computers get cheaper and faster and

are found in most homes

Page 4: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

4

Elements of a Computer System

• A computer has 2 components

– Hardware– Software

Page 5: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

5

Hardware Components of a Computer

• Central Processing Unit (CPU)• Main Memory

Page 6: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

6

Central Processing Unit

• Control Unit (CU)• Arithmetic Logic Unit (ALU)• Program Counter (PC)• Instruction Register (IR)• Accumulator (ACC)

Page 7: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

7

Main Memory

• Ordered sequence of cells (memory cells)• Directly connected to CPU• All programs must be brought into main

memory before execution• When power is turned off, everything in

main memory is lost

Page 8: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

8

Main Memory with 100 Storage Cells

Page 9: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

9

Secondary Storage

• Provides permanent storage for information

• Examples of secondary storage:

– Hard Disks– Floppy Disks– ZIP Disks– CD-ROMs– Tapes

Page 10: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

10

Input Devices

• Definition: devices that feed data and computer programs into computers

• Examples:– Keyboard– Mouse– Secondary Storage

Page 11: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

11

Output Devices

• Definition: devices that the computer uses to display results

• Examples:– Printer– Monitor– Secondary Storage

Page 12: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

12

Hardware Components of a Computer

Page 13: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

13

Software

• Software consists of programs written to perform specific tasks

• Two types of programs– System Programs– Application Programs

Page 14: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

14

System Programs

• System programs control the computer

• The operating system is first to load when you turn on a computer

Page 15: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

15

Operating System (OS)

• OS monitors overall activity of the computer and provides services

• Example services:– memory management– input/output– activities– storage management

Page 16: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

16

Application Programs

• Written using programming languages• Perform a specific task• Run by the OS

• Example programs:– Word Processors– Spreadsheets– Games

Page 17: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

17

Language of a Computer

• Machine language: the most basic language of a computer

• A sequence of 0s and 1s • Every computer directly understands its

own machine language• A bit is a binary digit, 0 or 1• A byte is a sequence of eight bits

Page 18: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

18

Evolution of Programming Languages

• Early computers programmed in machine language

• Assembly languages were developed to make programmer’s job easier

• In assembly language, an instruction is an easy-to-remember form called a mnemonic

• Assembler: translates assembly language instructions into machine language

Page 19: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

19

Instructions in Assembly and Machine Language

Page 20: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

20

Evolution of Programming Languages

• High-level languages make programming easier

• Closer to spoken languages• Examples:

– Basic – FORTRAN– COBOL– C/C++– Java

Page 21: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

21

Evolution of Programming Languages

To run a Java program:

1. Java instructions need to be translated into an intermediate language called bytecode

2. Then the bytecode is interpreted into a particular machine language

Page 22: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

22

Evolution of Programming Languages

• Compiler: A program that translates a program written in a high-level language into the equivalent machine language. (In the case of Java, this machine language is the bytecode.)

• Java Virtual Machine (JVM) - hypothetical computer developed to make Java programs machine independent

Page 23: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

23

Processing a Java Program

• Two types of Java programs: applications and applets

• Source program: Written in a high-level language

• Linker: Combines bytecode with other programs provided by the SDK and creates executable code

• Loader: transfers executable code into main memory

• Interpreter: reads and translates each bytecode instruction into machine language and then executes it

Page 24: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

24

Processing a Java Program

Page 25: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

25

Problem-Analysis-Coding-Execution Cycle

• Algorithm: A step-by-step problem-solving process in which a solution is arrived at in a finite amount of time

Page 26: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

26

Problem-Solving Process

1. Analyze the problem: outline solution requirements and design an algorithm

2. Implement the algorithm in a programming language (Java) and verify that the algorithm works

3. Maintain the program: use and modify if the problem domain changes

Page 27: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

27

Problem-Analysis-Coding-Execution Cycle

Page 28: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

28

Programming Methodologies

• Two basic approaches to programming design:

– Structured design – Object-oriented design

Page 29: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

29

Structured Design

1. A problem is divided into smaller subproblems

2. Each subproblem is solved3. The solutions of all subproblems are then

combined to solve the problem

Page 30: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

30

Object-Oriented Design (OOD)

• In OOD, a program is a collection of interacting objects

• An object consists of data and operations

• Steps in OOD:1. Identify objects2. Form the basis of the solution3. Determine how these objects interact

Page 31: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

31

Programming Language Dilemma

• How to instruct computer what to do?– Need a program that computer can execute– Must be written in machine language

• Unproductive to code in machine language

• Design a higher level language• Implement higher level language

– Alternative 1: Interpreter– Alternative 2: Compiler

Page 32: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

32

Compilation As Translation

Generated Program in

Machine Language

Source Program in Some Programming

Language

Compiler

Starting Point

EndingPoint

Page 33: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

33

Starting Point

Programming language (Java, C, C++)• State

– Variables, – Structures, – Arrays

• Computation– Expressions (arithmetic, logical, etc.)– Assignment statements– Control flow (conditionals, loops)– Procedures

Page 34: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

34

How are Languages Implemented?

• Two major strategies:– Interpreters (older, less studied)– Compilers (newer, much more studied)

• Interpreters run programs “as is”– Little or no preprocessing

• Compilers do extensive preprocessing

Page 35: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

35

Language Implementations

• Batch compilation systems dominate– E.g., gcc

• Some languages are primarily interpreted– E.g., Java bytecode

• Some environments (Lisp) provide both– Interpreter for development– Compiler for production

Page 36: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

36

The Structure of a Compiler

1. Lexical Analysis2. Parsing3. Semantic Analysis4. Optimization5. Code Generation

The first 3, at least, can be understood by analogy to how humans comprehend

English.

Page 37: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

37

Lexical Analysis

• First step: recognize words.– Smallest unit above letters

This is a sentence.

• Note the– Capital “T” (start of sentence symbol)– Blank “ “ (word separator)– Period “.” (end of sentence symbol)

Page 38: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

38

More Lexical Analysis

• Lexical analysis is not trivial. Consider:ist his ase nte nce

• Plus, programming languages are typically more cryptic than English:

*p->f ++ = -.12345e-5

Page 39: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

39

And More Lexical Analysis

• Lexical analyzer divides program text into “words” or “tokens”

if x == y then z = 1; else z = 2;

• Units: if, x, ==, y, then, z, =, 1, ;, else, z, =, 2, ;

Page 40: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

40

Parsing

• Once words are understood, the next step is to understand sentence structure

• Parsing = Diagramming Sentences– The diagram is a tree

Page 41: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

41

Diagramming a Sentence

This

line is a longer sentence

verbarticle noun article adjective noun

subject object

sentence

Page 42: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

42

Parsing Programs

• Parsing program expressions is the same• Consider:

If x == y then z = 1; else z = 2;• Diagrammed:

if-then-else

x y z 1 z 2==

assignrelation assign

predicate else-stmtthen-stmt

Page 43: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

43

Semantic Analysis

• Once sentence structure is understood, we can try to understand “meaning”– But meaning is too hard for compilers

• Compilers perform limited analysis to catch inconsistencies

• Some do more analysis to improve the performance of the program

Page 44: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

44

Semantic Analysis in English

• Example:Jack said Jerry left his assignment at home.

What does “his” refer to? Jack or Jerry?

• Even worse:Jack said Jack left his assignment at home?

How many Jacks are there?Which one left the assignment?

Page 45: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

45

Semantic Analysis in Programming

• Programming languages define strict rules to avoid such ambiguities

• This C++ code prints “4”; the inner definition is used

{int Jack = 3;{

int Jack = 4;cout << Jack;

}}

Page 46: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

46

More Semantic Analysis

• Compilers perform many semantic checks besides variable bindings

• Example:Jack left her homework at home.

• A “type mismatch” between her and Jack; we know they are different people– Presumably Jack is male

Page 47: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

47

Examples of Semantic Checks

• Variables defined before used• Variables defined once• Type compatibility• Correct arguments to functions• Constants are not modified• Inheritance hierarchy has no cycles

Page 48: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

48

Optimization

• No strong counterpart in English

• Automatically modify programs so that they– Run faster– Use less memory– In general, conserve some resource

Page 49: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

49

Optimization Example

X = Y * 0 is the same as X = 0

NO!

Valid for integers, but not for floating point numbers

Page 50: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

50

Examples of common optimizations

• Dead code elimination• Evaluating repeated expressions only once• Replace expressions by simpler equivalent

expressions• Evaluate expressions at compile time• Move constant expressions out of loops

Page 51: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

51

Code Generation

• Produces assembly code (usually)

• A translation into another language– Analogous to human translation

Page 52: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

52

Intermediate Languages

• Many compilers perform translations between successive intermediate forms– All but first and last are intermediate languages

internal to the compiler– Typically there is 1 Intermediate Language

• IL’s generally ordered in descending level of abstraction– Highest is source– Lowest is assembly

Page 53: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

53

Intermediate Languages (Cont.)

• IL’s are useful because lower levels expose features hidden by higher levels– registers– memory layout

• But lower levels obscure high-level meaning

Page 54: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

54

Issues

• Compiling is almost this simple, but there are many pitfalls.

• Example: How are erroneous programs handled?

• Language design has big impact on compiler– Determines what is easy and hard to compile– Course theme: many trade-offs in language

design

Page 55: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

55

Compilers Today

• The overall structure of almost every compiler adheres to our outline

• The proportions have changed since FORTRAN– Early: lexing, parsing most complex, expensive

– Today: optimization dominates all other phases, lexing and parsing are cheap

Page 56: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

56

Trends in Compilation

• Compilation for speed is less interesting. But:– scientific programs– advanced processors (Digital Signal Processors,

advanced speculative architectures)

• Ideas from compilation used for improving code reliability:– memory safety– detecting concurrency errors (data races)

Page 57: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

57

Compilers and Optimization

What makes a compiler good?What makes a compiler different?

Page 58: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

58

What’s in an optimizing compiler?

Front End Optimizer

High-level language

(C, C++, Java)

Low-level languageCode

Generator

Compilation Stages

Page 59: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

59

What are compiler optimizations?

Optimization: the transformation of a program P into a program P’, that has the same input/output behavior, but is somehow “better”.

• “better” means:– faster – or smaller – or uses less power– or whatever you care about

• P’ is not optimal, may even be worse than P

Page 60: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

60

An optimizations must:

• Preserve correctness– the speed of an incorrect program is irrelevant

• On average improve performance– P’ is not optimal, but it should usually be better

• Be “worth the effort”– 1 person-year of work, 2x increase in

compilation time, a 0.1% improvement in speed?

– Find the bottlenecks– 90/10 rule: 90% of the gain for 10% of the work

Page 61: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

61

CompilerHigh-level language

C, C++, Java

Low-level languagemc68000

LexicalAnalyzer

Parser IR Code

Generator Optimizer

m/c CodeGenerator

tokens IRIR

IR: Intermediate Representation

Compiler Phases (Passes)

Page 62: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

62

Lexers & Parsers

• The lexer identifies tokens in a program• The parser identifies grammatical

phrases, or constructs in the program• There are freely available lexer and parser

generators…• The parser usually constructs some

intermediate form of the program as output

Page 63: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

63

Intermediate Representation (IR)

• The representation or language on which the compiler performs it’s optimizations

• There are as many IRs as compiler suites • Some IRs are better for some optimizations

– different information is maintained– easier to find certain types of information

Page 64: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

64

Why Use an IR?

IRJava

Fortran

C

C++

Voss++

MIPS

Sun SPARC

IA32 / Pentium

IA64 / Itanium

PowerPC

• Good Software Engineering– Portability – Reuse

Page 65: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

65

Compiling a C program

A Simple Compilation Example

Page 66: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

66

Writing C Programs

• A programmer uses a text editor to create or modify files containing C code.

• Code is also known as source code.

• A file containing source code is called a source file.

• After a C source file has been created, the programmer must invoke the C compiler before the program can be executed (run).

Page 67: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

67

Invoking the gcc Compiler

At the prompt, type gcc -ansi -Wall pgm.c where pgm.c is the C program source file.• -ansi is a compiler option that tells the compiler

to adhere to the ANSI C standard.• -Wall is an option to turn on all compiler

warnings (best for new programmers).

Page 68: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

68

The Result : a.out

• If there are no errors in pgm.c, this command produces an executable file, which is one that can be executed (run).

• The gcc compiler names the executable file a.out

• To execute the program, at the prompt, type

a.out• Although we call this process “compiling a

program,” what actually happens is more complicated.

Page 69: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

69

Stages of Compilation

Stage 1: Preprocessing

– Performed by a program called the preprocessor – Modifies the source code (in RAM) according to

preprocessor directives (preprocessor commands) embedded in the source code

– Strips comments and whitespace from the code

– The source code as stored on disk is not modified.

Page 70: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

70

Stages of Compilation (con’t)

Stage 2: Compilationo Performed by a program called the compilero Translates the preprocessor-modified source

code into object code (machine code)o Checks for syntax errors and warningso Saves the object code to a disk file.

o If any compiler errors are received, no object code file will be generated.

o An object code file will be generated if only warnings, not errors, are received.

Page 71: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

71

Stages of Compilation (con’t)

The Compiler consists of the following sub-systems:

– Parser - checks for errors

– Code Generator - makes the object code

– Optimizer - may change the code to be more efficient

Page 72: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

72

Stages of Compilation (con’t)

Stage 3: Linkingo Combines the program object code with other

object code to produce the executable file.o The other object code can come from the Run-

Time Library (a collection of object code with an index so that the linker can find the appropriate code), other libraries, or object files that you have created.

o Saves the executable code to a disk file. On a Linux/Unix system, that file is called a.out.

o If any linker errors are received, no executable file will be generated.

Page 73: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

73

Program Development Using gcc

Source File pgm.c

Program Object Code File pgm.o

Executable File a.out

Preprocessor

Modified Source Code in RAM

Compiler

Linker

Other Object Code Files (if any)

Editor

Page 74: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

74

The Programming Language Family Tree

Concepts of Programming Languages

Page 75: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

75

A Family Tree

http://merd.net/pixel/language-study/diagram.html

Page 76: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

76

Plankalkul

• Developed by Konrad Zuse (1945)• Never implemented• Advanced data structures (floating point,

arrays, records)• Odd notation:

– To code A[7] = 5 * B[6] | 5 * B => A V | 6 7 (subscripts) S | 1.n 1.n (data types)

Page 77: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

77

Pseudocodes

• Machine code had many negatives:– Poor readability, writability, modifiability– Low-level machine operations had deficiencies,

including no indexing or floating point

• Example: Short Code – Developed by Mauchly in 1949 for the BINAC– Expressions coded from left to right– Operations included:

• 1n => (n+2)nd power (e.g., 12 represented the 4th power)

• 2n => (n+2)nd root• 07 => addition

Page 78: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

78

FORTRAN I (1957)

• Designed for IBM 704, which had– Index registers– Floating point hardware

• Development environment– Computers small and unreliable– Applications were scientific – There was no programming methodology or

tools– Machine efficiency was of primary importance

Page 79: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

79

FORTRAN I

• Impact of development environment– Needed good array handling and counting loops– No need for

• Dynamic storage• String handling• Decimal arithmetic• Powerful input/output operations

Page 80: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

80

FORTRAN I

• First implemented version of FORTRAN– Names could have up to 6 characters– Posttest counting loop (DO statement)– Formatted input/output– User-defined subprograms– 3-way selection statement (arithmetic IF)– No data typing statements– Released in 1957 after 18 worker/years effort– Programs larger than 400 lines rarely compiled

correctly (704 was unreliable)– Code was fast;– FORTRAN I quickly became widely used

Page 81: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

81

FORTRAN IV (1960-62)

• Added features– Explicit type declarations– Logical IF statement– Subprogram names could be parameters

Page 82: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

82

FORTRAN 77 (1978)

• Character string handling• Logical loop control statement• IF-THEN-ELSE statement

Page 83: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

83

FORTRAN 90 (1990)

• Modules• Dynamic arrays• Pointers• Recursion• CASE statement• Parameter type checking

Page 84: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

84

LISP (1959)

• LISt Processing language• Designed by John McCarthy at MIT• Designed to meet AI research needs

– Process data in lists, not arrays– Symbolic computation, rather than numeric

• Two data types: atoms and lists• Syntax based on lambda calculus• Pioneered functional programming

– No need for variables or assignment– Control via recursion and conditional expressions

• COMMON LISP and Scheme are dialects

Page 85: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

85

ALGOL 58 (1958)

• Development Environment– FORTRAN just developed for IBM 704– Many other machine-specific languages were

being developed– There were no portable languages– There was no universal language for

communicating algorithms

Page 86: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

86

ALGOL 58

• Goals for the language– Close to mathematical notation– Good for describing algorithms– Must be translatable to machine code

• Notes:– Not meant to be implemented, but variations

were (MAD, JOVIAL)– IBM was initially enthusiastic, but dropped

support by mid 1959

Page 87: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

87

ALGOL 58 Features

• Type concept was formalized• Names could have any length• Arrays could have any number of subscripts• Parameters had mode (in/out)• Subscripts were placed in brackets• Compound statements (begin..end)• Semicolon used as statement separator• Assignment operator was :=• if statement had an else-if clause

Page 88: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

88

ALGOL 60 (1960)

• New features included– Block structure (local scope)– Two parameter passing methods– Subprogram recursion– Stack-dynamic arrays

• Still lacked– Input/output– String handling

Page 89: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

89

ALGOL 60

• Successes– Standard for publishing algorithms for more

than 20 years– Basis for all subsequent imperative languages– First machine-independent language– First language whose syntax was formally

defined (BNF was used)

Page 90: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

90

ALGOL 60

• Failures– Never widely used, especially in U.S.– No I/o– Too flexible, making it hard to implement– FORTRAN was firmly entrenched– Formal syntax description (BNF considered

strange at the time)– Lack of support by IBM

Page 91: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

91

COBOL (1960)

• Based on UNIVAC FLOW-MATIC– Names up to 12 characters, with embedded hyphens– English names for arithmetic operators– Data and code were completely separate– Verbs were the first word in every statement

• Design Goals– Must look like simple English– Ease of use more important than powerful features– Broaden base of computer users– Must not be biased by current compiler problems

Page 92: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

92

COBOL

• Contributions– First macro facility in HLL– Hierarchical data structures (records)– Nested selection statements– Long names (up to 30 characters)– Data Division

• Notes– First language required by DoD– Still the most widely used business application

language

Page 93: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

93

BASIC (1964)

• Kemeny & Kurtz (Dartmouth)• Design goals

– Easy to learn and use (non-science students)– Fast turnaround for homework– Free and private access– User time more important than computer time

• Current dialects– QuickBASIC, Visual BASIC

Page 94: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

94

PL/I (1965)

• Designed by IBM and SHARE for scientific and business computing

• Contributions– First unit-level concurrency– First exception handling– Switch-selectable recursion– Pointer data type– Array cross sections

• Notes:– Many features were poorly designed– To large and complex– Still used for scientific and business applications

Page 95: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

95

Early Dynamic Languages

• Characterized by dynamic typing and dynamic storage allocation– APL (A Programming Language) 1962

• Designed a hardware description language• Many operators for scalars and arrays • Programs are difficult to read

– SNOBOL (1964)• String manipulation language (Bell Labs)• Powerful pattern matching operators

Page 96: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

96

ALGOL 68 (1968)

• Not really a superset of ALGOL 60• Design based on orthogonality• Contributions

– User-defined data structures– Reference types– Dynamic (flex) arrays

• Notes– Even less usage than ALGOL 60– Strong influence on Pascal, C, and Ada

Page 97: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

97

Pascal (1971)

• Designed by Wirth (quit ALGOL 68 committee)

• Intended to be used for teaching structured programming

• Small, simple, introduced nothing new• Widely used for teaching programming in

college, but is being supplanted by C++ and Java

Page 98: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

98

C (1972)

• Designed for systems programming (Bell Labs, Dennis Richie)

• Evolved from B and ALGOL 68• Powerful set of operators• Poor type checking• Initially spread via UNIX

Page 99: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

99

Other Descendants of ALGOL

• Modula-2 (Wirth, mid-1970s)– Pascal plus modules and low-level features for systems

programming

• Modula-3 (late 1980s)– Modula-2 plus classes, exception handling, garbage

collection, and concurrency

• Oberon– Adds OOP support to Modula-2

• Delphi (Borland)– Pascal plus OOP features– More elegant, safer than C++

Page 100: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

100

Prolog (1972)

• Developed by Comerauer, Roussel, Kowalski

• Based on formal logic• Non-procedural• Can be described as being an intelligent

database system that uses an inferencing process to infer the truth of given queries

Page 101: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

101

Ada (1983)

• Huge design effort• Contributions

– Packages support data abstraction– Elaborate exception handling– Generic program units– Concurrency through the tasking model

• Ada 95– OOP support through type derivation– New concurrency features for shared data

Page 102: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

102

Smalltalk (1972-1980)

• Developed at Xerox PARC (Alan Kay)• First full implementation of an object-

oriented language– Data abstraction– Inheritance– Dynamic type binding

• Pioneered the graphical user interface

Page 103: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

103

C++ (1985)

• Bell Labs (Stroustrup)• Evolved from C and SIMULA 67 (class)• Facilities for OOP were added to C• Also has exception handling• Supports both procedural and OO programming• Large and complex• Eiffel (1992), a related language that supports

OOP– Not directly derived from any other language– Smaller and simpler than C++

Page 104: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

104

Java (1995)

• Developed at Sun in early 1990s• Based on C++

– Significantly simplified– Supports only OOP– Has references, but not pointers– Includes support for applets and a form of

concurrency (threads)

Page 105: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

105

Scripting Languages

• JavaScript (1995)– Originally LiveScript, developed jointly by

Netscape and Sun Microsystems– Used as an HTML-embedded client-side scripting

language, primarily for creating dynamic HTML documents

• PHP (1995)– Developed by Rasmus Lerdorf– An HTML-embedded server side scripting

language– Provides support for many DBMS

Page 106: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

106

C# (2002)

• Based on C++ and Java, with ideas from Delphi and Visual Basic

• A language for component-based development in the .NET Framework

• Likely to become very popular because of Microsoft’s huge effort to push .NET

Page 107: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

107

A Family Tree

http://merd.net/pixel/language-study/diagram.html

Page 108: 1 The Evolution of Major Programming Languages Concepts of Programming Languages.

108

The End

Read Chapters 1 and 2 in the Textbook