←back to thread

122 points rickcarlino | 1 comments | | HN request time: 0.001s | 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 #
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 #
1. 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.