Or, what I did over the Holiday break. I've historically spent lots of time investigating the low-level plumbing of FORTH, always intrigued by its implementation, porting it, rewriting NEXT, but never really using it. I borrowed much from the FORTH playbook when architecting PLASMA, so I took the past couple of weeks to implement FORTH in PLASMA to create a REPL environment. Programming in PLASMA is a more traditional edit/compile/run loop that can be a little slow on a 1 MHz 8 bit CPU.
The goals were pretty straightforward: interactivity and debugging were of paramount importance. Writing it in PLASMA itself may have initially been a questionable choice, but in the end it created a better programming environment than I could have imagined. As a first class citizen of the PLASMA environment, it had instant access to all the PLASMA modules I've been building for the past decade. From floating point to high-res graphics libraries and everything in between.
As I was focusing on debugability, I chose an ITC model to allow for easy introspection into a running program. However, I quickly realized that it wasn't a very big leap of logic to have the compiler also output compiled PLASMA byte code. The debugging features were lost, but the performance improvement is dramatic. Switching between the two modes is seamless and ITC or PBC (PLASMA Byte Code) words can call each other. PLASMA byte code is a direct match to low-level FORTH constructs.
There are still a few places where I'm unsure about the proper implementation of some words, especially the more esoteric compiler constructs. The built-in vocabulary is pretty minimal on purpose, the idea was to be able to expand using available PLASMA modules and some glue words. It also looks suspiciously like an early '80s wordset, as that is what I'm most familiar with.
Here is a (worse than usual) video running through some examples:
https://youtu.be/picPyXAk77I?si=Td2En5Z3oxVTzh0zA floppy disk image ready for your favorite Apple II emulator can be downloaded here to play along at home:
https://github.com/dschmenk/PLASMA/blob ... PLFORTH.POAnd for more information about PLASMA you can check the GitHub site:
https://github.com/dschmenk/PLASMAor the Wiki for details about the VM and libraries:
https://github.com/dschmenk/PLASMA/wikiLastly, the source for PLFORTH as written in PLASMA:
https://github.com/dschmenk/PLASMA/blob ... lforth.plaI am happier than I would have imagined to have a REPL environment that also doubles as a useful scripting language for the PLASMA environment. Always looking for useful feedback