Sample Programs

INTERACT

This program can be used to try executing simple one liners, interactively in SNOBOL5. This is a great help when you are just learning SNOBOL5. Just use the following command:

snobol5 interact.sno Try entering the following two lines which will print out all of the substrings of 'HELLO THERE' (remember to type a blank in column one because they don't have any labels): &FULLSCAN = 1 'HELLO THERE' ARB $ OUTPUT FAIL :(END) The last line causes the INTERACT program to end. Typing "END" or "end" in the first column also ends the program. Another way to end the program is press the Ctrl-C keys to interrupt the program. Also, remember to enter the above lines in upper-case because SNOBOL5 names are case sensitive.

ELIZA

ELIZA in a program to be run interactively and permits one to be diagnosed by the famous computer psychiatrist. Just type the following command:

snobol5 eliza.sno

ENGLISH

This program recognizes English sentences which follow a simple grammar. Use the following command to run the program

snobol5 english.sno

SELFREPR

This is the shortest known self reproducing SNOBOL5 program. To run this program and put the reproduced copy in a disk file called "child.sno", use the command:

snobol5 selfrepr.sno -7 child.sno

XREF

This program produces a cross reference listing of a SNOBOL5 program to the degree that this is possible. The program is read from unit 1 and the listing is written to unit 6. It does not extract names from quoted strings however. To run the cross reference program against the ENGLISH.SNO program above and put the output in file "listing", use the command:

snoobl5 xref.sno -1 english.sno -6 listing

Prior Page, Next Page, First Page of the Oregon SNOBOL5 Reference