Family | ALGOL |
---|---|
Designed by | Dan Swinehart Robert Sproull |
Developer | Stanford University |
First appeared | 1969 |
Platform | PDP-10, others |
Influenced by | |
ALGOL-60 | |
Influenced | |
MAINSAIL |
SAIL, the Stanford Artificial Intelligence Language, was developed by Dan Swinehart and Bob Sproull of the Stanford AI Lab. It was originally a large ALGOL 60-like language for the PDP-10 and DECSYSTEM-20. The language combined the earlier PDP-6/-10 language GOGOL compiler, essentially an integer-only version of ALGOL, with the associative store from the LEAP language. The first release was in November 1969 and it saw continued development into the 1980s, including a commercial derivative, MAINSAIL.
SAIL's main feature is a symbolic data system based upon an associative store based on LEAP by Jerry Feldman and Paul Rovner. Items may be stored as unordered sets or as associations (triples). Other features include processes, procedure variables, events and interrupts, contexts, backtracking and record garbage collection. It also has block-structured macros, a coroutining facility and some new data types intended for building search trees and association lists.
The GOGOL compiler was originally written by Bill McKeeman on the PDP-1. It was essentially an integer-only version of ALGOL-60 with a number of additions to provide direct access to the memory and other hardware to allow it to be used as a systems programming language. It reduced arrays to a single dimension, removed any ability to perform dynamic memory allocations, but did add some additional string functionality. A greatly updated version by John Sauter, GOGOL II, was written as part of a port of the underlying operating system from ODIN to THOR. When the Stanford AI Lab received their PDP-6, Sauter, Pettit and (mostly) Dan Swinehart wrote GOGOL III for the new machine. [1]
Swinehart, joined by Robert Sproull, merged the GOGOL syntax with additions from the contemporary versions of the LEAP language to produce the first version of SAIL in November 1969. The main feature of LEAP as a language was its use of associative storage, more commonly known today as a Map or Dictionary. In LEAP, one could set the value of a field in a type using a triple, with the first entry being the variable name, the second being the field name, and the third the value. [2]
Further improvements were added by Russell Taylor, Jim Low and Hana Samet, who added processes, procedure variables, interrupts, context, matching procedures, a new macro system, and other features. Development then passed to Taylor, John Reiser and Robert Smith, who added a debugger, a system-level print statement, records, and performed the conversion from Standord's own SUAI to TENEX. It was later ported to DEC's TOPS-10 as well, while the original TENEX version worked without modification under TOPS-20. [2]
Like many ALGOL systems, and the later Pascal, the basic structure of SAIL is based on the block, which is denoted by the code between the keywords BEGIN
and END
. Within a block there is further structure, with the declarations of local variables at the top, if any, and the code, or statements, following. In contrast to most dialects, SAIL allowed one to place a string after the BEGIN
, like BEGIN "program"
, and then end the block with END "program"
. The compiler would use these, if entered, to check for proper bracketing. [3] SAIL did not include the equivalent of a PROGRAM
block as in Pascal, nor a main
as in C, execution started with the first line of code in the outermost block. [4]
Standard statements included IF...THEN...ELSE
, [5] FOR...STEP...UNTIL...DO
, [6] WHILE...DO
for top-tested loops, WHILE...UNTIL
for bottom-tested, and GOTO
which used a label. [7] The CASE
was similar to switch
in C, but normally used a somewhat different syntax, like CASE i OF ("Zero","One","Two");
, which returns the appropriate string based on the value of i. [5] If one wanted to test explicit values in the CASE, the values had to be in square brackets:
CASEIOFBEGIN[0]10;[4]25;[6][7]50END;
This code will ignore values like 1 to 3, and only return a value for the listed values. Note that the last item cannot have a semicolon following. [8]
DONE
exited from a block, typically used in loops, and CONTINUE
returned to the top of the block. An infinite loop was typically implemented with WHILE TRUE DO...
. [9]
Procedures were implemented in a fashion similar to the C programming language, with the return type, if any, in front of the name, for instance, STRING PROCEDURE toUpper(STRING originalStr);BEGIN...
. Note the uncommon use of the semicolon here, whereas Pascal would immediately follow with a block, typically a BEGIN
. [10]
In order to improve performance, SAIL added two procedure qualifiers, SIMPLE
and RECURSIVE
. RECURSIVE
told the compiler that the procedure might call itself, and thus its local variables had to be written to the stack, not just the subroutine return information. SIMPLE
did the opposite, demanding the procedure have no local variables at all, not allowing GOTO
out of the function, and could not refer to enclosing procedure's variables. These directives could avoid the requirement of filling out a complete activation record, thereby improving performance. [11] This also had the side-effect of meaning that variables declared within a procedure that was not marked RECURSIVE would not be reset between calls, [11] acting similar to C's static
.
SAIL also included the FORWARD
qualifier, used to insert forward declarations, typically when two procedures call each other. [10] RETURN
worked as in C, exiting the procedure and returning to the caller, as well as optionally returning a value if the procedure uses one. [12] Parameters passed to the procedures could be by VALUE
or REFERENCE
, the later allowing values to be passed back. [13]
The basic variable types in SAIL are integers, reals (floating point), booleans, and strings. [14] Type conversions were automatic, so INTEGER i;i←SQRT(5);
would convert the value 5 to a double as that is what SQRT requires, and then cast the result to an integer. [3] Any of these types can be turned into an array by adding the ARRAY
qualifier and placing the array bounds in brackets, for instance, REAL ARRAY weeks[1:52]);
. SAIL supported 1-d and 2-d arrays. [15]
The language used the left-arrow for assignment, ←
, or the underscore on platforms that did not have Stanford ASCII. [16] It included a number of standard functions like square root, all of the common math operators, and was otherwise similar to most ALGOL derivatives for normal programming. [17]
Strings were manipulated using array slicing, with aStr[i TO j]
returning the substring with characters from i to j, or aStr[i FOR j]
which returned the substring starting at i and running for j characters. [18] The INF
(inity) keyword represented the end of the string, so one could aStr[i TO INF]
to return everything from i on. [3] String functions and operators included EQU
for testing if two strings were equal, [5] the ampersand for concatenation, LENGTH
, and LOP
which removes the first character from the string. [18] There was no way to compare strings other than EQU
, operators like <
were defined only for numbers. [4]
The concept of records as a data type had only recently been introduced when SAIL was being written. This feature thus shows the signs of being "bolted on" to the language syntax. For instance a record structure was defined using the RECORD!CLASS
statement: RECORD!CLASS person (STRING name, address; INTEGER accountnum; REAL balance)
. This statement worked in a fashion similar to the RECORD
statement in Pascal, defining the template for the record. To create a record, one used the NEW!RECORD
statement, which returned a RECORD!POINTER
. Pointers were typed, and could be typed to more than one type, for instance, RECORD POINTER (person,university) rp;
defines rp, a pointer to either a person or university record. [19] Pointers could also be declared to point to ANY!CLASS
. [20] Accessing the data in a record was similarly idiosyncratic; to print the name file of a person, for instance, the syntax was PRINT(person:name[rp]);
. [20]
In addition to basic string functionality, SAIL included a string scanner system as part of the basic language. SCAN
worked on string variables, while the otherwise similar INPUT
was used to scan strings being read from a file. Both used a system known as a "break table" which consisted of a set of characters that represented places to stop reading, examples include linefeeds, various whitespace, and punctuation. These tables were stored in special structures, and the system allowed only 54 of these, a number that is not explained in the documentation. [21]
To build a new table, one first called GETBREAK
which returned the next free slot in the table, or "table number". This would be followed by a SETBREAK
, which took the table number, a string with the break characters, another string of "omit characters" which were simply ignored during reading (as if they were not in the string) and finally the "modes", flags that indicated how the system should work. Once set, the program could then repeatedly call SCAN
or INPUT
and be returned complete strings. [22] This included a reference parameter, normally brkchar, that contained the character that caused the break, allowing one to test, for instance, for end-of-file characters. The system is conceptually similar to C's strtok
functionality, which is part of stdlib [23] as opposed to being part of the language itself as in SAIL.
SAIL's input/output system was based on the idea of numbered "channels" in a fashion somewhat similar to the scanner entries. To open a file, one first called GETCHAN
to return a value of a free channel, and then OPEN
ed it with various parameters to describe the file and modes of operation. RELEASE
was equivalent to close. Once opened, the file could be read, subject to the scanning rules noted above, by calling INPUT
and looking for the end-of-file. Files did not have names as part of the OPEN, instead, LOOKUP
could be used to point a channel at a given file, ENTER
made a new file associated with a channel, and RENAME
allowed an existing file name to be changed. [24] One can open an existing file for writing using GETCHAN... OPEN... LOOKUP... ENTER
. [25]
There were numerous special handlers and variables that were used during I/O. For instance, the INCHWL
function was an INPUT hard-wired to the user terminal and always open, and it returns its break character in the system variable !SKIP!
. [26] The PRINT
function normally output to the same terminal channel, but could also be directed at any other opened channel. [27]
As a systems programming language, performance was important and to help with this, SAIL included a DEFINE
which used string-replacement in a fashion similar to C's #define
macros. [28] A difference was that the delimiters around the substitution had to be defined, for instance REQUIRE "[][]" DELIMITERS;DEFINE maxSize=[100];
. One common use of these macros was to define character constants like CRLF
, as these were not part of the basic language. [28] Another was to redefine the COMMENT
statement to the shorter !
. [29]
The system also included a conditional compilation system using statements, as opposed to pre-processor directives as found in C. IFCR
would compile the blocks between the corresponding THENC
and ELSEC
or ENDC
. The condition in the IFCR must be known at compile time, so, like C, was normally a DEFINE
d value. [30]
The main difference between SAIL and other ALGOL-derived languages was its inclusion of the associative store from the LEAP language. This system provided a system that allowed data to be placed in record-like structures and then saved, retrieved and searched. In this respect it was similar to the data handling features in COBOL. The basis for the store was the association or triple, which allowed a data value to be associated with a named slot in a record. For instance, one might make a record of the type Family_Member
with Name
"Tom" and set the Father
field to "Harry". This results in a triple of the form (Father, Tom, Harry). The associated libraries could then find all the Family_Member
s with "Harry" as the Father
, perhaps returning "Tom" and "Alice". [31]
The following code, found in the Tutorial, converts an input string to upper case. [10]
STRINGPROCEDUREupper(STRINGrawstring);BEGIN"upper"STRINGtmp;INTEGERchar;tmp←NULL;WHILELENGTH(rawstring)DOBEGINchar←LOP(rawstring);COMMENTLOPreturnsthefirstcharacterandmovesthepointerpastittmp←tmp&(IF"a"LEQcharLEQ"z"THENchar-'40 ELSE char); END; RETURN(tmp); END "upper";
A number of interesting software systems were coded in SAIL, including some early versions of FTP and TeX, a document formatting system called PUB, [32] and BRIGHT, a clinical database project sponsored by the National Institutes of Health. [33] [34] [35] [36] [37] [38] [39] [40] [41]
In 1978, there were half a dozen different operating systems for the PDP-10: ITS (MIT), WAITS (Stanford), TOPS-10 (DEC), CMU TOPS-10 (Carnegie Mellon), TENEX (BBN), Tymcom-X (Tymshare), and TOPS-20 (DEC, based on TENEX).
SAIL was ported from WAITS to ITS so that MIT researchers could make use of software developed at Stanford University. Every port usually required the rewriting of I/O code in each application.
A machine-independent version of SAIL called MAINSAIL was developed in the late 1970s and was used to develop many eCAD design tools during the 1980s. MAINSAIL was easily portable to new processors and operating systems, and was still in limited use as of 2005 [update] .
ALGOL is a family of imperative computer programming languages originally developed in 1958. ALGOL heavily influenced many other languages and was the standard method for algorithm description used by the Association for Computing Machinery (ACM) in textbooks and academic sources for more than thirty years.
C is a general-purpose computer programming language. It was created in the 1970s by Dennis Ritchie, and remains very widely used and influential. By design, C's features cleanly reflect the capabilities of the targeted CPUs. It has found lasting use in operating systems, device drivers, and protocol stacks, but its use in application software has been decreasing. C is commonly used on computer architectures that range from the largest supercomputers to the smallest microcontrollers and embedded systems.
Icon is a very high-level programming language based on the concept of "goal-directed execution" in which code returns a "success" along with valid values, or a "failure", indicating that there is no valid data to return. The success and failure of a given block of code is used to direct further processing, whereas conventional languages would typically use boolean logic written by the programmer to achieve the same ends. Because the logic for basic control structures is often implicit in Icon, common tasks can be completed with less explicit code.
Pascal is an imperative and procedural programming language, designed by Niklaus Wirth as a small, efficient language intended to encourage good programming practices using structured programming and data structuring. It is named after French mathematician, philosopher and physicist Blaise Pascal.
BASIC09 is a structured BASIC programming language dialect developed by Microware on behalf of Motorola for the then-new Motorola 6809 CPU and released in February 1980. It is primarily used with the OS-9 operating system, released in 1979. Microware also released a version for OS-9/68k on the 68000 as Microware BASIC.
Hungarian notation is an identifier naming convention in computer programming in which the name of a variable or function indicates its intention or kind, or in some dialects, its type. The original Hungarian notation uses only intention or kind in its naming convention and is sometimes called Apps Hungarian as it became popular in the Microsoft Apps division in the development of Microsoft Office applications. When the Microsoft Windows division adopted the naming convention, they based it on the actual data type, and this convention became widely spread through the Windows API; this is sometimes called Systems Hungarian notation.
In computer science and computer programming, a data type is a collection or grouping of data values, usually specified by a set of possible values, a set of allowed operations on these values, and/or a representation of these values as machine types. A data type specification in a program constrains the possible values that an expression, such as a variable or a function call, might take. On literal data, it tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support basic data types of integer numbers, floating-point numbers, characters and Booleans.
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.
In computer science, a union is a value that may have any of several representations or formats within the same position in memory; that consists of a variable that may hold such a data structure. Some programming languages support special data types, called union types, to describe such values and variables. In other words, a union type definition will specify which of a number of permitted primitive types may be stored in its instances, e.g., "float or long integer". In contrast with a record, which could be defined to contain both a float and an integer; in a union, there is only one value at any given time.
In computer science, a record is a basic data structure. Records in a database or spreadsheet are usually called "rows".
Dartmouth BASIC is the original version of the BASIC programming language. It was designed by two professors at Dartmouth College, John G. Kemeny and Thomas E. Kurtz. With the underlying Dartmouth Time Sharing System (DTSS), it offered an interactive programming environment to all undergraduates as well as the larger university community.
In computer science, type conversion, type casting, type coercion, and type juggling are different ways of changing an expression from one data type to another. An example would be the conversion of an integer value into a floating point value or its textual representation as a string, and vice versa. Type conversions can take advantage of certain features of type hierarchies or data representations. Two important aspects of a type conversion are whether it happens implicitly (automatically) or explicitly, and whether the underlying data representation is converted from one representation into another, or a given representation is merely reinterpreted as the representation of another data type. In general, both primitive and compound data types can be converted.
ALGOL 68 is an imperative programming language that was conceived as a successor to the ALGOL 60 programming language, designed with the goal of a much wider scope of application and more rigorously defined syntax and semantics.
The computer programming languages C and Pascal have similar times of origin, influences, and purposes. Both were used to design their own compilers early in their lifetimes. The original Pascal definition appeared in 1969 and a first compiler in 1970. The first version of C appeared in 1972.
S-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.
Systems Programming Language, often shortened to SPL but sometimes known as SPL/3000, was a procedurally-oriented programming language written by Hewlett-Packard for the HP 3000 minicomputer line and first introduced in 1972. SPL was used to write the HP 3000's primary operating system, Multi-Programming Executive (MPE). Similar languages on other platforms were generically referred to as system programming languages, confusing matters.
In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed.
A BASIC interpreter is an interpreter that enables users to enter and run programs in the BASIC language and was, for the first part of the microcomputer era, the default application that computers would launch. Users were expected to use the BASIC interpreter to type in programs or to load programs from storage.
Wang BASIC is a series of BASIC programming languages for computers from Wang Laboratories. The term can be used to refer to the BASIC on any Wang machine, but is mostly associated with the versions on the Wang 2200 minicomputer series of the early 1970s. When these machines were updated to the VP series in 1976, BASIC-2 was introduced and remained the pattern for future machines in the 2200 series. A planned BASIC-3 was never released.
Acorn System BASIC and Atom BASIC are two closely related dialects of the BASIC programming language developed by Acorn Computers for their early microcomputers like the Acorn System 3 and Acorn Atom. Developed in-house, they have a number of significant idiosyncrasies compared to most BASIC dialects of the home computer era.
The underscore operator in SAIL source-code assignments printed as a left arrow in the Stanford variant of ASCII, but PDP-10 sites elsewhere just saw it as a plain underscore. However, its use as the assignment operator meant that it could not be used as an extended letter to make compound names more readable, as is now common in many other programming languages. The left arrow in the Stanford variant of ASCII was not the only unusual character.