← Back to context

Comment by richdougherty

5 years ago

I think the argument against a custom IR is that once you start optimising your IR for compactness you'll probably end up near Forth in the design space anyway. As you say perhaps making the IR stack-based.

Once you're at that point you may as well just use Forth, especially since it's got a proven ability to work in these kinds of resource contrained, self-hosting/self-bootstrapping environments.

> you'll probably end up near Forth in the design space anyway

Good point. Related to this, FORTH can be treated as a target platform for compilers, although I don't think there are many mature compilers that do this.

I wonder if CollapseOS will ever seriously target heavyweight platforms like x64 (and not just through emulation with libz80). I suppose that's out scope, but it would open the door to JIT.

> you may as well just use Forth

Presumably it could be a little more compact if a less human-readable variation were used, no? FORTH uses DROP and THEN, which could be shortened at the cost of readability.