6 ms·
Completing a BASIC language interpreter in 2025
- Razengan 11mo agoAh the Aquarius :) My uncle got one as a donation to his private little "museum" and all I remember was how different it looked from the other machines of that era and a game that taught you spelling by shooting down letters Space Invaders style.
- le-mark 11mo agoThis is a very impressive project a really informative post, thanks to the author! There used to be a lot of content like this on the internet, I miss those days.
- moron4hire 11mo agoBack in 2014, I stumbled on the original source code for the first version of Oregon Trail, which was written in a suspect of BASIC for a timeshare system used by the public schools in Minnesota (probably not the version you're thinking of https://en.wikipedia.org/wiki/The_Oregon_Trail_(1971_video_game) https://en.wikipedia.org/wiki/The_Oregon_Trail_(1971_video_g...). I was really into VR at the time and had been working on live-programmable VR environments, primarily through a text editor component that could render to a 3D object texture. As a demo of the component, I wrote a good-enough BASIC interpreter to ruin the Oregon Trail code. Writing the interpreter was actually a lot of fun and not that hard, considering I already had a lot of code for processing code syntax for the syntax highlighting feature of the code editor. Sadly, Web standards have changed a bit too much, I couldn't get traction on my project after Mozilla's AFrame released, so now it's some broken code sitting in a GitHub repo somewhere.
- zahlman 11mo ago> a suspect of BASIC subset?
- moron4hire 11mo agoDialect. Didn't notice the auto-incorrect.
- kragen 11mo agoVery impressive, as usual! I've never written a 100-page assembly program in my life, much less in one month. The string stack part reminded me of http://turboforth.net/downloads/docs/ANS_String_Lib.pdf http://turboforth.net/downloads/docs/ANS_String_Lib.pdf, with the same motivation of handling string expressions in limited memory without needing a GC.
- WalterBright 11mo ago> a new BASIC interpreter for the 1983 Mattel ECS add-on for Intellivision Fun fact: Hal Finney (yes, that Hal) wrote a BASIC interpreter for the Intellivision back in 1978 or so in a weekend. It was 2K of code. Mattel shipped it on a cartridge. ROM space was so tight, the only error message it produced was: EH? Which Hal was very proud of. He showed it to me to make me laugh. At the time I was programming the Mattel Intellivision Roulette cartridge.
- jacquesm 11mo agoThat's hilarious. I wonder how many corners he cut on that. Is there a disassembly floating around somewhere?
- WalterBright 11mo agoIt was written in assembly. I don't know that any listings were kept. It never occurred to me to save any of mine. Oh well.
- jacquesm 11mo agoLikewise, I've lost all of my code from the 8 bit era, no big deal, really, but it would have been fun to read some of it. One of the more interesting projects was to make an annotated listing of the 6809 version of MS Basic for the Dragon 32. We learned so much just by studying that code. It was only 16K and yet we spent months on that. And for stuff we wrote ourselves, a real-time 3D renderer for simple 3D models in 6502 assembly was probably the pinnacle.
- WalterBright 11mo agoI was fortunate to have learned to code in an environment where a lot of excellent programmers were kind enough to help me out. For example, my roommate showed me how stacks worked. It was like magic!
- 11mo ago
- pjmlp 11mo agoVery interesting, this is kind of cool.
- nobody_special 11mo agoI wrote a BASIC interpreter that supported integers and strings circa 1979. Written in assembly, it used a simple precedence parser. I measured its CPU utilization under cpu-intensive loads: ~9.5% for lexical/token analysis, ~20% for the parser, and ~69.5% for semantic work. It was a lot of fun. The assembler I used was really powerful; I used its macro facilities to create ‘rule’ macros that defined the BNF of the language. Congrats on your own implementation!