ALGOL W explained

ALGOL W
Paradigms:Multi-paradigm

procedural, imperative, structured

Family:ALGOL
Designers:Niklaus Wirth, Tony Hoare
Typing:Static, strong
Scope:Lexical
Programming Language:PL360
Platform:IBM System/360
Operating System:OS/360, MTS
Influenced By:ALGOL 60
Influenced:Pascal, Modula-2

ALGOL W is a programming language. It is based on a proposal for ALGOL X by Niklaus Wirth and Tony Hoare as a successor to ALGOL 60. ALGOL W is a relatively simple upgrade of the original ALGOL 60, adding string, bitstring, complex number and reference to record data types 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 was selected in a highly contentious meeting. Wirth later published his version as A contribution to the development of ALGOL.[1] With a number of small additions, this eventually became ALGOL W.

Wirth supervised a high quality implementation for the IBM System/360 at Stanford University that was widely distributed.[2] [3] The implementation was written in PL360, an ALGOL-like assembly language 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 is built on a subset of the EBCDIC character encoding set. In ALGOL 60, 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.[2] 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 Backus–Naur form (BNF). This formal grammar was a precursor of the Van Wijngaarden grammar.[1] [5]

Much of ALGOL W's semantics is defined grammatically:[4]

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

External links

Notes and References

  1. Wirth . Niklaus . Niklaus Wirth . Hoare . C. A. R. . Tony Hoare . June 1966 . A contribution to the development of ALGOL . Communications of the ACM . 9 . 6 . 413–432 . 10.1145/365696.365702 . 11901135 . . 2020-10-07. free .
  2. Bauer . Henry R. . Becker . Sheldon I. . Graham . Susan L. . Forsythe . George E. . Satterthwaite . Edwin H. . March 1968 . Technical Report Number: CS-TR-68-89 . Computer Science Department . Stanford University. (Various documents for Stanford's 1972 implementation of ALGOL W; this report includes the ALGOL W Language Description.
  3. Web site: Sites . Richard . ALGOL W Reference Manual . i.stanford.edu . Stanford University . 24 July 2022.
  4. Bauer . Henry R. . Becker . Sheldon I. . Graham . Susan L. . Satterthwaite . Edwin H. . Sites . Richard L. . June 1972 . ALGOL W Language Description .
  5. van Wijngaarden . Adriaan . Adriaan van Wijngaarden . 22 October 1965 . Orthogonal Design and Description of a Formal Language: MR76 . Mathematical Centre . Amsterdam, Netherlands . Ernst-Abbe-Hochschule Jena, University of Applied Sciences, Germany . 2020-10-07 . 29 October 2019 . https://web.archive.org/web/20191029151436/http://web.eah-jena.de/%7Ekleine/history/languages/VanWijngaarden-MR76.pdf . dead .