Batch Basic

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

Batch Basic 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.

Download

Both versions of Batch Basic were last updated in October 2025.

Batch Basic 3

A modernized version with string support; open source under the Boost License:

Batch Basic 2

A simpler version that supports older compilers; free and open source under the Artistic License 2.0:

Instructions for building on other platforms are included. Both versions only require a C++ compiler and standard libraries. Beware that version 3 requires C++17, versus C++11 for its predecessor.

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()
	done

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

	let s = s + a
next n

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

A few notes (see the included 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 included quick reference for more information.

Performance

An informal comparison using some classic benchmarks suggests that Batch Basic 2.7 is a little faster than Python 3.11, but a little slower than Tcl 8.6, especially when it comes to array access. In turn, Batch Basic 3.2 is a little bit slower than 2.7, but still within the same range.

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

Limitations

If you have a variable called "notice", Batch Basic parses it as "not ice". A sentiment we can all get behind, but rather misplaced here. Workarounds are possible, but a proper fix could be tricky.

Worse, Batch Basic implements a non-orthogonal language that simply can't express certain computations; in particular, the test / iftrue / iffalse statements can't simulate an if-then-else chain, at least not without extra subroutines. That makes writing the banal FizzBuzz program into a minor puzzle:

for i = 1 to 100
	let m$ = ""
	if i mod 3 = 0 then let m$ = m$ & "Fizz"
	if i mod 5 = 0 then let m$ = m$ & "Buzz"
	if m$ = "" then let m$ = str$(i)
	print m$
next

or in Batch Basic 2:

for i = 1 to 100
	let still = true
	if i mod 3 = 0 then let still = false: print "Fizz";
	if i mod 5 = 0 then let still = false: print "Buzz";
	if still then print i;
	print
next

That likely makes the language impractical for any serious programming.

To do

Other ideas: