Basic forever

Batch Basic 2

The Basic programming language is alive and well in 2022, but putting a novel spin on it can be difficult.

Batch Basic 2 is a structured dialect with no line numbers and a few quirks. It's not very useful by itself, and mainly intended to be embedded, or used as a basis for extension / customization. It supports both interactive use and running programs written in advance, and in fact doesn't make any difference between modes of operation internally.

A different language of the same name was intially prototyped, but didn't go anywhere and had to be completely rethought.


As of February 2023, Batch Basic is available as source, and binaries for Linux PCs:

Instructions for building on other platforms are included; it only requires a modern C++ compiler and standard libraries. See the project news for what's different in the latest version.

Batch Basic is free and open source under the Artistic License 2.0; see inside the archive for how to contact the author.

First look

For end users, Batch Basic looks like this:

rem Ahl's Simple Benchmark

let r = 0
let s = 0

for n = 1 to 100
	let a = n
	do i = 1, 10
		let a = sqr(a)
		let r = r + rnd()

	do i = 1, 10
		let a = a ^ 2
		let r = r + rnd()

	let s = s + a
next n

print abs(1010 - s / 5)
print abs(1000 - r)

A few notes (see the language guide for more):

One unique quirk is that control structures of the same kind can't be nested. To help with that, there's an alternate FOR loop syntax. See the quick reference for more information.


Note: these results apply to version 2.3 beta, prior to the addition of arrays.

An informal comparison using the Creative Computing Benchmark suggests that:

Further attempts using the Rugg/Feldman benchmarks suggest that Batch Basic 2 is faster than Tcl for pure arithmetic, but slower when it comes to array access.

Keep in mind, these are quick, simple tests involving a simpler language.

To do