bs(1)

bs(1)

NAME

bs - a compiler/interpreter for modest-sized programs

SYNOPSIS

bs [ ®le [ args ] ]

DESCRIPTION

bs is a remote descendant of BASIC and SNOBOL4 with some C language added. bs is designed for programming tasks where program development time is as important as the resulting speed of execution. Formalities of data declaration and ®le/process manipulation are minimized. Line-at-a-time debugging, the trace and dump statements, and useful run-time error messages all simplify program testing. Further- more, incomplete programs can be debugged; inner functions can be tested before outer functions have been written, and vice versa.

If ®le is speci®ed on the command-line, it is used for input before any input is taken from the keyboard. By default, statements read from ®le are compiled for later execution. Likewise, statements entered from the keyboard are normally executed immediately (see compile and execute below). Unless the ®nal operation is assignment, the result of an immediate expression statement is printed.

bs programs are made up of input lines. If the last character on a line is a \, the line is continued. bs accepts lines of the following form:

statement

label statement

A label is a name (see below) followed by a colon. A label and a variable can have the same name.

Abs statement is either an expression or a keyword followed by zero or more expressions. Some key- words (clear, compile, !, execute, include, ibase, obase, and run) are always executed as they are compiled.

Statement Syntax:

expression The expression is executed for its side effects (value, assignment, or function call). The details of expressions follow the description of statement types below.

break

break exits from the innermost for/while loop.

clear

Clears the symbol table and compiled statements. clear is executed immediately.

compile [expression]

 

Succeeding statements are compiled (overrides the immediate execution default). The

 

optional expression is evaluated and used as a ®le name for further input. A clear is

 

associated with this latter case. compile is executed immediately.

continue

continue transfers to the loop-continuation of the current for/while loop.

dump [name] The name and current value of every non-local variable is printed. Optionally, only the named variable is reported. After an error or interrupt, the number of the last statement is displayed. The user-function trace is displayed after an error or stop that occurred in a function.

edit

A call is made to the editor selected by the EDITOR environment variable if it is present,

 

or ed(1) if EDITOR is unde®ned or null. If the ®le argument is present on the command

 

line, ®le is passed to the editor as the ®le to edit (otherwise no ®le name is used). Upon

 

exiting the editor, a compile statement (and associated clear) is executed giving that

 

®le name as its argument.

exit [expression]

 

Return to system level. The expression is returned as process status.

execute

Change to immediate execution mode (an interrupt has a similar effect). This statement

b

HP-UX Release 11i: December 2000

− 1 −

Section 149