💾 Archived View for stack.tilde.cafe › gemlog › 2022-10-02.octoforth.gmi captured on 2024-07-08 at 23:37:55. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-09-08)

-=-=-=-=-=-=-

OctoForth progress

Last month I fell into a Forth rabbithole and never came out.

Having implemented a quick toy i386 Forth, with the hope of having a tool for an i386 OS written in assembly, I had so much fun reacquainting myself with the 32-bit i386 (and its limitations, viewed as advantages this time), I just continued plowing ahead.

Over the last week or so I revived my old sliding-window interpreter which allows me to use 8-bit bytecodes, but does not limit me to a fixed assigment, but instead, automatically adjusts the indirection table at compile-time. It is a truly awesome idea, and amazingly, no one else has used it. It is a unique privilege to be (apparently) the only one in the world doing something.

I suppose there is little interest in threaded interpreters in the first place, and Forths that used bytecodes normally incur an extra performance penalty. However, having put on my who-cares-colored sunglasses, I can run a dead loop counting to one billion in less than 3 seconds on my 10-year-old notebook. That's really not bad for a dynamic interpreted language without any bullshit tricks.

And the beast is up and running! I dubbed it OctoForth, for its 8-bit tokens (and it seems no one else uses that name).

It's already a pretty complete Forth-like language in a few kilobytes. The bytecodes are ridiculously compact, and some words are less than 10 bytes/tokens long.

I am test-driving some new ideas:

Whew, that is a lot of new stuff.

Needless to say, I am happy as a pig in shit (if you believe that pigs are happy in shit). Anyway, I will be plowing ahead as I can't stop now. More later.

index

home