Language peer sets for S-Snobol: United Kingdom↑ United Kingdom/1978↑ Designed 1978 ↑ 1970s languages ↑ Fourth generation↑ High Cold War↑ String and List Processing ↑ String and List Processing/1978↑ String and List Processing/uk ↑
S-Snobol(ID:4041/ssn001)
Structured SNOBOL
alternate simple view
Country: United Kingdom
Designed 1978
Sammet category: String and List Processing for Structured Snobol 4
Ian Sommerville, Heriot-Watt University 1978
Used a RATFOR style preprocessing technique to create true SNOBOL 4 code but with structuresRelated languages
Example The example below is an S-SNOBOL function which right justifies lines of text by increasing the spacing between each word until the line is a given width. Blanks are added from the left. Notice the use of an explicit identifier (NULL) for the null string. This is not obligatory - we simply think programs look neater if it is included.
function RIGHTJUSTIFY(LINE,WIDTH) local NUMBLANKS, HEAD, GAP, TEMP, NULL, BLANKPATTERN BLANKPATTERN = BREAK(' ') . HEAD SPAN(' ') . GAP NUMBLANKS = WIDTH - SIZE(LINE) if GT(NUMBLANKS,0) then if LINE BLANKPATTERN = NULL then loop TLINE = TLINE HEAD GAP ' ' NUMBLANKS = NUMBLANKS - 1 , if EQ(NUMBLANKS,0) then RIGHTJUSTIFY = TLINE LINE exit end else if.fail LINE BLANKPATTERN = NULL then LINE = TLINE LINE TLINE = NULL LINE BLANKPATTERN = NULL end end end end end fend RIGHTJUSTIFY