Programming Languages

G22.2110 Spring 1998

Class #1

Homework #1: Sethi Exercises 1.4, 1.7, 1.8, 1.9, 1.10

Read Chapter 1, 2 of Sethi

Contents:

0. Overall Organization

- Introduction
- Historical Overview of Programming Languages
- Comments on Sethi’s Chapter 1
- Language Models
- Programming Languages and their relationship to today’s Distributed Computing Frameworks

Machine language v.s. High-Level language

Programming paradigms

Compilation v.s. interpretation

Data, Behavior, Event, Persistence

1. Introduction

Class scope

Overall coverage of the topics mentioned in the ACM Task Force on the Core of Computer Science in the area of programming languages (See "Computing as a discipline", Communication of the ACM, volume 32, number 1, January 1989).

Topics that deal more with implementation are left to the traditional compiler construction course.

Theoretical details are left to the traditional formal language course and theory of computation course.

Fundamental programming language topics

- BNF notation
- Some acquaintance with Ada
- Programming in a functional language
- Programming in Prolog
- Modules and classes
- Exception handling
- Pointers
- Type equivalence
- Static versus dynamic type checking
- Parameter passing

Important topics

- Attribute grammars
- Type reconstruction
- Term rewriting
- Formal semantics
- Hoare logic
- Lambda calculus
- Combinators
- Post systems

2. Historical Overview of Programming Languages

2.1 First Formal Languages

Spoken language

As old as man (at least 300,000 years old)

Extremely complex

Currently no formal theory capable of wholly describing its richness

Written language

More amenable to formal analysis

Evolution of writing systems to record language reveals the first steps towards formal

notation and unambiguous communication

Sumerian

Southern Mesopotamia, 4000 & 3000 B.C.

World's oldest extant written documents

Largely undeciphered

Not Indo-European as English, Russian, Farsi, and Hindi

Among Indo-European languages, Sanskrit was the first to be written down

(Veda, most ancient extant of scriptures of Hinduism, is written in Sanskrit)

Texts written in clay, mostly agricultural transactions and astronomical observations

Evolved from small, 3-D tokens used for counting grain, wine, and cattle.

Tokens were initially sealed in clay containers called bullae

Bullae were sometimes marked on the outside with impressions of the concealed tokens

Tokens were eventually eliminated in favor of the markings

2-D representation of information was born

Other cultures which invented written language:

Egyptian hieroglyphics (3000 B.C.)

Harappan (Indus Valley)

Mayan (new world)

The four mentioned cultures were the only ones to come up with a system for writing that

was largely independent of the media used to represent it. Other cultures used "analog"

devices for non-verbal communication (e.g., Incan "quipu" which consists of knots tied in

strings).

Evolution of the alphabet

Sumerian evolved from a few crude drawings to many stylized pictures written with one

particular marking device (i.e., a wedge-tipped stick).

The marking device was used to make slim triangular marks called cuneiform

Cuneiform system was adopted by the Akkadians, the Babylonians, and the Assyrians

Cuneiform is not the system of writing that evolved into today's English alphabet

Origin of most alphabets can be traced to the Phoenicians (Mediterranean area, 1000 B.C.)

At first, writing was composed of "pictographs", pictures of concepts

There was a non-arbitrary relation between picture and meaning

The only way for a pictograph to communicate a concept is for the meaning to be evident

in the drawing

Pictographs gradually evolved into "ideographs", symbols for ideas

Ideographs are not pictures but are stylized, their meaning is understood by convention

Education becomes important to transmit the conventions

Roman numerals are ideographs (e.g., IV stands for the idea of four, not the word "four")

When the convention for understanding an ideograph depends on the sound of the spoken

language, the symbol is a "phonogram"

e.g. * may mean the sun as a pictograph, the daytime as an ideograph, "son" as

a phonogram (as "sun" and "son" are pronounced the same in English)

e.g., *+E -> "sunny"

