SAIL (programming language): Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Alter: pages. Formatted dashes. | Use this bot. Report bugs. | #UCB_CommandLine
 
(7 intermediate revisions by 4 users not shown)
Line 37:
The [[GOGOL (programming language)|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.{{sfn|Slimick|1971|p=22}}
 
Swinehart, joined by Robert Sproull, merged the GOGOL syntax with additions from the contemporary versions of the [[LEAP (programming language)|LEAP language]] 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.{{sfn|Reiser|1976|p=iii}}
 
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 (operating system)|TENEX]]. It was later ported to DEC's [[TOPS-10]] as well, while the original TENEX version worked without modification under [[TOPS-20]].{{sfn|Reiser|1976|p=iii}}
Line 61:
 
===Procedure declarations===
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, {{code|STRING PROCEDURE toUpper(STRING originalStr);BEGIN...|pascal}}. Note the uncommon use of the semicolon here, whereas Pascal would immediately follow with a block, typically a {{code|BEGIN}}.{{sfn|Smith|1976|p=21}}
 
In order to improve performance, SAIL added two procedure qualifiers, {{code|SIMPLE}} and {{code|RECURSIVE}}. {{code|RECURSIVE}} told the compiler that the procedure might call itself, and thus its [[local variable]]s had to be written to the stack, not just the subroutine return information. {{code|SIMPLE}} did the opposite, demanding the procedure have no local variables at all, not allowing {{code|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.{{sfn|Smith|1976|p=22}} This also had the side-effect of meaning that variables declared within a procedure that was not marked {{code|RECURSIVE}} would not be reset between calls,{{sfn|Smith|1976|p=22}} acting similar to C's {{code|static}}.
 
SAIL also included the {{code|FORWARD}} qualifier, used to insert [[forward declaration]]s, typically when two procedures call each other.{{sfn|Smith|1976|p=21}} {{code|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.{{sfn|Smith|1976|p=23}} Parameters passed to the procedures could be by {{code|VALUE}} or {{code|REFERENCE}}, the later allowing values to be passed back.{{sfn|Smith|1976|p=24}}
 
===Basic data types and operators===
The basic variable types in SAIL are [[Integer (computer science)|integers]], [[Floating-point arithmetic|reals]] (floating point), [[Boolean data type|booleans]], and [[String (computer science)|strings]].{{sfn|Smith|1976|p=2}} Type conversions were automatic, so {{code|INTEGER i;i←SQRT(5);|pascal}} would convert the value 5 to a double as that is what SQRT requires, and then cast the result to an integer.{{sfn|Smith|1976|p=13}} Any of these types can be turned into an array by adding the {{code|ARRAY}} qualifier and placing the array bounds in brackets, for instance, {{code|REAL ARRAY weeks[1:52]);|pascal}}. SAIL supported 1-d and 2-d arrays.{{sfn|Smith|1976|p=4}}
 
The language used the left-arrow for assignment, {{code|←}}, or the underscore on platforms that did not have [[Stanford ASCII]].{{sfn|Smith|1976|p=5}} 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.{{sfn|Smith|1976|p=6}}
Line 75:
 
===Records and pointers===
The concept of [[Record (computer science)|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 {{code|RECORD!CLASS}} statement: {{code|RECORD!CLASS person (STRING name, address; INTEGER accountnum; REAL balance)|pascal}}. This statement worked in a fashion similar to the {{code|RECORD}} statement in Pascal, defining the template for the record. To create a record, one used the {{code|NEW!RECORD}} statement, which returned a {{code|RECORD!POINTER}}. Pointers were typed, and could be typed to more than one type, for instance, {{code|RECORD POINTER (person,university) rp;|pascal}} defines rp, a pointer to either a person or university record.{{sfn|Smith|1976|p=40}} Pointers could also be declared to point to {{code|ANY!CLASS}}.{{sfn|Smith|1976|p=41}} Accessing the data in a record was similarly idiosyncratic; to print the name file of a person, for instance, the syntax was {{code|PRINT(person:name[rp]);}}.{{sfn|Smith|1976|p=41}}
 
===String scanner===
Line 98:
The following code, found in the Tutorial, converts an input string to upper case.{{sfn|Smith|1976|p=21}}
 
<syntaxhighlight lang=Pascal"text">
STRING PROCEDURE upper(STRING rawstring);
BEGIN "upper"
Line 114:
 
==Uses==
A number of interesting software systems were coded in SAIL, including some early versions of [[File Transfer Protocol|FTP]] and [[TeX]], a document formatting system called PUB,<ref>{{cite web |archive-url=https://web.archive.org/web/20050205011125/http://www.nomodes.com/pub_manual.html |archive-date=5 February 2005|url=http://www.nomodes.com/pub_manual.html|title=PUB Manual|website=Nomodes.com|accessdate=30 December 2017}}</ref> and BRIGHT, a clinical database project sponsored by the [[National Institutes of Health]].<ref>{{cite journal|pmc=2578281 | pages=701–704 | journal=Proc Annu Symp Comput Appl Med Care | title=Development of a Friendly, Self-Teaching, Interactive Statistical Package for Analysis of Clinical Research Data: The BRIGHT STAT-PACK| year=1983 | last1=Rodbard | first1=D. | last2=Cole | first2=B. R. | last3=Munson | first3=P. J. | volume=8 | issue=3 | doi=10.1007/BF02224505 | pmid=6384409 }}</ref><ref>{{cite book|url=https://books.google.com/books?id=Aq2jBQAAQBAJ&q=BRIGHT+Decsystem10+nih&pg=PA479|title=NIH: An Account of Research in Its Laboratories and Clinics|first=DeWitt|last=Stetten|date=10 May 2014|publisher=Academic Press|isbn=9781483277554|via=Google Books}}</ref><ref>{{cite web|url=https://profiles.nlm.nih.gov/ps/access/BBGHLW.ocr|archive-url=https://web.archive.org/web/20160816181522/https://profiles.nlm.nih.gov/ps/access/BBGHLW.ocr|url-status=dead|archive-date=August 16, 2016|title=STANFORD UNIVERSITY MEDICAL EXPERIMENTAL COMPUTER RESOURCE : RR - 00785 : ANNUAL REPORT - YEAR 05|website=Profiles.nlm.nih.gov|accessdate=30 December 2017}}</ref><ref>{{cite web|url=https://archive.org/details/annualreportnati19851nati|title=Annual report : National Institutes of Health. Division of Computer Research and Technology|publisher=Bethesda, Md|website=Archive.org|accessdate=30 December 2017}}</ref><ref>{{cite web|url=http://www.ebooksread.com/authors-eng/national-institutes-of-health-us-division-of/annual-report--national-institutes-of-health-division-of-computer-research-and-ita-549/page-4-annual-report--national-institutes-of-health-division-of-computer-research-and-ita-549.shtml|title=Read the eBook Annual report : National Institutes of Health. Division of Computer Research and Technology (Volume 1981-83) by National Institutes of Health (U.S.). Division of online for free (page 4 of 56)|first=Denis Larionov & Alexander|last=Zhulin|website=Ebooksread.com|accessdate=30 December 2017}}</ref><ref>{{cite web|url=https://profiles.nlm.nih.gov/BB/G/H/M/D/_/bbghmd.ocr|archive-url=https://web.archive.org/web/20081012100739/http://profiles.nlm.nih.gov/BB/G/H/M/D/_/bbghmd.ocr|url-status=dead|archive-date=October 12, 2008|title=PUFF/VM PROJECT : Section 4.1.6|website=Profiles.nlm.nih.gov|accessdate=30 December 2017}}</ref><ref>{{cite web|url=https://profiles.nlm.nih.gov/ps/access/BBGHJD.ocr|archive-url=https://web.archive.org/web/20160816164301/https://profiles.nlm.nih.gov/ps/access/BBGHJD.ocr|url-status=dead|archive-date=August 16, 2016|title=Section 9.2.6 : PUFF/WI Project|website=Profiles.nlm.nih.gov|accessdate=30 December 2017}}</ref><ref>{{cite web|url=https://profiles.nlm.nih.gov/ps/access/BBGHMS.ocr|archive-url=https://web.archive.org/web/20160816150857/https://profiles.nlm.nih.gov/ps/access/BBGHMS.ocr|url-status=dead|archive-date=August 16, 2016|title=Section 4.1.7 : PUFF/VM Project|website=Profiles.nlm.nih.gov|accessdate=30 December 2017}}</ref><ref>{{cite web|url=https://profiles.nlm.nih.gov/BB/G/H/L/W/_/bbghlw.pdf|archive-url=https://web.archive.org/web/20041105163923/http://profiles.nlm.nih.gov/BB/G/H/L/W/_/bbghlw.pdf|url-status=dead|archive-date=November 5, 2004|title=STANFORD UNIVERSITY MEDICAL EXPERIMENTAL COMPUTER RESOURCE : RR - 00785 : ANNUAL REPORT -YEAR 05 |website=Profiles.nlm.nih.gov|accessdate=30 December 2017}}</ref>
 
In 1978, there were half a dozen different operating systems for the PDP-10: [[Incompatible Timesharing System|ITS]] (MIT), [[WAITS]] (Stanford), [[TOPS-10]] (DEC), [[CMU TOPS-10]] (Carnegie Mellon), [[TENEX (operating system)|TENEX]] ([[Bolt, Beranek and Newman|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.<ref name="foldoc">{{foldoc|Stanford+Artificial+Intelligence+Language}}</ref>
 
{{anchor|MAINSAIL}}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|lc=on}}.