Previous Previous chapter · Next Next chapter · Contents Table of Contents

Chapter 2 : RUNNING A SNOBOL4 PROGRAM

2.1 BASIC COMMAND LINE FORMAT

The format for the command line is:
    SNOBOL4  file  options  ;Comments
Options are specified by a slash (/) or minus sign (-), and one or more option letters. When the option requires a file name, an equal sign may be used between the option letter and file name for readability. The source and input files may be assigned to any disk file or valid input device. The listing, output, and error message files may be assigned to any disk file or valid output device. If the output disk file does not exist, it will be created. In addition to the /I and /O options, the INPUT and OUTPUT variables may also be assigned to files by using the MS-DOS redirection operators < and > on the command line.

Other I/O files may be specified explicitly within the INPUT and OUTPUT functions, or on the command line with a unit number:

File names may be a disk file, or any DOS device, such as NUL:, CON:, LPT2:, etc.

The remaining option switches alter SNOBOL4's behavior:

Vanilla SNOBOL4 works very nicely with text editors that allow a program to be compiled from within the editor. If a compilation or runtime error occurs, you are returned to your editor with the cursor positioned on the troublesome statement. To use with your editor, you will need to use the command line option "/BE-". This writes errors messages to standard output, where they can be captured by your text editor.

2.2 PROVIDING YOUR OWN PARAMETERS

The keyword &PARM contains the command line string. It begins with the blank following the word SNOBOL4, and contains all characters up to the terminating carriage return. Since SNOBOL4's command processor ignores all characters after a semicolon, comments placed there can easily communicate additional instructions to your program. Break them out with the statement:
    &PARM ';' REM . INSTRUCTIONS

2.3 COMMAND LINE EXAMPLES

The command line:
    SNOBOL4 PROG
will compile and run a source program from file PROG.SNO, discard the listing, and run it with keyboard input and screen output. The command line:
    SNOBOL4 CONVERT /I=DATA /O=RESULT /2=STYLE.DAT ;DRAFT
will run a program that presumably transforms input file DATA.IN to output file RESULT.OUT according to program option 'DRAFT'. I/O unit number 2 is associated with the file STYLE.DAT. The program can use the variable SCREEN to post error and status messages to the user, regardless of the reassignment of the input and output files.
    SNOBOL4 SOURCE /I=SOURCE.SNO /L=OUTPUT /O=OUTPUT.LST /BCS
sets up a "conventional" batch job, with source program and input data on file SOURCE.SNO (following the END statement), listing and program output to OUTPUT.LST, no case-folding, and end-of-run statistics.
Previous Previous chapter · Next Next chapter · Contents Table of Contents