01intro - Brief of Programming Languages NEW
01intro - Brief of Programming Languages NEW
Prof. O. Nierstrasz
Spring Semester 2014
PS — Introduction
© O. Nierstrasz 1.3
PS — Introduction
© O. Nierstrasz 1.4
PS — Introduction
Paradigms (Model)
How do different language paradigms support
problem-solving?
Foundations
What are the foundations of
programming languages?
Semantics
How can we understand the semantics of
programming languages?
© O. Nierstrasz 1.5
PS — Introduction
© O. Nierstrasz 1.6
First Generation Languages
(Machine Language)
Pascal (named after Blaise Pascal, 17th century French mathematician) - 1970's
Language to teach proper structured programming.
ADA (named after Ada Lovelace (programmed the 19th century 'analytical
engine') - late 1970's
Language developed to replace COBOL.
Advantages
• Easier to read, write and
debug
• Faster creation of programs
Disadvantages
• Still not a tool for the average
user to create software
programs
• Requires very good
knowledge of programming
and of the language
Advantages
• Easier to read, write and debug
• Faster creation of programs
Disadvantages
• Still not a tool for the average user to create software
programs
• Requires very good knowledge of programming and of
the language
Examples
dBase FoxPro Access
Oracle Informix SQL
Advantages
• Average users can quickly learn to “query” the
database
• Average users can easily learn how to write
programs
• Programs are written faster
Disadvantages
• Can not write sophisticate programs like word
processors, graphics, etc.
• Mostly for data base applications like phone
information.
Rick Graziani graziani@cabrillo.edu 16
Databases and Relationships
17
PS — Introduction
Common Constructs:
> basic data types (numbers, etc.); variables; expressions;
statements; keywords; control constructs; procedures;
comments; errors ...
Uncommon Constructs:
> type declarations; special types (strings, arrays,
matrices, ...); sequential execution; concurrency
constructs; packages/modules; objects; general
functions; generics; modifiable state; ...
© O. Nierstrasz 1.7
PS — Introduction
Programming Paradigms
© O. Nierstrasz 1.8
PS — Introduction
A Brief Chronology
Fortran
History
> John Backus (1953) write programs in mathematical notation, and
generate code comparable to good assembly programs.
> No language design
> Most effort spent on code generation and optimization
> FORTRAN I released April 1957; working by April 1958
> The current standard is FORTRAN 2018
> https://en.wikipedia.org/wiki/Fortran - History
© O. Nierstrasz 1.10
PS — Introduction
Fortran …
Innovations
> Notation for functions
> Assignments to variables of complex expressions
> DO loops
> Comments
> Input/output formats
> Machine-independence
Successes
> Easy to learn; high level
> Promoted by IBM; addressed large user base
> (scientific computing)
© O. Nierstrasz 1.11
PS — Introduction
PROGRAM HELLO
DO 10, I=1,10
PRINT *,'Hello World'
10 CONTINUE
STOP
END
© O. Nierstrasz 1.12
PS — Introduction
ALGOL 60
History
> Committee of PL experts formed in 1955 to design universal, machine-
independent, algorithmic language
> First version (ALGOL 58) never implemented
Innovations
> BNF (Backus-Naur Form) introduced to define syntax (led to syntax-directed
compilers)
> First block-structured language; variables with local scope
> Structured control statements
> Recursive procedures
> Variable size arrays
Successes
> Highly influenced design of other PLs but never displaced FORTRAN
© O. Nierstrasz 1.13
PS — Introduction
BEGIN
FILE F (KIND=REMOTE);
EBCDIC ARRAY E [0:11];
REPLACE E BY "HELLO WORLD!";
WHILE TRUE DO
BEGIN
WRITE (F, *, E);
END;
END.
© O. Nierstrasz 1.14
PS — Introduction
COBOL
History
> Designed by committee of US computer manufacturers
> Targeted business applications
> Intended to be readable by managers (!)
Innovations
> Separate descriptions of environment, data, and processes
Successes
> Adopted as de facto standard by US DOD
> Stable standard for 25 years
> Still the most widely used PL for business applications (!)
> COBOL 2014 - History https://en.wikipedia.org/wiki/COBOL
© O. Nierstrasz 1.15
PS — Introduction
© O. Nierstrasz 1.16
PS — Introduction
PL/1
History
> Designed by committee of IBM and users (early 1960s)
> Intended as (large) general-purpose language for broad classes of
applications
Innovations
> Support for concurrency
> Exception-handling on conditions
Successes
> Achieved both run-time efficiency and flexibility
> First “complete” general purpose language
© O. Nierstrasz 1.17
PS — Introduction
END HELLO;
© O. Nierstrasz 1.18
PS — Introduction
SML - 1983
print("hello world!\n");
© O. Nierstrasz 1.19
PS — Introduction
Haskell - 1990
© O. Nierstrasz 1.19
PS — Introduction
Prolog
History
> Originated at U. Marseilles (early 1970s), and compilers developed
at Marseilles and Edinburgh (mid to late 1970s)
Innovations
> Theorem proving paradigm
> Programs as sets of clauses: facts, rules and questions
Successes
> Prototypical logic programming language
> Used in Japanese Fifth Generation Initiative
© O. Nierstrasz 1.20
PS — Introduction
printstring([]).
printstring([H|T]) :- put(H), printstring(T).
© O. Nierstrasz 1.21
PS — Introduction
Object-Oriented Languages
History
> Simula was developed by Nygaard and Dahl (early 1960s) in Oslo
as a language for simulation programming, by adding classes and
inheritance to ALGOL 60
Begin
while 1 = 1 do begin
outtext ("Hello World!");
outimage;
end;
End;
© O. Nierstrasz 1.22
PS — Introduction
Object-Oriented Languages
Innovations
> Encapsulation of data and operations
> Inheritance to share behaviour and interfaces
Successes
> Smalltalk project pioneered OOP user interfaces
> Large commercial impact since mid 1980s
> New languages: C++, Objective C, Eiffel, Beta, Oberon,
Self, Perl 5, Python, Java, Ada 95 ...
© O. Nierstrasz 1.23
PS — Introduction
Interactive Languages
BASIC
> Developed at Dartmouth College in mid 1960s
> Minimal; easy to learn
> Incorporated basic O/S commands
© O. Nierstrasz 1.24
PS — Introduction
APL
> Developed by Ken Iverson for short description of numerical
algorithms
> Large, 52 characters in addition to alphanumerics)
> Objects are arrays (lists, tables or matrices)
> Operator-driven (power comes from composing array operators)
> No operator precedence (statements parsed right to left)
'HELLO WORLD'
© O. Nierstrasz 1.25
PS — Introduction
Special-Purpose Languages
SNOBOL
> First successful string manipulation language
> Influenced design of text editors more than other PLs
> String operations: pattern-matching and substitution
> Arrays and associative arrays (tables)
> Variable-length strings
© O. Nierstrasz 1.26
PS — Introduction
Lisp
> Performs computations on symbolic expressions
> Symbolic expressions are represented as lists
> Small set of constructor/selector operations to create and
manipulate lists
> Recursive rather than iterative control
> No distinction between data and programs
> First PL to implement storage management by garbage collection
(DEFUN HELLO-WORLD ()
(PRINT (LIST 'HELLO 'WORLD)))
© O. Nierstrasz 1.27
PS — Introduction
4GLs
“Problem-oriented” languages
> PLs for “non-programmers”
> Very High Level (VHL) languages for specific problem domains
Classes of 4GLs (no clear boundaries)
> Application generators
> Query languages
> Decision-support languages
Successes
> Highly popular
© O. Nierstrasz 1.28
PS — Introduction
H
FSCREEN O F 80 80 CRT
C EXCPT
OSCREEN E 1
O 12 'HELLO WORLD!'
© O. Nierstrasz 1.29
PS — Introduction
© O. Nierstrasz 1.30
PS — Introduction
Scripting Languages
History
Countless “shell languages” and “command languages” for operating
systems and configurable applications
> Unix shell (ca. 1971) developed as echo "Hello, World!"
user shell and scripting tool
on OpenStack
> HyperTalk (1987) was developed at
show message box
Apple to script HyperCard stacks put "Hello World!" into message box
end OpenStack
© O. Nierstrasz 1.31
PS — Introduction
Innovations
> Pipes and filters (Unix shell)
> Generalized embedding/command languages (TCL)
Successes
> Unix Shell, awk, emacs, HyperTalk, AppleTalk, TCL, Python, Perl,
VisualBasic ...
© O. Nierstrasz 1.32
Genealogy of Common Languages
The future?
© Oscar Nierstrasz 33