Has anyone ever written a BASIC for a 4-bit CPU?
On these small CPU, size of addressable RAM is even more important than word size. I think if you want to get a BASIC running on that 4-bit CPU in the article, the easiest is probably to create a 6502 or Z80 emulator, then run the emulator on the 4-bit CPU. After all, someone made an ARM (32 bit CPU) emulator for an 8 bit CPU and booted Linux on that.
I would look at Apple’s first Basic (https://en.wikipedia.org/wiki/Integer_BASIC) and trim away all but the bare essentials. Some possible simplifications:
- only support variable names of length one
- remove the exponentiation operator
- only support 8-bit integers
- only support line numbers between 0 and 255
If, then, there’s program space left, add in features.