Most active commenters

    ←back to thread

    122 points rickcarlino | 12 comments | | HN request time: 0.998s | source | bottom
    1. 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 #
    2. 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 #
    3. crc_ ◴[] No.45656070[source]
    For RetroForth, I have a new interface under development that may be somewhat like this. A screenshot can be seen at https://imgur.com/a/z4jhq6e

    I use RetroForth as a working environment on Unix [mostly OpenBSD & FreeBSD], with an (unreleased) userland written in it, along with some use of external standard utilities. I'm still working on improvements around chaining programs via a pipe-like structure, but it's been my main environment apart from Konilo for a few years now.

    replies(1): >>45657198 #
    4. pjmlp ◴[] No.45657137[source]
    During the 8 bit home computer days Jupiter Ace, and ROM replacements for ZX Spectrum.
    5. Nevermark ◴[] No.45657198[source]
    Your sidebar reminds me of the computer I learned to program on. A TRS-80 Model III.

    I went through a short period of figuring out interesting peek/poke memory addresses for modifying the BASIC system, and found the "80" used as the scroll width. Setting that to 60 allowed me to create a non-scrolling status sidebar like that for my first programs/games.

    It strikes me that it would have been great to have had a Forth machine back then. That early version of BASIC didn't have a (language accessible) stack! Not even a return address stack, aka GOSUB. So I used strings as a stack to implement a small text adventure parser. (And later, on a computer with graphics pixels, I used BASIC strings as a heap for defining and drawing simple 3D vector objects.) Then I learned Pascal.

    Desperate times. Desperate measures. But Forth would have been great.

    6. delaminator ◴[] No.45657317[source]
    The BBC Micro had / has a ROM so you can boot straight into it.

    https://www.acornelectron.co.uk/info/electron/acornsoft_adde...

    I still have mine

    replies(1): >>45661876 #
    7. ◴[] No.45658405[source]
    8. rpcope1 ◴[] No.45660659[source]
    Honestly I've experimented with doing something basically like this doing a bunch of modifications to zforth and using it on RP2040 and RP2350 and it actually works really nicely. It's amazing the functionality you can fit down onto those MCUs basically building an old school computer with a Forth interface like the Canon Cat was.
    9. 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 #
    10. kragen ◴[] No.45661548{3}[source]
    Sorry! I appreciate the correction. I forgot that it was word-oriented.
    11. kjs3 ◴[] No.45661876[source]
    There was also the Jupiter Ace[1], which was sorta a Sinclair ZX with Forth in ROM.

    [1] https://www.jupiter-ace.co.uk/

    12. AndyKluger ◴[] No.45664639[source]
    These are not developed to that point, really, but you might be interested in dt and mshell.

    https://github.com/so-dang-cool/dt

    https://github.com/mitchpaulus/mshell