An open source BASIC interpreter written in C whose history started back in 1982 — and a quite interesting one: it was written by a Texan grandmom, Verda Spell, and after her death the source files on a CP/M disk were found in her knitting bag by her grandson, Ted Campbell, a historian who transfered the code to a PC and published it in 1993.1)
It has been ported to DOS, Windows, Linux and some other platforms and operating systems. As you can read anywhere, it "implements a large superset of the ANSI Standard for Minimal BASIC (X3.60-1978) and a significant subset of the ANSI Standard for Full BASIC (X3.113-1987)".
This might have been true until version 2.20, but the most current version as of 2023, 3.20, seems to drive the somewhat dull, text-only bwBASIC to a niche purpose of emulating other BASIC dialects − including its own and the one of version 2.20! Here the emulated keywords are not considered, however, and version 2.20 is the baseline version of our keywords listing.
In spite of portability being one of its primary goals, bwBASIC is not much written about — probably because it is a plain "serious" BASIC with no commands for graphics and sound, just in tune with its CP/M roots. After version 2.20, it was removed from Debian, and as of February 2023 its maintainer, UNIX veteran Ken Martin, seemed undecided about whether to use Sourceforge or GitHub for version 3.20 updates, and on how to use such repositories. It seems that its only published UNIX man
page is the one for 2.20. It's fairly complete and as light to read as possible for a man page, but there is a lot more documentation available in its newest installable packages.
Where it is/was used
Operating systems: UNIX, GNU/Linux, MS-DOS, FreeDOS, Windows,
OS/2
2)
Noteworthy characteristics
Variable names are case-sensitive in bwBASIC (statements, functions and commands are not). Their names can not start with digits, but can be composed by letters, numbers, "."and "_".
Variables can be suffixed with # and !, like in Microsoft BASICs, but this will not have any special meaning about the precision of the variable. Multiple suffixes may be configured for more types than the traditional "Microsoft" ones. There is only one level of precision defined when bwBASIC is compiled from C, and by default it is the same precision of a C double in the platform.
Environment and usage
The command/statement
OPTION VERSION can be used to activate the many BASIC "dialects" supported by bwBASIC, inside double quotes, such as TRS-80, RBASIC, DARTMOUTH, ECMA-55, ECMA-116, MARK-I, SYSTEM/360, XBASIC, HEATH, PDP-8 and others. Its default dialect is BYWATER, and BYWATER-2 is supported as well.
Line numbers are required for typing a program into the interpreter's REPL, but lines and the REPL are not really required. A program may be written in an
ASCII text file without numbers and run from the command line with something like
bwbasic myprog.bas
. Also, bwBASIC can be compiled without the REPL interface.
From a console/terminal window, type the executable's filename (usually bwbasic
) and Enter. A default build of the interpreter will show the text-mode, line-driven REPL interface with a bwBASIC:
prompt.
To exit the REPL interface, type
quit
.
Quite standard here: to execute a program stored in memory, type
run
.
The REPL implements the commands
DO NUM and
UNNUM for, respectively, adding or removing line numbers of a program. They won't touch any reference to lines in
GOTOs,
GOSUBs etc though.
A built-in help system is available with the
help
command, followed by the keyword for which information is desired, such as in
help goto
3). Typing
help
alone lists all available keywords, too fast to be read.
The REPL's
LIST command has some auto-formatting features which includes, for example, indentation of commands within
FOR loops.
Up to some version before 2017's 3.20, commands from the underlying operating system's shell could be used as commands or even used in programs, and some BASIC keywords for file manipulation were also adapted to better integrate to the environment
4). However, something like typing
dir
or
ls
on bwBASIC 3.20 under FreeDOS or GNU/Linux caused an
ILLEGAL COMMAND AFTER LINE NUMBER: 1
error message. According to its maintainer, Ken Martin, "this is how 3.x works today"
5).
Extensions
Curiosities
Bywater BASIC has a fame of being slow, compared to other BASIC interpreters, and this is straightly admitted in its official documentation.
Influenced by
Influence for
Versions and successors
Bywater BASIC 3.20 - looks like a fork of version 2.20 aimed at emulating a LOT of classic BASICs
References