One further step in the development of the English alphabet: development of a

consonantal alphabet (reduces the number of symbols required to a manageable

number).

- Semitic people in the Sinai Peninsula about 1700 B.C.
- Phoenicians spread the consonantal alphabet around the Mediterranean Sea/Greeks

Roots of words are given by the consonants alone, other details by vowels

e.g., "sing", "sang", "song", "sung" …

The Greeks added the last innovation necessary to create today's alphabet

As signs were needed for vowels, they adopted the signs of the Semitic consonants not

present in Greek

A B C D Modern Roman majuscule

A B G D Modern Greek majuscule

a b g d Modern Greek minuscule

alpha beta gamma delta Names of the Greek letters

aleph beth gimel daleth Names of Hebrew letters

ox house camel door Meaning

2.2. Algorithms and mathematical notation

Introduction

Earliest known algorithms due to the Babylonians of 3000 to 1500 B.C.

They used a base 60 notation for arithmetic, including fractions

Base 60 has survived to this day in the measurement of minutes/hours, and

degrees of arc

Babylonians had extensive tales of elementary mathematical functions

Babylonians' textbooks contained examples of for learning calculations

These examples were clearly designed to be prescriptions on how to perform

calculations, and can therefore be considered as early forms of algorithms

e.g., multiplication by 1

Greeks likewise presented their algorithms by example

e.g., Euclidian algorithm which determines the greatest common divisor of 2 numbers

Euclid did not consider zero or one as a number, and has special cases for them

Greek contributed "proof"

e.g., Pythagoras proof that the sum of the square of the sides of a right triangle equals the

square of the hypothenuse

Arabic mathematics

Abu Jafar Mohammed ibn Musa al-Khorezmi (780-850) is one of the most noteworthy Arab

mathematician

His book "The calculations of reduction and confrontation" gives rise to the word "algebra"

(al-jabr), and somewhat remotely to the mathematical field of algebra.

The Latin version of the book "Liber algebrai et almucbala" was used as a mathematical text

for eight centuries

Another book called the Hindu art of reckoning is one of the sources by which the positional

number system was introduced to Latin-speaking Europe. The Latin title of the book is

"Algorthmi de numero Indorum", and gives rise to the word "algorithm".

The sign for zero was an important achievement, as any arithmetic becomes clumsy without

it. Clay tablets from Mesopotamia dataing around 300 B.C. show that mathematicians of

the Seleucid Kingdom used a symbol for zero.

Arabic scientists gave credit to the positional system of arithmetic to the Indians

The use of zero crept into European mathematics 400 years later (Leonardo da Pisano a.k.a.

Fibonacci).

Pre 19^{th} century mathematics

Ideas and mathematical notations developed erratically

"+" and "-" first used by Johann Widman in 1489

"=" used by Robert Recorde (1557)

"x" used by William Oughtred (1631)

exponentiation introduced by James Hume (1636)

division by Johann Rahn (1659)

"p " by William Jones (1706)

François Viète (1540-1603) was the first to use letters systematically for unknown quantities

in an algebraic problem. He gave the clearest expression to that time of the generality of

algebraic methods.

Previously, mathematics was mostly concerned with geometry which greatly influenced the

form of mathematical writing (e.g., the dimension or unit of measurement was an integral part

of an unknown quantity)

"Cossists" of the Renaissance used words for things: square, cube, etc.

Scalars (from the Latin word "ladder") are the coefficients, the dimensionless numbers that

can multiply any quantity

As far back as the Babylonians, the word "ladder" was used for powers

Gottfried Wilhelm Leibniz (1646-1716) was an important contributor to the development of

formal languages. He had the idea of a method more general than that which Viète had tried

to embody in his algebra. He also built a multiplying machine.

Charles Babbage (1792-1871) also built a calculating machine but never got to finish his

analytic engine. Ada Augusta was a friend of Babbage and contributed to the theory of his

