I can& #39;t get out of my head, the idea that it would be cool if Mirth could target DOS, you know, as a platform.

But the only Mirth program is the Mirth compiler. So...

Sofia makes a self-hosting compiler for DOS.

A thread.
The main challenge is fitting all the operations of the compiler in a small amount of memory.

640 KB actually sounds like a lot . . .
Ok, I reserved a lot of big buffers in the compiler but they& #39;re mostly useless or empty.

The file buffer holds the whole file, but I really only need to look at it one character at a time, when I& #39;m lexing.

So let& #39;s make it small, and read the file on demand.
Hmm... Lexical data (row & column data) sure takes up a lot of space that& #39;s only useful when there are errors/warnings to display.

I don& #39;t need to store the data. I can re-lex the file just to pick out the row & column data, if needed. Surely that& #39;s fast enough for errors.
Tokens are the next big thing. I could just try to pack them tightly and make the common cases super efficient... There& #39;s some limit here, but I don& #39;t know what it is.

(The true limit is Shannon& #39;s entropy. But the practical limit is Sofia& #39;s sanity, which has not been found.)
(I& #39;ll add more to this thread over time, if I don& #39;t abandon the idea of running Mirth on DOS.)
You can follow @typeswitch.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: