Paradigm(s) | procedural, imperative, structured |
---|---|
Appeared in | 1966 |
Developer | Niklaus Wirth, C. A. R. Hoare |
Influenced by | ALGOL 60 |
Influenced | Pascal |
ALGOL W is a programming language. It was based on a proposal for ALGOL X by Niklaus Wirth and C. A. R. Hoare as a successor to ALGOL 60 in IFIP Working Group 2.1. When the committee decided that the proposal was not a sufficient advance over ALGOL 60, the proposal was published as A contribution to the development of ALGOL.[1] After making small modifications to the language[2] Wirth supervised a high quality implementation for the IBM/360 at Stanford University that was widely distributed.[3]
It represented a relatively conservative modification of ALGOL 60, adding string, bitstring, complex number and reference to record datatypes and call-by-result passing of parameters, introducing the while statement, replacing switch with the case statement, and generally tightening up the language.
The implementation was written in PL/360, an ALGOL-like assembly language designed by Wirth. The implementation included influential debugging and profiling abilities.
Contents |
ALGOL W's syntax is built on a subset of the EBCDIC character set. In ALGOL 60 reserved words are distinct lexical items, but in ALGOL W they are merely sequences of characters, and do not need to be stropped. Reserved words and identifiers are separated by spaces.[3] In these ways ALGOL W's syntax resembles that of Pascal and later languages.
The Algol W Language Description[4] defines Algol W in an affix grammar that resembles BNF. This grammar was a precursor of the Van Wijngaarden grammar.[1][5]
Much of Algol W's semantics is defined grammatically[4]:
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