Home Creators Posts Import Register Favorites Logout

Content

Let me take you back to high school; back when Nirvana was obsoleting Guns 'n' Roses, back when OJ Simpson was that football player in the Naked Gun movies, and back when I was in love with QuickBASIC.

Having outgrown QBasic, I harassed my friend Steven Francesconi until he pirated me a copy of QuickBASIC 4.5 against his will (sorry, Steven!). I wanted to mod VBBS, a BBS written in BASIC that was totally amazeballs back in the day.

I would have long debates with my friends about how BASIC was better than C (case insensitive variables mean you never access the wrong one by a typo! Humans think about the first item in a list as #1, not #0!  I was young, everyone) and write pages and pages of code--probably nothing useful--on loose leaf in the back of class. I spent time modding VBBS and writing fun little ASCII art trinkets and things that don't even make sense to modern humans, like BBS tagline selector programs.

I wrote _so much_ code in QuickBASIC in 1993, not even knowing that Microsoft had abandoned the product a full five years earlier. They were working on this little thing called "Visual Basic" now.

I spent some time revisiting 16-year-old Ryan this month.

MojoBASIC started out as a little toy language I was building to learn about LLVM (more on this in a later post, hopefully!), and then an idea took over my brain and I put away the original project to spend a week trying to parse QuickBASIC syntax. I ended up wandering away because I was missing deadlines by focusing on these sort of projects--as I do--but I thought I might revisit it now and see how far I can run with it.

At the moment, it parses (most of) QuickBASIC's syntax into an Abstract Syntax Tree, and walks that tree to print out basically the same BASIC program. There's a ton of LLVM integration code that's #if 0'd out that was inherited from the other project, which I'll be reenabling soon. Once that's in place, you'll be able to dump out LLVM bitcode trivially, meaning you can do fun things like:

- Compile a BASIC program into a native executable on Linux, Mac, Windows, and other platforms LLVM supports.

- Write a subroutine in BASIC and call it from your Clang-compiled C code.

- Run BASIC code on the web with Emscripten.

- Use BASIC as a scripting language embedded in a game, with LLVM's JIT functionality.

- Install apps written in BASIC on an iPhone.

I'm not saying we'll get there, or we even _should_ get there. A more practical goal is that we can compile GORILLA.BAS, high-five about this and then never speak of it again. Sometimes you just have to build something so you can stop thinking about building something.

Maybe we get it to the point where it can handle all those pre-.NET Visual Basic programs that are being lost to time. Did you know Visual Basic 6.0 won't even _install_ on Windows 10 without a massive fight?

The source code to MojoBASIC is here.

Comments

Kaz Redclaw

I think I've seen other QBasic knockoffs around the web before, I can't remember the name of it, but I downloaded it to help a customer who had an ancient QBasic script for calculating the API of oil in a blending process. I too used QBasic for awhile back when I was 12-14 or so, before moving to Turbo Pascal and doing most of my BBS utility development there. I actually had a Fidonet point package written entirely in Turbo Pascal 6.0. It could dial into a fidonet BBS, download echomail and netmail, store it to a local JAM message database, and then let you read through and reply to echomail and netmail there. Unfortunately I lost the later versions of that source code, and only have the barely functional 0.01 version. I never did write my own BBS software, but I've recently messed around with Synchronet, which seems to be about the only BBS software that's even mildly maintained.

Kaz Redclaw

Oh, and I really do know about VB6's arguments with modern versions of windows. Actually, the last one that it will reliably work on is Windows XP... That was another fight with that same customer, I wanted to move them to an Ignition based system with a modern database, but they wanted to stay with their VB6 and Access JET database.

Seth McClain

Thanks for sharing a bit of your 16-year-old self with us. I'm glad to be helping support you in these endeavors! Thanks for helping support us and the linux community :)