←back to thread

122 points rickcarlino | 3 comments | | HN request time: 0s | source
Show context
oersted ◴[] No.45655964[source]
A Forth-like command-line shell (bash replacement) does sound quite interesting actually, particularly if the stack is displayed on the side and is not implicit.

It's rather concise, most functions tend to be a single short line. Its syntax is minimal (or non-existent according to some), it's just flat white-space separated tokens. It has imperative/interactive semantics, in the sense that every successive word makes some changes on the current state (the stack).

All of this makes it quite amenable to be used as an OS shell I think, it seems obvious in retrospect.

The idea of starting with an empty Forth and creating a whole universe of automations and DSLs for your system, one command at a time, is quite pleasing, in a purist sense, although perhaps not entirely practical.

Does such a shell exist? Not as minimal as Ilo, one you can actually use in a modern system instead of bash and the like, ideally with a nice display of the stack. Probably Factor is the most appropriate Forth-like to build it on, it already has a good REPL mode, it would mainly involve adding a bunch of utilities for practical command-line use.

replies(7): >>45656030 #>>45656070 #>>45657137 #>>45657317 #>>45658405 #>>45660659 #>>45664639 #
1. kragen ◴[] No.45656030[source]
One of the most useful ways to use Forth is as a command-line shell for scripting assembly-language primitives on a small computer, like, 64KiB of RAM or less. (Ilo has 64KiB of RAM, IIRC.)
replies(1): >>45660826 #
2. crc_ ◴[] No.45660826[source]
64kW of RAM @ a 4 byte (32-bit) word size, so 256KiB of actual RAM for the applications running on ilo.

For a reference, the 8088 build needs a bit more than that to account for stacks, the VM code, drivers, and memory needed for the actual hardware. (Around 384KiB physical RAM on an 8088/8086 works well from my testing, but I've tested with 285-320KiB in non-standard configurations under a few emulation targets).

replies(1): >>45661548 #
3. kragen ◴[] No.45661548[source]
Sorry! I appreciate the correction. I forgot that it was word-oriented.