ALGOL W
Encyclopedia
ALGOL W is a programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

. It was based on a proposal for ALGOL X
ALGOL X
ALGOL X was the code name given to the programming language which the Working Group 2.1 on ALGOL of the International Federation for Information Processing was to develop as a successor to ALGOL 60. It attempted to find a "short-term solution to existing difficulties"."... the Algol 60 devotees had...

 by Niklaus Wirth
Niklaus Wirth
Niklaus Emil Wirth is a Swiss computer scientist, best known for designing several programming languages, including Pascal, and for pioneering several classic topics in software engineering. In 1984 he won the Turing Award for developing a sequence of innovative computer languages.-Biography:Wirth...

 and C. A. R. Hoare
C. A. R. Hoare
Sir Charles Antony Richard Hoare , commonly known as Tony Hoare or C. A. R. Hoare, is a British computer scientist best known for the development of Quicksort, one of the world's most widely used sorting algorithms...

 as a successor to ALGOL 60
ALGOL 60
ALGOL 60 is a member of the ALGOL family of computer programming languages. It gave rise to many other programming languages, including BCPL, B, Pascal, Simula, C, and many others. ALGOL 58 introduced code blocks and the begin and end pairs for delimiting them...

 in IFIP Working Group 2.1
IFIP Working Group 2.1
IFIP Working Group 2.1 on Algorithmic Languages and Calculi is a working group of the International Federation for Information Processing ....

. 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. After making small modifications to the language Wirth supervised a high quality implementation for the IBM/360 at Stanford University
Stanford University
The Leland Stanford Junior University, commonly referred to as Stanford University or Stanford, is a private research university on an campus located near Palo Alto, California. It is situated in the northwestern Santa Clara Valley on the San Francisco Peninsula, approximately northwest of San...

 that was widely distributed.

It represented a relatively conservative modification of ALGOL 60, adding string, bitstring, complex number
Complex number
A complex number is a number consisting of a real part and an imaginary part. Complex numbers extend the idea of the one-dimensional number line to the two-dimensional complex plane by using the number line for the real part and adding a vertical axis to plot the imaginary part...

 and reference
Reference (computer science)
In computer science, a reference is a value that enables a program to indirectly access a particular data item, such as a variable or a record, in the computer's memory or in some other storage device. The reference is said to refer to the data item, and accessing those data is called...

 to record
Record (computer science)
In computer science, a record is an instance of a product of primitive data types called a tuple. In C it is the compound data in a struct. Records are among the simplest data structures. A record is a value that contains other values, typically in fixed number and sequence and typically indexed...

 datatypes and call-by-result passing of parameter
Parameter (computer science)
In computer programming, a parameter is a special kind of variable, used in a subroutine to refer to one of the pieces of data provided as input to the subroutine. These pieces of data are called arguments...

s, 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

ALGOL W's syntax is built on a subset of the EBCDIC
EBCDIC
Extended Binary Coded Decimal Interchange Code is an 8-bit character encoding used mainly on IBM mainframe and IBM midrange computer operating systems....

 character set. In ALGOL 60
ALGOL 60
ALGOL 60 is a member of the ALGOL family of computer programming languages. It gave rise to many other programming languages, including BCPL, B, Pascal, Simula, C, and many others. ALGOL 58 introduced code blocks and the begin and end pairs for delimiting them...

 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. In these ways ALGOL W's syntax resembles that of Pascal
Pascal (programming language)
Pascal is an influential imperative and procedural programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structuring.A derivative known as Object Pascal...

 and later languages.

The Algol W Language Description defines Algol W in an affix grammar
Affix grammar
An affix grammar is a kind of formal grammar; it is used to describe the syntax of languages, mainly computer languages, using an approach based on how natural language is typically described....

 that resembles BNF
Backus–Naur form
In computer science, BNF is a notation technique for context-free grammars, often used to describe the syntax of languages used in computing, such as computer programming languages, document formats, instruction sets and communication protocols.It is applied wherever exact descriptions of...

. This grammar was a precursor of the Van Wijngaarden grammar
Van Wijngaarden grammar
In computer science, a Van Wijngaarden grammar is a two-level grammar which provides a technique to define potentially infinite context-free grammars in a finite number of rules...

.

Much of Algol W's semantics is defined grammatically:
  • Identifiers are distinguished by their definition within the current scope
    Scope (programming)
    In computer programming, scope is an enclosing context where values and expressions are associated. Various programming languages have various types of scopes. The type of scope determines what kind of entities it can contain and how it affects them—or semantics...

    . 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 is a statement found in many computer programming languages. It is a combination of the English words go and to. It performs a one-way transfer of control to another line of code; in contrast a function call normally returns control...

     label.

  • The types
    Type system
    A type system associates a type with each computed value. By examining the flow of these values, a type system attempts to ensure or prove that no type errors can occur...

     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
Record (computer science)
In computer science, a record is an instance of a product of primitive data types called a tuple. In C it is the compound data in a struct. Records are among the simplest data structures. A record is a value that contains other values, typically in fixed number and sequence and typically indexed...

 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

  • aw2c, an ALGOL W compiler for Linux
    Linux
    Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

  • ALGOL W @ Everything2, an informal but detailed description of the language by a former user, with sidebars extolling ALGOL W over Pascal
    Pascal (programming language)
    Pascal is an influential imperative and procedural programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structuring.A derivative known as Object Pascal...

     as an educational programming language
    Educational programming language
    An educational programming language is a programming language that is designed primarily as a learning instrument and not so much as a tool for writing programs for real-world work.-Learning paths:...

  • 1969 ALGOL W compiler listing at bitsavers.org
  • The Michigan Terminal System
    Michigan Terminal System
    The Michigan Terminal System is one of the first time-sharing computer operating systems. Initially 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 consortium of eight universities in the United...

    Manuals, Volume 16: ALGOL W in MTS
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK