SAIL (programming language): Difference between revisions

Content deleted Content added
m Disambiguating links to TENEX (link changed to TENEX (operating system)) using DisamAssist.
Uses: working...
Line 9:
 
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}}
 
==Description==
Like many ALGOL systems, and the later [[Pascal (programming language)|Pascal]], the basic structure of SAIL is based on the ''block'', which is denoted by the code between the keywords {{code|BEGIN}} and {{code|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 {{code|BEGIN}}, like {{code|BEGIN "program"}}, and then end the block with {{code|END "program"}}. The compiler would use these, if entered, to check for proper bracketing.{{sfn|Smith|1976|p=13}}
 
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}} 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]);}}. SAIL supported 1-d and 2-d arrays.{{sfn|Smith|1976|p=4}} Type conversions were automatic, so {{code|INTEGER i;i←SQRT(5);}} would convert the value 5 to a double as that is what SQRT requires.{{sfn|Smith|1976|p=13}}
 
Standard statements included {{code|IF...THEN...ELSE}},{{sfn|Smith|1976|p=11}} {{code|FOR...STEP...UNTIL...DO}},{{sfn|Smith|1976|p=15}} {{code|WHILE...DO}} for top-tested loops, {{code|WHILE...UNTIL}} for bottom-tested, and {{code|GOTO}} which used a label.{{sfn|Smith|1976|p=17}} A curious statement was {{code|CASE}}, which took an integer value and then ran one of the following statements, like {{code|CASE i OF ("Zero","One","Two");}}, which returns the appropriate string based on the value of i.{{sfn|Smith|1976|p=11}}
 
The language used the left-arrow for assignment, 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}}
 
Strings were manipulated using [[array slicing]], with {{code|aStr[i TO j]}} returning the substring with characters from i to j, or {{code|i FOR j}} which returned the substring starting at i and running for j characters.{{sfn|Smith|1976|p=12}} The {{code|INF}} keyword represented the end of the string, so one could {{code|aStr[I TO INF]}} to return everything from i on.{{sfn|Smith|1976|p=13}} String functions and operators included {{code|EQU}} for testing if two strings were equal,{{sfn|Smith|1976|p=11}}, the ampersand for concatenation, {{code|LENGTH}} and {{code|LOP}} which removes the first character from the string.{{sfn|Smith|1976|p=12}}
 
==Uses==