World Library  
Flag as Inappropriate
Email this Article

Algol W

Paradigm procedural, imperative, structured
Developer Niklaus Wirth, C. A. R. Hoare
First appeared 1966 (1966)
Influenced by

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.


  • Syntax and semantics 1
  • Example 2
  • Implementation 3
  • References 4
  • External links 5

Syntax and semantics

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]

  • 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 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.


This demonstrates ALGOL W's record type facility.

    STRING(20) NAME; 

        WHILE (P ¬= NULL) AND (¬ MALE(P)) OR (P = FATHER(R)) DO
            P := ELDERSIBLING(P);
        WHILE (M ¬= NULL) AND (¬ MALE(M)) DO
            M := ELDERSIBLING(M);
        IF P = NULL THEN 
        ELSE IF M = NULL THEN 
            IF AGE(P) < AGE(M) THEN P ELSE M


The major part of ALGOL W, amounting to approximately 2700 cards, was written in Wirth's PL360. An interface module for the IBM operating system in use (OS, DOS, MTS, ORVYL) was written in IBM assembler, amounting to fewer than 250 cards. [1]

"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 required 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."


  1. ^ a b Niklaus Wirth & C. A. R Hoare (1966) A contribution to the development of ALGOL. Communications of the ACM, Vol.9, pp. 413 - 432
  2. ^ Niklaus Wirth (1966), Additional notes on "A Contribution to the Development of ALGOL", ALGOL Bulletin, Number 24 pp. 13 - 17.
  3. ^ a b Stanford Computer Science Department Technical Report CS-TR-68-89 (Various documents for Stanford University's 1972 implementation of ALGOL W; this report includes the ALGOL W Language Description.)
  4. ^ a b Algol W Language Description, June 1972
  5. ^ Adriaan van Wijngaarden (1965), Orthogonal Design and Description of a Formal Language,MR76 Mathematical Centre, Amsterdam

External links

  • aw2c, an ALGOL W compiler for Linux
  • ALGOL W @ Everything2, an informal but detailed description of the language by a former user, with sidebars extolling ALGOL W over Pascal as an educational programming language
  • 1969 ALGOL W compiler listing at
  • The Michigan Terminal System Manuals, Volume 16: ALGOL W in MTS
  • Algol W materials More than 200 Algol W programs and documentation
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.