SSB – a new way for SuperBASIC programming


SuperBASIC, as we all know, is one of the most powerful programming languages available for the QL: being extensible almost indefinitely, and with its ability to add commands and functions, SuperBASIC not only allows having a programming language always up to date with the current needs of a developer, but also offers an environment tailored to the single developer’s needs, without having to keep in memory countless libraries.
This offers multiple opportunities in language extensions and integration, but from another point of view we can see how SuperBASIC lacks in development environment.

SuperBASIC doesn’t offer an editor worth of the name. ED is good for little, tiny programs: producing a professional, high-performance software with this tool creates big problems both in developing and maintenance. ED allows working on a single file at a time, doesn’t have a clipboard facility nor a search function, and lacks other functions which are important to a developer. SuperBASIC has its problems too: it forces the programmer to use line numbers – thus making it impossible to use a normal text editor, unless the programmer writes all the line numbers by himself; another problem is that SuperBASIC doesn’t allow writing sentences on more than one line, making it really difficult to write complex IF-THEN constructs with more than two or three operands.

It’s impossible, other than this, to automatically insert parts of a program source or external routines into the source we’re working with: this because compilers don’t support the MERGE command. Even so, developers must pay close attention to line numbers, lest they lose entire lines of code.

The last problem comes as a surprise from Q_Liberator, the excellent compiler which almost all we know. In order to support the $$ directives, the compiler keeps every comment written into the compiled object file, thus creating a huge file without real reason – or otherwise forcing the poor developer to manually delete every comment, or even worse writing a source file totally undocumented (making it really hard to maintain it).

All of this contributes to consider SuperBASIC with a certain suspicion by those who try to write software of a certain quality.
A solution to these problems comes from the USA thanks to Tim Swenson, with his SSB package (currently at release 2.7.1). But what exactly is SSB?

SSB is a “language translator”: it is able to translate in SuperBASIC a source file written in the “Structured SuperBASIC” (SSB) format.
SSB is not a new language: it’s a different way to write SuperBASIC software, much more versatile and much less strict in following the rules. SSB will take care of translating the written source in a SuperBASIC source.

Let’s take a little overview in this different way of writing. For starters, SSB code can be written in a common ASCII plain text file, so an SSB source can be wrote or edited with any text editor. Other than that, line numbers are no more: SSB will take care of adding them while translating.
It is possible to insert empty lines (which will be deleted during translation) in order to make the program more human-readable.
The comments are inserted using the ## sequence, and SSB will remove them during SuperBASIC translation in order to make the source as light as possible.
If we use ** instead of ##, the comment will be kept (for example, to support the $$ directive).

As an example, let’s compare the following two sources. What follows is what we would write in SuperBASIC:

100 REMark +- Demo source 1 ————+
110 :
120 FOR CYCLE = 1 TO 10
150 :

this in SSB becomes:

## +- Demo source 1 ————+



SSB changes also the way one works: common routines can be written into separate files and merged to the main source file with the #incluse directive, so that if a routine changes it’s not necessary to rewrite that routine in all the sources: it’s just a matter of recompiling the code, because SSB will take the task of automatically update the routine itself.
It is possible to perform conditional compilations: some instruction blocks will be inserted into or excluded from the code by using a switch. This is of course an extremely useful option to automate the creation of demo versions of a program, enabling or disabling debugging features, or adding/excluding particular options avoiding to have many different copies of a source (all of them needing maintenance).
It is possible to separate lines using the “\” character, such that the source is more easily readable. For example, the SuperBASIC instruction


in SSB becomes:


Of course the “\” sequence doesn’t count as a directive if it’s contained into a string.

SSB supports also GOTO and GOSUB via an useful and really easy to understand labelling system.

This project is constantly updated, and upgrades can be found in our Internet site, in the “Warehouse” section.