ALGOL W
   HOME

TheInfoList



OR:

ALGOL W is a
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
. It is based on a proposal for
ALGOL X ALGOL X was the code name given to a programming language which was being developed as a successor to ALGOL 60, by the International Federation for Information Processing (IFIP) IFIP Working Group 2.1 on Algorithmic Languages and Calculi, which ...
by Niklaus Wirth and
Tony Hoare Sir Charles Antony Richard Hoare (Tony Hoare or C. A. R. Hoare) (born 11 January 1934) 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, 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 fo ...
and
reference 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 '' name'' ...
to record
data type In computer science and computer programming, a data type (or simply type) is a set of possible values and a set of allowed operations on it. A data type tells the compiler or interpreter how the programmer intends to use the data. Most progra ...
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 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 that was announced by IBM on April 7, 1964, and delivered between 1965 and 1978. It was the first family of computers designed to cover both commercial and scientific applic ...
at
Stanford University Stanford University, officially Leland Stanford Junior University, is a private research university in Stanford, California. The campus occupies , among the largest in the United States, and enrolls over 17,000 students. Stanford is conside ...
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 computer programming, assembly language (or 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 b ...
designed by Wirth. The implementation includes influential debugging and profiling abilities. ALGOL W served as the basis for the
Pascal Pascal, Pascal's or PASCAL may refer to: People and fictional characters * Pascal (given name), including a list of people with the name * Pascal (surname), including a list of people and fictional characters with the name ** Blaise Pascal, Frenc ...
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 ...
character encoding Character encoding is the process of assigning numbers to graphical characters, especially the written characters of human language, allowing them to be stored, transmitted, and transformed using digital computers. The numerical values tha ...
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 Pascal, Pascal's or PASCAL may refer to: People and fictional characters * Pascal (given name), including a list of people with the name * Pascal (surname), including a list of people and fictional characters with the name ** Blaise Pascal, Frenc ...
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 () or Backus normal form (BNF) is a metasyntax notation for context-free grammars, often used to describe the syntax of languages used in computing, such as computer programming languages, document format ...
(BNF). This
formal grammar In formal language theory, a grammar (when the context is not given, often called a formal grammar for clarity) describes how to form strings from a language's alphabet that are valid according to the language's syntax. A grammar does not describe ...
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 Scope or scopes may refer to: People with the surname * Jamie Scope (born 1986), English footballer * John T. Scopes (1900–1970), central figure in the Scopes Trial regarding the teaching of evolution Arts, media, and entertainment * Cinema ...
. 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 GoTo (goto, GOTO, GO TO or other case combinations, depending on the programming language) is a statement found in many computer programming languages. It performs a one-way transfer of control to another line of code; in contrast a function c ...
label. * The types 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


Implementation

The major part of ALGOL W, amounting to approximately 2,700 cards, was written in Wirth's PL360. An interface module for the IBM
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
(OS) in use (OS, DOS, MTS, ORVYL) was written in IBM assembly language, amounting to fewer than 250 cards

In an OS environment on a 360/67 with spooled input and output files, the compiler will recompile itself in about 25 seconds. The compiler is approximately 2700 card images. Thus, when the OS scheduler time is subtracted from the execution time given above, it is seen that the compiler runs at a speed in excess of 100 cards per second (for dense code).

In a DOS environment on a 360/30, the compiler is limited only by the speed of the card reader. The compiler has successfully recompiled itself on a 64K 360/30 at a rate of 1200 cards per minute (the speed of the card reader). This is impressive when compared to the time needed for the DOS Assembler to assemble the interface module which consists of under 250 cards. When the macro instructions are expanded, the DOS interface has 972 card images and the Assembler takes 15 minutes for the assembly.


References


External links


aw2c
– ALGOL W compiler for
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...

awe
– aw2c updated version
ALGOL W @ Everything2
– informal but detailed description of the language by a former user, with sidebars extolling ALGOL W over
Pascal Pascal, Pascal's or PASCAL may refer to: People and fictional characters * Pascal (given name), including a list of people with the name * Pascal (surname), including a list of people and fictional characters with the name ** Blaise Pascal, Frenc ...
as an
educational programming language An educational programming language is a programming language that is designed mostly as an instrument for learning, and less as a tool for writing programs to perform work. Types of educational programming languages Assembly languages Origi ...

1969 ALGOL W compiler listing
at bitsavers.org * The
Michigan Terminal System The Michigan Terminal System (MTS) is one of the first time-sharing computer operating systems.. Developed in 1967 at the University of Michigan for use on IBM S/360-67, S/370 and compatible mainframe computers, it was developed and used by a ...
Manuals, Volume 16
ALGOL W in MTS
More than 200 ALGOL W programs and documentation {{Authority control Procedural programming languages Structured programming languages ALGOL 60 dialect Programming languages created in 1966