Content deleted Content added
Line 45:
===Compiler directives===
As a systems programming language, performance was important and to help with this, SAIL included a {{code|DEFINE}} which used string-replacement in a fashion similar to C's {{code|#define}} macros.{{sfn|Smith|1976|p=25}} A difference was that the delimiters around the substitution had to be defined, for instance {{code|REQUIRE "[][]" DELIMITERS;DEFINE maxSize{{=}}[100];}}. One common use of these macros was to define character constants like {{code|CRLF}}, as these were not part of the basic language.{{sfn|Smith|1976|p=25}} Another was to redefine the {{code|COMMENT}} statement to the shorter {{code|!}}.{{sfn|Smith|1976|p=26}}
===String scanner===
In addition to basic string functionality, SAIL included a string scanner system as part of the basic language. {{code|SCAN}} worked on string variables, while the otherwise similar {{code|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.{{sfn|Smith|1976|p=27}}
To build a new table, one first called {{code|GETBREAK}} which returned the next free slot in the table, or "table number". This would be followed by a {{code|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 {{code|SCAN}} or {{code|INPUT}} and be returned complete strings.{{sfn|Smith|1976|p=28}} 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 {{code|strtok}} functionality, which is part of [[stdlib]]<ref>{{cite web |url=https://www.geeksforgeeks.org/strtok-strtok_r-functions-c-examples/ |title=strtok() and strtok_r() functions in C with examples}}</ref> as opposed to being part of the language itself as in SAIL.
==Example==
|