ALGOL W is a
programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
. It is based on a proposal for
ALGOL X by
Niklaus Wirth
Niklaus Emil Wirth ( IPA: ) (15 February 1934 – 1 January 2024) was a Swiss computer scientist. He designed several programming languages, including Pascal, and pioneered several classic topics in software engineering. In 1984, he won the Tu ...
and
Tony Hoare
Sir Charles Antony Richard Hoare (; born 11 January 1934), also known as C. A. R. Hoare, is a British computer scientist who has made foundational contributions to programming languages, algorithms, operating systems, formal verification, and ...
as a successor to
ALGOL 60
ALGOL 60 (short for ''Algorithmic Language 1960'') is a member of the ALGOL family of computer programming languages. It followed on from ALGOL 58 which had introduced code blocks and the begin and end pairs for delimiting them, representing a ...
. ALGOL W is a relatively simple upgrade of the original ALGOL 60, adding
string
String or strings may refer to:
*String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects
Arts, entertainment, and media Films
* ''Strings'' (1991 film), a Canadian anim ...
, bitstring,
complex number
In mathematics, a complex number is an element of a number system that extends the real numbers with a specific element denoted , called the imaginary unit and satisfying the equation i^= -1; every complex number can be expressed in the for ...
and
reference
A reference is a relationship between objects in which one object designates, or acts as a means by which to connect to or link to, another object. The first object in this relation is said to ''refer to'' the second object. It is called a ''nam ...
to
record data type
In computer science and computer programming, a data type (or simply type) is a collection or grouping of data values, usually specified by a set of possible values, a set of allowed operations on these values, and/or a representation of these ...
s and
call-by-result passing of
parameters, introducing the
while
statement, replacing
switch
with the
case
statement, and generally tightening up the language.
Wirth's entry was considered too little of an advance over ALGOL 60, and the more complex entry from
Adriaan van Wijngaarden that would later become
ALGOL 68
ALGOL 68 (short for ''Algorithmic Language 1968'') is an imperative programming language member of the ALGOL family that was conceived as a successor to the ALGOL 60 language, designed with the goal of a much wider scope of application and ...
was selected in a highly contentious meeting. Wirth later published his version as ''A contribution to the development of ALGOL''.
With a number of small additions, this eventually became ALGOL W.
Wirth supervised a high quality implementation for the
IBM System/360
The IBM System/360 (S/360) is a family of mainframe computer systems announced by IBM on April 7, 1964, and delivered between 1965 and 1978. System/360 was the first family of computers designed to cover both commercial and scientific applicati ...
at
Stanford University
Leland Stanford Junior University, commonly referred to as Stanford University, is a Private university, private research university in Stanford, California, United States. It was founded in 1885 by railroad magnate Leland Stanford (the eighth ...
that was widely distributed.
[ (Various documents for Stanford's 1972 implementation of ALGOL W; this report includes the ''ALGOL W Language Description''.] The implementation was written in
PL360, an ALGOL-like
assembly language
In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
designed by Wirth. The implementation includes influential debugging and
profiling abilities.
ALGOL W served as the basis for the
Pascal language, and the syntax of ALGOL W will be immediately familiar to anyone with Pascal experience. The key differences are improvements to record handling in Pascal, and, oddly, the loss of ALGOL W's ability to define the length of an array at runtime, which is one of Pascal's most-complained-about features.
Syntax and semantics
ALGOL W's
syntax
In linguistics, syntax ( ) is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure (constituenc ...
is built on a subset of the
EBCDIC
Extended Binary Coded Decimal Interchange Code (EBCDIC; ) is an eight- bit character encoding used mainly on IBM mainframe and IBM midrange computer operating systems. It descended from the code used with punched cards and the corresponding si ...
character encoding
Character encoding is the process of assigning numbers to graphical character (computing), characters, especially the written characters of human language, allowing them to be stored, transmitted, and transformed using computers. The numerical v ...
set. In
ALGOL 60
ALGOL 60 (short for ''Algorithmic Language 1960'') is a member of the ALGOL family of computer programming languages. It followed on from ALGOL 58 which had introduced code blocks and the begin and end pairs for delimiting them, representing a ...
, reserved words are distinct lexical items, but in ALGOL W they are only sequences of characters, and do not need to be
stropped. Reserved words and identifiers are separated by spaces.
In these ways ALGOL W's syntax resembles that of
Pascal and later languages.
The ''ALGOL W Language Description''
defines ALGOL W in an
affix grammar that resembles
Backus–Naur form
In computer science, Backus–Naur form (BNF, pronounced ), also known as Backus normal form, is a notation system for defining the Syntax (programming languages), syntax of Programming language, programming languages and other Formal language, for ...
(BNF). This
formal grammar
A formal grammar is a set of Terminal and nonterminal symbols, symbols and the Production (computer science), production rules for rewriting some of them into every possible string of a formal language over an Alphabet (formal languages), alphabe ...
was a precursor of the
Van Wijngaarden grammar.
Much of ALGOL W's semantics is defined grammatically:
* Identifiers are distinguished by their definition within the current
scope. For example, a
⟨procedure identifier⟩
is an identifier that has been defined by a procedure declaration, a
⟨label identifier⟩
is an identifier that is being used as a
goto label.
* The
types
Type may refer to:
Science and technology Computing
* Typing, producing text via a keyboard, typewriter, etc.
* Data type, collection of values used for computations.
* File type
* TYPE (DOS command), a command to display contents of a file.
* Ty ...
of
variables and
expressions are represented by affixes. For example
⟨τ function identifier⟩
is the syntactic entity for a function that returns a value of type
τ
, if an identifier has been declared as an integer function in the current scope then that is expanded to
⟨integer function identifier⟩
.
* Type errors are grammatical errors. For example,
⟨integer expression⟩ / ⟨integer expression⟩
and
⟨real expression⟩ / ⟨real expression⟩
are valid but distinct syntactic entities that represent expressions, but
⟨real expression⟩ DIV ⟨integer expression⟩
(i.e., integer division performed on a floating-point value) is an invalid syntactic entity.
Example
This demonstrates ALGOL W's
record type facility.
RECORD PERSON (
STRING(20) NAME;
INTEGER AGE;
LOGICAL MALE;
REFERENCE(PERSON) FATHER, MOTHER, YOUNGESTOFFSPRING, ELDERSIBLING
);
REFERENCE(PERSON) PROCEDURE YOUNGESTUNCLE (REFERENCE(PERSON) R);
BEGIN
REFERENCE(PERSON) P, M;
P := YOUNGESTOFFSPRING(FATHER(FATHER(R)));
WHILE (P ¬= NULL) AND (¬ MALE(P)) OR (P = FATHER(R)) DO
P := ELDERSIBLING(P);
M := YOUNGESTOFFSPRING(MOTHER(MOTHER(R)));
WHILE (M ¬= NULL) AND (¬ MALE(M)) DO
M := ELDERSIBLING(M);
IF P = NULL THEN
M
ELSE IF M = NULL THEN
P
ELSE
IF AGE(P) < AGE(M) THEN P ELSE M
END
References
External links
aw2c– ALGOL W compiler for
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
by Glyn Webster
awe– current version by Glyn Webster
ALGOL W @ Everything2– informal but detailed description of the language by a former user, with sidebars extolling ALGOL W over
Pascal as an
educational programming language1969 ALGOL W compiler listingat bitsavers.org
* The
Michigan Terminal System
The Michigan Terminal System (MTS) is one of the first time-sharing computer operating systems.. Created in 1967 at the University of Michigan for use on IBM System/360, IBM S/360-67, S/370 and compatible mainframe computers, it was developed and ...
Manuals, Volume 16
ALGOL W in MTSMore than 200 ALGOL W programs and documentation
{{Authority control
Procedural programming languages
Structured programming languages
ALGOL 60 dialect
Programming languages created in 1966