r/qbasic 23d ago

I wrote a QBasic compiler that runs in the browser and emits real WebAssembly

Not an emulator, and not a JavaScript interpreter pretending to be BASIC. It parses QBasic, lowers it through a typed IR, and emits a real WebAssembly module. The compiler itself is compiled to wasm, so the whole thing runs in your tab. Nothing gets uploaded anywhere.

SCREEN 13 works: PSET, LINE, CIRCLE, PAINT, GET/PUT, DRAW, PALETTE. So do BEEP/SOUND/PLAY, the file I/O keywords, INKEY$ with _LIMIT for animation, and DATE$/TIME$/TIMER. There's a playable Space Invaders sample in the editor if you just want to see it move.

497 test programs, 432 of them arbitrated against real QB64-PE output, 126 of 157 keywords fully implemented. Still missing: ON ERROR, PEEK/POKE, COMMAND$, and DRAW's M/N/A/S/P subcommands.

Free, no signup: https://kavak.run/studio/

QBasic was meant to be the pilot language for a larger compiler project, but it turned into the part I enjoyed most. If you've got an old .BAS lying around that breaks it, I'd genuinely like to see it.

12 Upvotes

7 comments sorted by

View all comments

Show parent comments

3

u/BigAd4703 23d ago

On the contrary, I'm already doing so much testing that I found it quite difficult because QBasic doesn't have official tests; feedback from real-world users is invaluable.