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:

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

Personal Editor 3

This is a rewrite of the old IBM Personal Editor 2 which came out with PC1. The link will take you to the downloads for Windows and Linux executables and source code for 64 bit Intel machines.

pe3 filetoedit.txt

N-QUEENS

This program produces computes the solutions to the N-queens problem: how to place N queens on an N by N chess checkerboard without any queen attacking another. This program may be the most compact solution in any programming language.

snobol5 nq.sno -6 listing

WORDLE

This program is a SNOBOL5 implementation of the popular WORDLE game.

snobol5 wordle.sno

SUDOKU

This program solves sudoku puzzles. Edit the source to add you puzzle to solve after the END statement.

snobol5 sudoku.sno -6 listing

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