allisonlastname wrote:
This probably isn't that impressive, but hey I'm proud of it.
You've written more than 20 lines of Forth, and you've modified the language itself to do your bidding. That
is impressive and means you are on your way to great (Forth) things. I enjoy seeing how other people modify their Forths, even if I don't plan on doing what they are doing, or would have done it differently.
Tali Forth 2, which is what I use mostly, also doesn't have conditionals that work when interpreting.
The ANS pages for [IF], [THEN], and [ELSE] referenced by JimBoyd give example code and I'm likely to go that route as it doesn't use up dictionary space and Tali doesn't have 0BRANCH.
When looking into this earlier, I also stumbled on Tachyon Forth (I believe the latest version is called TAQOZ) for the Propeller micros. It compiles even when interpreting (similar to :NONAME, but the memory is reclaimed later) and then runs the compiled line. This allows IF/ELSE/THEN (along with other compiling words like loops) to be used even in interpreted mode with the limitation that they have to be on the same "interpreted" line if they are being "interpreted". While I don't plan to do anything like that myself, it is neat to see what others have tried and how it works along with the benefits and disadvantages that their solution has.
Good work, and thanks for sharing.