Softworks Basic is a new Basic compiler for the
ST. A complier translates an entire program into machine language
before executing it, whereas an interpreter such as ST BASIC
translates each command into machine language and then executes it
before going on to the next command. Routines with much repetition
such as lengthy FOR-NEXT loops can be speeded up considerably
through the use of a compiler, or they should be if the compiler is
well written.
The manual for Softworks Basic is mercifully
short, 80 pages of 6" by 6" paper written on both sides.
For quick reference it has a complete table of contents and is well
indexed. The compiler proves easy to use and comes complete on one
single-sided disk. Compilation is fast and consists of two steps,
compilation (generation of machine code) and linking to the runtime
module (coupling library functions, relocating the finished code
etc.). After the runtime module is linked, the program automatically
executes.
An editor is supplied with which most users will
be familiar, it is 1st Word, version 1.06! It is automatically
coupled to any program that ends with a BAS extension. When such a
program is selected from the desktop, 1st Word is loaded first and
then the selected program is read in. This feature only functions
properly if the desk accessories are not modified.
DIALECT
This particular version of Basic has a very
powerful set of commands. It includes a wide range of flexible
string manipulation commands and a surprisingly complete set of math
routines, although there are no matrix or complex math commands
(such as square root of -1). Softworks Basic also includes what are
called Mapped variables. These can be subsets of other variables,
such as would be found in name, address, social security number etc.
This allows relatively complicated data structures to be handled
either as a single entity or by their component parts. Additional
features permit calling machine language routines with the XCALL
command, chaining files together, and VDI/AES calls. VDI and AES
calls permit the graphics and sound capabilities of the ST to be
utilised, although some substantial effort must be expended to learn
the use of the functions. Output formatting is very flexible with
the PRINT USING statement and about 10 associated control
characters. Programs can be written with or
without line numbers. There is considerable file manipulation
capability, including treating the various ports on the ST as if
they were sequential files. Error trappping is provided so that
errors can be made to cause the program to branch to an error
message without crashing.
SPEED
Now for some of the bad news. Once again, we have
a compiler that is slow, slow, slow for math applications! It runs
such programs four times slower than the ST BASIC interpreter, which
I find just plain unacceptable (and incomprehensible!). The table
tells it all. The Philon Compiler is included for comparison.
Execution times in Minutes/seconds
Test |
A |
B |
C |
D |
E |
|
|
|
|
|
|
ST BASIC |
0:51 |
1:09 |
5:04 |
1:45 |
0:26 |
Softworks Basic |
3:56 |
0:24 |
0:69 |
0:37 |
0:09 |
Philon Basic |
1:39 |
2:04 |
2:25 |
0:36 |
0:05 |
A - 1 <
= I < = 10000,COS(I)^2
B - Generate 1000 random strings
C - Sort
1000 strings
D - Print
1000 sorted strings
E - Examine 1 - 2047 for prime numbers using sieve (one iteration)
The good news is that Softworks Basic handles string manipulations
very efficiently - between three and four times faster than ST BASIC
(the interpreter) and two to five times faster than the Philon
Fast/Basic-M compiler.
There also appears to be a lesson to be learned
from the Sieve of Eratosthenes (called the Sieve from here on). The
Sieve consists of nested FOR-NEXT loops, clever selection of start
and end points, step size and a lot of simple addition to examine a
list of consecutive numbers for prime numbers. These results suggest
that complicated functions are a lot harder to write efficient
compiler code for than simple ones. On the other hand, most
real-world math modelling requires more than just simple addition,
so perhaps the Sieve is not all that representative of what is
needed for a numerical benchmark.
DRAWBACKS
The following drawbacks were noted during the
review:
The instruction manual lacks adequate examples and
there is no discussion of the sample programs on the disk.
The runtime module does not allow machine
executable code to be saved to disk. Instead, the runtime module is
coupled to the object code and is automatically run every time
before the program is executed. If the desk accessories are changed,
the runtime module will not execute automatically, requiring a
separate command to load it, then specify the program to be linked.
This is time consuming and potentially confusing to a user of the
program.
There is no interpreter, making debugging very
difficult in a long program. It will compile only about 70 commands
from ST BASIC (out of 166); there is no provision for clearing the
screen, compiling basic graphics or compiling sound commands.
However, graphics and sound can be accessed from the VDI and AES
commands, but these require some considerable effort to master.
Games written in ST BASIC will need a lot of modification to
compile. There are only eleven digits of numerical precision,
instead of the more common 14-16 digits. Also, there is no true
integer capability. Everything is done in floating point, slowing
down programs that could be speeded up by integer declarations.
The order of execution of statements is
independent of the line numbers. So if you decide to add a line 45
and it follows line 50 in the file, it will be executed in that
order. A minor point perhaps, but irritating.
Error messages that occur during either compiling
or linking (runtime module execution) are flashed on to the screen
for only a fraction of a second and then the program defaults back
to TOS - not enough time to read the error message. At first this is
just an irritation but eventually it becomes a real problem. I found
myself compiling a program numerous times just to try to read the
error message printed by the compiler. There are compiler directives
that permit the generation of an error listing to disk, but for
simple programs, this is more trouble than it is worth. Finally, as
discussed above, the compiler results in very slow code for math
intensive applications. Speeding up math modelling programs is one
of the major motivations for buying a compiler.
CONCLUSIONS
Softworks Basic has the potential to be a very
excellent compiler - a comprehensive vocabulary, fast compilation
time and ease of use. The various drawbacks, however, make the
product in its present form poorly suited to many of the major
reasons for buying a compiler. There is still no GOOD Basic compiler
for the ST that I have seen - that is, one that is at least up to
the standards established by the IBM PC compiler.
This review first appeared in Current Notes,
122 N. Johnson Road, Sterling, VA 22170-9998, U.S.A. Softworks Basic
is priced £79 in this country and should be available from your
dealer via SDL or other distributors.
top