SAIL (programming language): Difference between revisions

Content deleted Content added
Line 68:
 
===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);}} 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]);}}. 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}}
 
Strings were manipulated using [[array slicing]], with {{code|aStr[i TO j]}} returning the substring with characters from i to j, or {{code|aStr[i FOR j]}} which returned the substring starting at i and running for j characters.{{sfn|Smith|1976|p=12}} The {{code|INF}}(inity) 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}} There was no way to compare strings other than {{code|EQU}}, operators like {{code|<}} were defined only for numbers.{{sfn|Smith|1976|p=48}}
 
===Records and pointers===