News for hackers. Stuff that matters.
Re:Thinking Forth: A Language and Philosophy for Solving Pro... by xelxebar on Thursday February 08, 2024 @05:34AM (#39300400)
Cool. Here are some other resources that I've encountered along the way of learning Forth:

- JonesForth: https://github.com/nornagon/jonesforth/blob/master/jonesfort...

This is legit a text that goes the an x86 Forth implementation. Actually, it's just an implementation with really extensive comments. That said, including whitespace and comments, it's just 2000 lines and the pedagogy is excellent. Highly recommended for anyone who would rather see behind the curtain before picking up a larger text.

- SmithForth: https://dacvs.neocities.org/SF/

So, Smith decided to hand-write a Forth directly in x86-64 opcodes (well, the corresponding ascii hex bytes). It's incredibly slim and enlightening how you can bootstrap a language in just a couple hundred bytes or so.

This project actually inspired me to really learn the x86-64 architecture, so I ended up hand-decompiling the SmithForth binary instead of going through his commented implementation. Hand-decompilation is an absolutely fascinating exercise. You learn all about ELF structure, opcode encodings, and actually start to see the gaps where microarchitectural details shine through. Highly recommended for any hacker that really wants to grok low level details.

- Mecrisp: https://mecrisp.sourceforge.net/

An amazingly fast Forth implementation for MSP430, ARM, RISC-V, MIPS, and some FPGAs. This gave me one really nice understanding of Forth as

    A REPL into your hardware!
- ##forth on libera.chat

Really active and helpful members there. Definitely worth dropping by.

Re:Thinking Forth: A Language and Philosophy for Solving Pro... by sph on Thursday February 08, 2024 @06:47AM (#39300837)
Don't forget eForth, which I believe is a better, and more "Forthy" implementation than JonesForth is, though not as easy to understand for a newcomer.

http://www.exemark.com/FORTH/eForthOverviewv5.pdf

https://www.forth.org/OffeteStore/1013_eForthAndZen.pdf

Another outstanding resources are the post from Bradford J. Rodriguez. Can't write a Forth implementation without going through the wisdom that's condensed in those links (see the first section):

https://www.bradrodriguez.com/papers/index.html

Re:Thinking Forth: A Language and Philosophy for Solving Pro... by idatum on Thursday February 08, 2024 @09:14PM (#39310637)
> A REPL into your hardware!

This is what got me interested in Forth using ARM STM32 devices a couple years ago.

Specifically, I put Mecrisp-Stellaris Forth on an STM32F401. It was fun! You can experiment and quickly learn (fail fast) trying different features -- could try features of the chip as I read the datasheet.

I was able to translate those learnings to a C implementation as well.