💾 Archived View for stack.tilde.cafe › gemlog › 2022-09-15.nForth.gmi captured on 2024-07-08 at 23:37:16. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-09-08)

-=-=-=-=-=-=-

nForth

And it's up and running. Defining words, etc.

I was just a tiny bit more optimistic about getting to this point yesterday -- I would have, but decided to stop for a happy hour drink, and... yeah.

nForth 0.0.1, Copyright (C) 2022 StackSmith
 OK> 1 2 + .
00000003 OK> : inc ( 1 + )
 OK> 3 inc .
00000004 OK>  16 times ( $3D emit )
================ OK> bye

A little rough around the edges, but works. 2.5 kilobytes.

Parenthesized clause syntax

Yet another improvement on the Forth syntax... Parentheses!

Parentheses delimit a block that is compiled as one thing. Works great for eliminating BEGIN ... END type syntax (yuck) -- no weird end delimiters to remember. May be used anywhere - control structures, definitions, or just to group operations for precedence or fun.

Why another forth?

While I've been making and programming in Forth-like languages for around 40 years, I realized I don't have a minimal 386 implementation suitable for, say, KolibriOS. And a simple indirect-threaded interpreter is nice to mess around with, compared to my later optimizing compilers with truly obscure features...

As Chuck Moore said, there is no one true Forth. Standards be damned, being able to code up an implementation in a couple of days to the point of compiling and defining is an amazing ground for experimentation.

It feels sooo damned good to bootstrap a Forth. I'll be spinning up Forths every few years, I hope, until my brain turns to mush.

index

home