Language characteristics
In common with many early implementations of BASIC, SOBS needed lines to have line numbers, both to allow a user to add new lines to the program in the desired place and also as targets forGOTO
and GOSUB
statements. A RENUMBER
facility was available to allow for sections of the code to be renumbered, by default in increments of 10, to allow more space in the middle of a program.
Other than line numbers, all numeric values were represented internally as floating point.
Statements
The language had relatively few statements by comparison with modern programming languages: Note in particular the lack of aWHILE
-like statement; FOR
was the only looping construct available to programmers.
Variables
£
) symbol.
Functions
A limited number of numeric functions were provided, all of which took one numeric parameter: Support for strings was more limited, with only one function,LEN
, which returned the length of the string parameter. Sub-strings were supported with square brackets, so A£ ,3/code> referred to the sub-string of the string A£
from the 2nd character to the 3rd character inclusive, so
10 LET A£ = "FOO"
20 PRINT A£ ,3
would print OO
This syntax was also supported on the left-hand side of an assignment, so
10 LET A£ = "FOO"
20 LET A£ ,2= "BAR"
30 PRINT A£
would print FBARO
Arrays
Support for handling arrays of data was relatively strong, with MAT
statements able to read an entire array from DATA
statements, and perform useful matrix
Matrix most commonly refers to:
* ''The Matrix'' (franchise), an American media franchise
** ''The Matrix'', a 1999 science-fiction action film
** "The Matrix", a fictional setting, a virtual reality environment, within ''The Matrix'' (franchis ...
operations such as matrix addition, matrix subtraction, matrix multiplication, and finding the inverse matrix for a square matrix
In mathematics, a square matrix is a matrix with the same number of rows and columns. An ''n''-by-''n'' matrix is known as a square matrix of order Any two square matrices of the same order can be added and multiplied.
Square matrices are often ...
.
Example:
10 DIM A(3,3)
20 MAT READ A
30 DATA 1,1,2,1,0,2,0,2,1
40 DIM B(3,3)
50 MAT READ B
60 DATA 0,0,1,0,1,0,1,0,0
70 DIM C(3,3),D(3,3)
80 MAT C=A*B
90 MAT D=INV(C)
100 MAT PRINT D,
The output would be
2 2 1
1 -1 0
4 -3 -2
Debugging
SOBS had primitive debugging capabilities, limited mostly to the TRACE
statement. TRACE ON
would cause the interpreter to print each line number as it was executed.
References
{{DEFAULTSORT:Southampton Basic System
BASIC interpreters
ICL programming languages
Science and technology in Hampshire
University of Southampton
BASIC programming language family