machine, She is sometimes said to be the first computer programmer as she described how

to use the analytic engine to compute small mathematical tasks.

Like Viète and Leibniz, Babbage sought to capture at least some of the precision in

mathematics in new, artificial languages.

2.3. Contributions from modern mathematics

Gottob Frege (1848-1925)

Proposal for a universal language of reasoning can be found in his book "Concept Writing"

Most significant advance in logic since the ancient Greek civilization

Introduced the truth-functional propositional calculus (as opposed to the Greel syllogistic

approach), function and argument (as opposed to subject and predicate), a systematic

theory of quantification, and derivation according to form.

Two-dimensional clumsy notations did not catch on

Giuseppe Peano (1858-1932), mathematician and amateur typesetter, invented a more

practical linear notation for implication "É ", and there exists "$ " which was then

popularized by Bertrand Russel.

All his contributions play a significant role in the study of programming languages:

Propositional and quantified logic are key to understanding PROLOG

Application of function and arguments is omnipresent in programming languages

and particularly in functional languages

Derivation according to form is the primary means of reasoning about formal

languages

Bertrand Russel (1872-1970)

"Principia Mathematica", atttempts to formalize all of mathematics by reducing arithmetic

and geometry to logic and the theory of sets.

Unreadable notation (300 pages to prove that 1+1 = 2)

Motivation was to avoid the logical inconsistency found in Frege's formalization of

