SAIL (programming language): Difference between revisions

Content deleted Content added
Line 37:
 
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}}
 
===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}}
 
==Example==