Hubbry Logo
search
logo
S-algol
S-algol
current hub

S-algol

logo
Community Hub0 Subscribers
Write something...
Be the first to start a discussion here.
Be the first to start a discussion here.
See all
S-algol

S-algol (St Andrews Algol) is a computer programming language derivative of ALGOL 60 developed at the University of St Andrews in 1979 by Ron Morrison and Tony Davie. The language is a modification of ALGOL to contain orthogonal data types that Morrison created for his PhD thesis. Morrison would go on to become professor at the university and head of the department of computer science. The S-algol language was used for teaching at the university at an undergraduate level until 1999. It was also the language taught for several years in the 1980s at a local school in St. Andrews, Madras College. The computer science text Recursive Descent Compiling describes a recursive descent compiler for S-algol, implemented in S-algol.

PS-algol is a persistent derivative of S-algol. It was developed around 1981 at the University of Edinburgh and of St Andrews. It supports database ability by providing for longevity of data in the form of a persistent heap that survives termination of PS-algol programs.

Ron Morrison's 1979 PhD thesis, On the Development of Algol, describes the design and implementation of the S-algol language. The technical report defining the language, The S-algol Reference Manual (1979, 1988), thanks several people for their help, including David Turner for discussions on language design around 1975. The 1981 computer science text Recursive Descent Compiling describes the compiler implementation and bootstrapping process, and the 1982 book An Introduction to Programming with S-algol uses the language to teach computer programming.

The first S-algol implementation was on a PDP-11/40 computer running the Unix operating system. Due to the small 64 kilobyte address space available on the PDP-11, an interpreted bytecode implementation was chosen. A single-pass, recursive descent compiler written in S-algol translated S-algol source into S-code, a bytecode for a stack-based abstract machine tailored for S-algol. The S-code was then executed by an interpreter. The S-algol implementation had many similarities with work on earlier Pascal compilers. The technique of using a recursive descent compiler to produce code for an abstract machine was well known, with the Pascal P compiler being a famous example from the early 1970s. The S-algol compiler was written using the stepwise refinement process described by Urs Amman for the development of a Pascal compiler and championed by the inventor of Pascal, Niklaus Wirth.

Reflecting the memory organization of the PDP-11 as 32K 16-bit words, the S-code instruction encoding was designed so that each bytecode consisted of one word. The initial bootstrap was performed by writing an S-algol compiler in Algol W on the IBM/360 that produced S-code, and using it to compile the compiler written in S-algol to S-code. The resulting S-code file was copied to the PDP-11 and executed on an S-code interpreter written for the PDP-11, making it self-hosting. The self-hosted S-algol compiler executed approximately 7.7 million S-code instructions to compile itself, generating an output file of about ten thousand S-code instructions (16-bit words).

An S-code interpreter was written for the VAX computer running VMS, making the VAX the first S-algol port. S-algol was also ported to the Zilog Z80 microprocessor running CP/M, including raster graphics facilities that had been added to the language. In 1983, S-algol was used as the basis for the PS-algol system, used for research in persistence. The PS-algol S-code interpreter was implemented in C, and the S-code language was extended to include raster graphics. The PS-algol implementation was the basis for S-algol ports to the Macintosh and Sun workstations, featuring a compiler rewritten in C and targeting the extended S-code.

S-algol was the basis for the PS-algol research in 1983, and a few years later PS-algol became the starting point for the Napier88 language and implementation. While all S-algol compilers produced S-code to be interpreted, a later Napier88 implementation experimented with generating code in C and compiling it with the gcc compiler to provide a native code implementation.

An S-algol program is a sequence of declarations and clauses. Language elements that are declared include constants, variables, procedures and structures. Constant and variable declarations must specify an initial value. The compiler infers the data type of the declared constant or variable from the type of the initial value, so the type is not stated explicitly. Data types include integer, real, boolean, string, pointer (to a structure), and file, and vectors (arrays) of these types. Procedure declarations do specify the data types of their arguments and return value (unless void). Structures also specify the data types of their fields. Clauses include expressions and control structures (if, case, for, while and repeat while). The if and case control structures can have values and can be used freely in expressions as long as the type compatibility rules are met.

See all
User Avatar
No comments yet.