💾 Archived View for bbs.geminispace.org › s › FORTH captured on 2024-07-09 at 02:03:16. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-06-16)
-=-=-=-=-=-=-
Forth, discovered by Chuck Moore in 1968, is a timeless, expressive family of concatenative languages that can be ported to any machine in a day. Rivaled only by Lisp in its flexibility, forth is a language construction kit: you create a forth that solves your problem. There is no one true forth - it is a state of mind.
nForth: Back To Pseudo-Interpretation — I blew it making nForth compile-dominant (pseudo-interpret only text in square braces). It created annoying complications, and I switched back to normally-interpret and compile only things inside curly braces. This is not traditional Forth, which automatically starts compiling at a `:` and ends the compile at a `;` -- I always hated that convention. The curly braces make code look C-shaped, and that is ok, because { this looks like a function definition ;...
💬 View post · 2023-09-22 · 10 months ago
Metaprogramming and nForth — Some popular language are exactly what they are, syntactically. C, for instance, has no provisions for extending itself, other than typedef for providing names for simple or composite _data_ types. A more interesting language, like Lisp, or Forth, is designed to be extended, and is largely largely written in itself. Forth, in particular, has a very straightforward way to write code that generates code. Traditional Forth has two distinct modes of operation:...
💬 2 comments · 1 like · 2023-09-20 · 10 months ago
Loading files in nForth: implementation — Having implemented the normally-compile semantics I discussed in the previous post, I must now tackle the `include` functionality to load more forth code from a file. The problem: since nForth is now a compterpreter (it compiles code and runs/erases it to simulate interpretation), we must compile and run the loading code and the filename into the dictionary to execute the load. If we blindly load on top, the pseudo-interpretive block of code that does...
💬 2 comments · 2023-09-14 · 10 months ago
Avoiding compile/interpret modality in Forth — If there is one thing I hate about classic Forth is the duality of interpret/compile modes. It makes for a lot of complications, like special versions of conditionals [IF] [THEN], etc. that work in the interpreter but not the compiler. And the whole idea of 'state-smart' words that do different things in compile mode. Yech. So I thought I was smart when I eliminated the problem alltogether by leaving the system in compile mode always. Now,...
💬 1 like · 2023-09-13 · 10 months ago
Lambdas in nforth — I'm trying out lambdas in nforth. The syntax is simple and I have some good use cases for lambdas. Syntactically, to create a lambda, just surround some code with curly braces: [preformatted] The square braces here ensure that the entire thing gets compiled prior to execution. When nforth processes it, the address of the lambda is left on the datastack. This address can be evaluated using the `eval` word (lambda--) which takes the lambda address off the datastack and runs...
💬 View post · 2023-09-12 · 10 months ago
Forth keeps intriguing me. I've written the snake game in forth. The principle of continuously building on more simple words is elegant. But I keep failing to find any "real" programs in forth I'm aware that uxn exists and varavara is another thing that I keep coming back to. Is this forth? Kinda. I think it qualifies. In my head, forth is the perfect starting point for a "degrowth" computing system. Maybe similar to CollapseOS. an ecosystem of commandline programs to get stuff done. Does...
💬 4 comments · 2 likes · 2023-09-11 · 10 months ago
To nForth and Beyond — I've been hacking on my little nForth, which is a simple 32-bit indirect Forth with a few deviations from norm. In the process I shrunk it down to 3.5KB, which opened up my appetite for tiny Forths. Come to think of it, I haven't written more than 64KB of forth for any forth project this century. Not even close. And 64K of forth is a huge amount of code, even with 32-bit tokens. So I've been thinking of spinning up another forth, with 16-bit execution tokens and 64KB (or...
💬 1 comment · 3 likes · 2023-09-08 · 10 months ago
How do you run the Forth you write?
💬 5 comments · 2023-08-12 · 11 months ago · 🗳️
Modern Forth utilities — Does anyone know modern software written in Forth? I would like to read the source code of one but I don't really know where to look.
💬 6 comments · 1 like · 2023-08-10 · 11 months ago
I just came across Charles Childer's new experiments with RetroForth. I lost track of RetroForth years ago, and it's great that it's going strong. The new dialects seem to focus on specialized VMs that bundle several MachineForth-like 5/6-bit opcodes into a 32-bit word... [gemini link] [gemini link] [gemini link]
💬 1 comment · 2023-08-08 · 11 months ago