mathematics (i.e. Russell's paradox) by introducing the concept of types of variables.

Types play a role in programming languages not merely as data structures, but by

constraining computational expressions to ways that are free from the problems

that befell Frege and naïve set theory.

Constructive mathematics

Some mathematicians advocated the traditional "constructive" approach in which the

existence of mathematical objects had to be proved by exhibiting a construction.

The use of a non-constructive approach marqued a divergence between mathematics

and algorithms.

Controversy has since died down as contemporary mathematics does not appear to be

troubled by the use of non-constructive methods.

As programming languages are languages for the construction of objects representable

by a computer, the methods of constructive mathematics may well be important to computer

science.

Constructive logic can be viewed as a programming language.

Formal semantics

Alfred Tarski (1902-1983) formalized the distinction between symbols and their meaning

by a semantic definition of the predicate calculus.

M[A Ù B] = M[A] and M[B]

M is a function from the syntax of predicate logic to mathematical entities. The meaning of

the syntactic phrase A Ù B is given by combining the meaning of A and B.

For the first time, the syntax of a language is stripped of any residual meaning.

This makes it possible, indeed necessary, that a semantics be given to the language.

The dichotomy between syntax and semantics, object language and meta-language

is important.

Now language can be studied mathematically.

Out of the study of the language of mathematics and logic, the study of programming

languages begins.

2.4. Early programming formalisms

A need to understand more about the nature of computation lead to two early programming

formalisms (Turing machines, lambda calculus).

At about the same time, the first primitive computers were being built. Computation was no

longer abstract but realizable in the actions of gigantic machines.

Turing machines

Alan M. Turing (1912-1954) was involved in the Enigma project which used computers

to decode German messages during World War II.

Several years before, Turing had written a paper introducing an abstract machine with

which to study the nature of computing.

A Turing machine is a 7-tuple <Q, T, I, d , b, q0, qf> where

- Q is the set of states,
- T is the set of tape symbols,
- I is the set of input symbols, I Í T,
- d is the transition function,
- b Î T \ I is the designated symbol for a blank,
- q0 is the initial state, and
- qf is the final or accepting state.

The operation of the Turing machine is governed by the transition function.

At every point in its operation, a Turing machine examines an input symbol on the

tape, then writes a symbol, and moves the tape according to its current state and the

transition function d . The machine continues this process until (if ever) it reaches the

final state.

Although the theory of computation has been profoundly influenced by the Turing

machine, programming languages have not.

Lambda calculus

The language of lambda expressions was created by Alonzo Church at the Princeton

Institute of Advanced Studies.

Unlike Turing machines, lambda expressions have a profound impact on programming

languages.

Lambda expressions form the underlying basis of functional programming.

Every lambda expression is a function or an application of a function to an argument.

Every algorithm can be expressed as a lambda expression.

The language does not exhibit any time-variant behavior, like Turing machines, making

it more amenable to formal analysis.

Zuse's plan calculus

Zuse developed a three-address notation called Plan Calculus which could be used to program

a computer independently of whether or not a suitable machine could be constructed.

e.g., types for floating point numbers: (3 x S0, 7 x S0, 22 x S0)

first three bits indicate whether the number is real or imaginary, and whether the number is

positive, zero, or negative. The rest of the structure holds the exponent and mantissa.

Such general and sophisticated date structuring would not appear again until ALGOL 68 and

Pascal.

Flow diagrams

Pictorial representation of programming developed by Herman H. Goldstine and John von

Neumann around 1946.

Representation used to formalize the description of an algorithm.

2.5. Early programming languages

As soon as it became apparent that harware was going to be useful, it became apparent that the

language in which to instruct the harware was important. And so, the field of programming

languages was born.

Early languages were machine-oriented (e.g., Algebraic Interpreter developed at MIT for the

Whirlwind computer, and A2 developed at UNIVAC).

FORTRAN

Work started in 1953 by a group led by John Backus at IBM.

Short for "FORmula TRANslating".

High-level language which sought to express mathematical formulas as entities of the

mind rather than that of the machine.

Not conceived as a universal algorithmic language but rather as a notation for

mathematical formulas that could be translated by a machine for a machine.

FORTRAN initiated the search for languages that communicate with the computer

at a higher level, a level closer to the way humans think.

Variables in FORTRAN could be one or two characters in length. Spaces are ignored.

At the time, a coder would write code on paper, and a typist would punch the codes

into cards.

TPK (Knuth & Pardo) program in FORTRAN:

DIMENSION A(11)

READ A

- DO 3,8,11 J=1,11
- I=11-J
- PRINT I, 999.

Y=SQRT(ABS(A(I+1)))+5*A(I+1)**3

IF (400. >= Y) 8,4

GO TO 2

8 PRINT I,Y

11 STOP

Program creates an array of 11 elements holding floating point numbers. The array is filled

with 11 numbers provided from the input device (statements 3 through 8 are executed 11

times). Starting from the end of the array, a function y = f(x) is applied to each member, if the

result is less than 400, x and f(x) are printed, otherwise 999 is printed. After this, control goes

to the statement labeled 11. Note the GO TO statement that initiates the next iteration of the

loop.

FORTRAN keeps evolving.

FORTRAN has been standardized by ANSI and ISO (1966, 1978, 1992)

-> ANSI X3.198-1992. It includes dynamic storage allocation, modules, and recursion.

ALGOL

ALGOrithmic Language

Many languages, like Pascal and Ada, are ALGOL-like.

Characteristics:

variables are changed

block and procedures are the basic units

procedures may call themselves recursively

data are organized into different types

identifiers have lexical scope

The majority of programming languages have these features and can be said to

have evolved from ALGOL.

Designed by committee (GAMM and ACM) as a universal programming language

for communicating programs among users and to computers.

IAL (International Algebraic Language) was the first draft in 1958.

Blocks, call-by-value/call-by-name, and recursion made it into the language in 1960.

BNF notation was developed to describe the syntax of ALGOL, and compiler

technology for block-structured languages was developed first for ALGOL.

TPK program:

**begin integer** I; **real array** a[0 : 10];

** real procedure** f(t); **real** t; **value** t;

f := sqrt(abs(t)) + 5x t 3;

**for** i := 0 **step** 1 **until** 10 **do** read(a[i])

**for** i := 10 **step** -1 **until** 0 **do**

**begin** y := f(a[i]);

**if** y > 400 **then** write(i, "TOO LARGE")

**else** write(i,y);

**end**

**end**

** **ALGOL 68 had parallel computation and semaphores, implementation-dependent constants,

coercions, a large collection of types (complex numbers, bit patterns, long and short numbers,

strings, and flexible arrays), user -defined overloading, and case statement.

ALGOL 68 did not see widespread use as the dream of a universal algorithmic language was

petering out. The language was hard to implement (6 pass compiler, etc.)

LISP

LISt Processing

Developed by John McCarthy at MIT as a language whose primary data structure was a list

of symbols and which was focused on symbolic processing.

A list of symbols could represent words in a sentence, a list of attributes, a payroll record, or

a symbolic differential equation.

A list consists of only a "nil" element, and a pair of pointers, one to an element of the list, and

one to the rest of the list.

Programs themselves are also lists of symbols.

LISP represents both data and programs as lists.

In LISP, a program can create a program (a list), just as it might a value, and then execute it.

List: (element1 element2 … elementn)

Program: (operator argument1 … argumentn)

e.g., (PLUS 3 (MINUS 6 2))

Literal lists have to be protected from evaluation by the LISP system by "quoting" them.

e.g., (QUOTE (PLUS X Y)).

LISP uses lists as data structures , and there are created dynamically when the programmer

adds elements to lists and appends lists together (no explicit space allocation required as in

FORTRAN).

LISP introduced automatic storage management to programming languages in order to

reclaim the storage occupied by lists that are no longer being used.

For the 1960s and 1970s LISP and AI were closely related. Since then, progress in compiler

technology and the clean semantics of purely functional programming have led to the

emergence of a second major programming language family in contrast to the original

imperative family.

Recursive functions can be used in LISP instead of iteration. Functions without side effects

are easy to develop and reason about. Programming requiring sequencing of side effects is

difficult.

From 1975 to 1985, the languages Scheme and Common LISP were developed as purely

functional languages (i.e., languages that rely purely on functions, and function application).

Typed functional languages have been developed like ML and Haskell (influence of Pascal's

strong typing). These languages have recursive data type in addition to recursive functions.

At the diffence of ML, Haskell evaluates function arguments lazily, this permits infinite data

structures to be built

SIMULA

Work carried out at the Norwegian Computing Center

Motivated by the need to simulate situations like queues at a supermarket, response times of

emergency services, or chain reactions of nuclear reactors.

System description language for discrete event networks.

The language moved to a general purpose languages (i.e., SIMULA 67) and incorporated

classes of objects.

Simulating physical entities stimulated the idea of objects with independent existence as

opposed to the hierarchical existence of data items popularized by the static nesting of

blocks in ALGOL.

SIMULA 67 implemented on IBM System/360 and UNIVAC 1100 in Spring 1969.

A successor to SIMULA called Beta was designed more than 20 years later.

COBOL

Initial meeting sponsored in 1959 by the US Department of Defense

Common Business Oriented Language

Common programming language for data-processing applications overseen by

CODASYL (Committee on Data Systems Languages) starting in 1959.

ANSI standards appeared in 1968, 1974, and 1985.

Special facilities for the machine-dependent environment, including files. Primitive

form of structure to cope with the organization of files into a collection of

records.

Developed largely independentlly of the enormous event surrounding ALGOL.

Modern language implementations tend to provide abstractions for files, usually

as a stream of characters, regardless of the underlying machine, in order to provide

a high-level, machine-independent interface that is easier for programmers.

APL

Developed by Kenneth E. Iverson before 1960.

Designed at first to describe computer architecture and influenced by the field

of linear algebra.

Not intended for implementation.

Arrays are the main data structure.

The language has many operators, from an unusual set of symbols.

The operators apply to scalars, vectors, 2-D matrices, etc.

In APL, there is no precedence among operators and evaluation is performed

strictly right to left.

The number 1 is taken as a real number or the boolean value true as needed.

Guiding principles were simplicity and practicality.

IBM continues to develop the language (APL2, interface between APL2 & X-Windows)

A recent descendent of APL is the language J.

SNOBOL

StriNg Oriented symBOlic Language

Pronounced "snowball"

Developed at Bell Labs in the mid 1960s by D. Farber, R. Griswold, and I. Polonsky.

Designed primarily to process string data.

Distributed free.

ALGOL-like sucessor of SNOBOL called Icon developed by Griswold at Uty of Arizona.

Icon program for TPK algorithm:

procedure f (x)

return (sqrt(abs(x)) + 5.0*x*x*x)

end

procedure main (args)

A := table (0); # let A be a table with default value 0

every A[0 to 10] := read()

every i := 10 - (0 to 10) do

write (i, " ", 400.0 > f(A[i]) | "TOO LARGE", "\n")

end

Note the use of "generators" x to y, and x | y.

x to y generates x, x+1, and so on up to y

x | y generates x and, if necessary, y.

The Icon translator does not determine the types of expressions. Numbers are converted to

strings during program execution whenever the context demands it.

2.6. More recent events

PL/I

IBM launched a major effort to replace FORTRAN and COBOL in the mid-1960s

Borrowed block structure and recursive procedures from ALGOL

Added exception handling and multitasking

ANSI standard approved in 1976

Overall failure as PL/I was too big and too complex

BASIC

Beginner's All-purpose Symbolic Instruction Code

Designed at Darmouth College by J. Kemeny and T. Kurtz.

Interactive language, easy to learn, quick to compile, and easy to debug.

Variable consists of a single letter, or a single letter followed by a single digit

Variables are not declared and there is no distinction between integer and real numbers

A program is organized by line numbers

TPK program:

10 REM BASIC PROGRAM FOR TPK ALGORITHM

20 DIM A(11)

30 FOR I = 1 TO 11

40 INPUT A(I)

50 NEXT I

60 FOR J = 1 TO 11

70 LET I = 11 - J

80 LET Y = A(I+1) + 5 * A(I+1)

90 IF Y > 400.0 THEN 120

100 PRINT I+1, Y

110 GO TO 130

120 PRINT I, "TOO LARGE"

130 NEXT J

140 STOP

150 END

ANSI standard in 1978

New version of BASIC called TrueBASIC developed in 1985 by Kemeny and Kurtz.

It has many new features including interactive graphics.

C

Designed and implemented by D. Ritchie at Bell Laboratories in New Jersey in 1972.

Greatly influenced by B created by Ken Thompson for the first UNIX system on the PDP-11.

B was greatly influenced by BCPL a systems programming language developed for compiler

writing.

C allows low-level access to words and bits of computer memory and the #include facility

permits the flexible addition of system dependent definitions. C is ideal for graphics and

network programming applications that require greater access to the hardware environment.

This explains the gradual increase in the use of C compared to FORTRAN, COBOL, and

Pascal.

ANSI standard in 1989 (includes function prototypes)

TPK algorithm:

#include <stdio.h> /* include header file for standard I/O */

#include <math.h> /* include header file for math functions */

double f (double x) {

return (sqrt(fabs(x)) + 5.0*pow(x,3.0));

}

int main (int argc, char* argv[]) {

double A [11], y;

int i;

/* Read in the values of the array A */

for (i=0; i<11;i++) {

scanf ("%lf", &A[i]);

}

/* Apply "f" to each value of A in reverse order */

for (i=10; i>=0; i--) {

y = f (A[i]);

if (y > 400.0) {

printf ("%d TOO LARGE\n", i);

} else {

printf("%d %f\n", i, y);

}

}

return (0);

}

Structured programming

Pascal

Implemented by Niklaus Wirth who tried to influence the direction of ALGOL 68.

Includes dynamic arrays, recursive procedures, recursion.

Published description appeared in 1971.

Particularly troubling was the issue of dynamic arrays for which the need was

obvious but the solution was not.

Linked to the influence of Pascal was the structured approach to program methodology called

stepwise refinement. Programming could start at a higher-level than previously possible

thanks to user-defined data types and structured program constructs such as if and while.

Modula-2

In the 1970s, it became clear that Pascal and all other languages were inadequate for

programming in the large.

Big programs often borrow chunks of code. Problem is to organize these chunks into units

that can be written and borrowed clearly, efficiently, and seamlessly.

Little room left today for Wirth's Modula-2 compared to other languages with modules (Ada),

and other popular languages like C and C++.

Wirth has moved on with Oberon, a new language with typed object-oriented features

Logic programming

PROLOG emerged from a project in natural language translation headed by Alain

Colmerauer at the University of Marseilles.

First preliminary interpreter written in ALGOL W in 1972, then rewritten in FORTRAN

in 1973.

PROLOG grew by capturing certain logical inferences that might implicitly be made

in natural language (not designed as a theorem prover for a particular logical system).

Robert Kowalski later proved that the approach is complete for what are known as Horn

clauses.

Object-oriented languages

Smalltalk

Influenced by SIMULA.

SIMULA allocates data structures in a last-in/first-out or stack manner. Structures

have a more independent existence. Each structure is like its own little computer.

Smalltalk objects have iconic representations on the display.

In the early 1970s, Xerox PARC developed of a PC system using Smalltalk as its language.

Smalltalk-80 was reviewed and debugged by Apple Computer, DEC, HP, and Tektronix.

Objects are the independent units of the program. Classes are a description of a collection of

objects. An object is an instance of a class. Classes are organized in a class hierarchy. A class

may inherit properties from super classes higher up in the class hierarchy. Objects interact

by sending messages to each other. The messages that an object reacts to are implemented

by its methods. The hierachical organization of classes and method suites can be exploited

by some new kinds of software development tools. One category os such tools is called a

browser which allows the programmer to jump from class to class to easily view the

associated code.

Smalltalk is an entire programming system (large overhead, and portability issues).

C++

More conventional environment than Smalltalk where a compiler takes an ASCII program

in a file an produces an executable file.

Developed by Bjarne Stroustrup in 1984.

Motivated by SIMULA to add classes to C in a pre-processing step of the compiler.

Modula-3 and Oberon

New generation of OO languages were objects are akin to records.

Ada

Development started in the mid-1970s by the DoD as an effort to reduce the mounting

software costs caused by the multitude of languages used by the DoD.

A team from Honeywell Bull of France produced the design that was selected.

Standard appeared in 1983.

The language includes high-level constructs for concurrent execution and real-time

programming, innovations in the organization of types, a construct for aggregating

data structures and subprocedures called a "package", and a mechanism for

exception handling.

TPK algorithm in Ada:

with text_io, math;

procedure tpk is

package int_io is new text_io.integer_io (INTEGER);

package real_io is new text_io.float_io (LONG_FLOAT);

A : array (0 .. 10) of LONG_FLOAT;

-- We assume a square root function in package math

function f (x: LONG_FLOAT) return LONG_FLOAT is

begin

return (math.sqrt (ABS x) + 5.0*x**3);

end f;

begin

-- Read in the values of the array A

for I in A'Range loop

real_io.get (A (I));

end loop;

-- Apply "f" to each value of A in reverse order

for I in reverse A'RANGE loop

declare

Y : constant LONG_FLOAT := f (LONG_FLOAT (I));

begin

if (400.0 >= Y)

then

int_io.put (I);

real_io.put (Y);

text_io.new_line;

else

int_io.put (I);

text_io.put_line ("TOO LARGE");

end if;

end;

end loop;

end tpk;

Intermetrics revised the language in 1995. Major changes concerned objects,

data-oriented synchronization, and real-time programming.