Six years have passed since I started building EndBASIC: a retro-looking BASIC interpreter that works on the web, on the desktop, and on embedded hardware—and that allows writing cross-platform apps that leverage graphics, a cloud file sharing system, and even access to local hardware via GPIO.
But as cool as this sounds, and as exciting as the journey has been, there is something that keeps bugging me about the future of the project: who wants to invest time building something new on an abandoned language? Even Visual Basic, a real platform that evolved over many years and gained “serious language features”, has fallen out of fashion and is, as far as I know, in “maintenance mode” by Microsoft.
So I’ve been thinking… “What if there was no BASIC in EndBASIC?” Or, in other words, how could I leverage the many pieces I’ve created underneath this project to build something that people actually want to use, be it for retro-style development or for other purposes?
In fact, the BASIC portion of the whole project—that is, the language parser and compiler—is the least interesting one. Yes, I’ve written a BASIC interpreter, but the amount of features my dialect provides today is… limited, and building those up is not the most exciting thing to do. For example: records and files are very much needed features, but adding them is not going to make the project much cooler or useful than it already is.
So: let’s look at the building blocks (BBs) behind EndBASIC so that we can imagine how these pieces could be recombined to form something different.
BB1: A pure compiler and VM
At the root of EndBASIC lives a “pure” language core with a relatively simple, non-optimizing (yet) compiler and accompanying VM that can be extended via native Rust bindings and that can be embedded into Rust programs. It’s trivial to leverage this core language to implement imperative DSLs or even dynamic configuration files.
What does “pure” mean here, though? Simply put that the core language, implemented as a separate crate with minimal dependencies, has absolutely no function nor command definitions in it. The programs executed by this VM can have no side-effects nor escape the VM by default: all they can do is compute values, maybe based on global variables injected by the host.
Consumers of this core crate, like EndBASIC’s standard library, are responsible for implementing all functions and commands that make the language useful—but these are all intentionally kept out of the core. Even fundamental primitives that you would expect a BASIC dialect to provide, like PRINT or INPUT , are not part of the core language. This poses some difficulties in the implementation of the compiler but they are an explicit design choice to keep the core lean.
BB2: A portable console framework
... continue reading