A new Windows native GwBasic Interpreter and Compiler

Hi,

I’m new to this forum so I reached out to Ed for advice on how best to write this posting. Thanks Ed!

Anyway a bit of my history. In 1970 I was fortunate enough to have hands-on access to a PDP-11 running timeshared basic, my first introduction to computers and programming. I hacked that system but that’s a different story for a different time :slight_smile: In late 1975 I bought an Altair 8800, fried it accidentally and built a second. I had a blast with the first basic that Gates and Allen created. For the next 50yrs I was both a developer and network engineer and retired two years ago. Like so many I have looked for GWBasic, and while there are various compilers and interpreters that run in vm’s there’s really nothing truly native that I was able to find hence my effort.

Also -

My oldest son is a developer and with the advent of AI I’ve been concerned about how it would impact him so I build my own AI system to learn about and play with local llms. This project was born from wanting to understand AI, it’s impact on him, and to reach back into my young adulthood and restore what was lost to me.

To the point. I’ve built a GWBasic interpreter from the ground up that natively supports Windows. No emulator/vm like DOSBOX needed. Gone are DOS specific instructs, they serve no purpose. In with many new instructions that support creating resizable windows of any size location and color. Resizable fonts that can be rotated, with color, bold, and italics supported. Basic mouse support as well as the ability to play .wav, .wma, and .mp3 files. I’ve also tossed in a few new commands like ledit, trace, token, etc.. The code is in python so if you want to play with it you’ll need to install python 3.11+. The .exe of the interpreter is available as well, no python needed for that.

I had planned to stop there but I didn’t, I’ve also created a new compiler that fully supports the new GWBasic. In fact to ensure complete compatibility the compiler actually uses the interpreters tokenizer. The compiler can create two types of output, a standalone .exe that has its own vm embedded so it needs nothing, but if you have visual studio installed with the Microsoft C compiler then the basic compiler will emit c code that is compiled into a final .exe. From a performance standpoint if the interpreter is 1x, then the vm form is around 5x while the true c compile form is between 100-500x.

One nice little add is that the compiler can run standalone but it can also run within the interpreter. For example I can type in a simple program and instead of ‘run’ I can enter ‘compile’, followed buy ‘crun’.

The full repo can be found on gitbub at retiredhuman/gwbasic. You’ll find a few compiled and uncompiled demos as well as gwibasic.py and gwibasic.exe for the interpreter, gwcbasic.py and gwcbasic.exe for the compiler. Please feel free to clone them, play with them, whatever, they come as is with no restrictions.

Lastly two things. I have a test suite of over 6,000 individual tests that cover every aspect of the language. I’ve also scanned it with Claude and both the interpreter and compiler are solid. Second, yes, my local llm coded both as well as the demoes and test suites. I of course spent the month directing the effort but I did not write a single line of code, Qwen3.6 27B did.

In closing I achieved both of my goals, I’ve helped to resurrect a long lost language to me that runs on modern machines but most importantly I have a much better understanding of how AI will not only affect my son’s career (we’re already discussing this regularly) but how it may affect society over time in general.

Cheers,
Wayne aka retiredhuman

P.S. For those who are interested my current system consists of an Intel 285k on an Asus Proart Z890 mobo, 144gb ram, 1600watt PS, a 5090, a 5080 and a 5070ti for 64gb vram. For llm’s I’m currently using Qwen3.8 27B and Qwen3.8 Flash Next. My agentic assistant is Hermes.

2 Likes