Mitch Bradley's CForth has an infinite while loop as the inner interpreter with a switch statement inside, that uses a macro "#define next continue" to jump to the next instruction in the infinite while loop, instead of break.
https://github.com/MitchBradley/cforth/blob/master/src/cfort...
Mitch's CForth is about as efficient (and well designed and refined) a Forth interpreter you can possibly implement in portable C.
Mitch's OpenFirmware is a more traditional industrial strength Forth implementation, extremely advanced, feature rich, and well designed, that runs on many different processors and hardware, has assemblers for different CPUs, and a metacompiler that supports many different CPUs, word sizes, byte orders, threading techniques, top level interactive control structures, headerless code, machine independent bytecode, read-only firmware, portable device drivers, hardware and driver configuration, and many hardware platforms.
https://github.com/MitchBradley/openfirmware
This is an implementation of Open Firmware, a processor-independent
firmware design. Open Firmware is specified by IEEE 1275-1994,
Standard for Boot (Initialization, Configuration) Firmware. The
IEEE standard designation lapsed in 1999, when the Open Firmware
working group declined to go through the rather time-consuming
IEEE reaffirmation process, but the design lives on.
This implementation was written primarily by Mitch Bradley, the
original author of Open Firmware. The bulk of the recent
development was done at Firmworks by Bradley and colleagues.
It traces its roots back to the original Open Boot firmware
implementation that Bradley developed at Sun Microsystems in the
late 80s and early 90s. That in turn had roots in Forthmacs,
a Forth programming language implementation developed and
marketed during the early 80s by Bradley Forthware. And
Forthmacs, in turn, owes a debt of gratitude to the public
domain Forth implementations F83, developed by Michael Perry,
and MVP Forth, by Glen Haydon. Lilian Walter wrote the USB stack.
https://news.ycombinator.com/item?id=29279022
DonHopkins on Nov 19, 2021 | parent | context | favorite | on: Forth vs Lisp
The inner interpreter of Mitch Bradley's portable and efficient CForth is simply implemented with a big switch statement, in the function called "inner_interpreter".
The C compiler typically compiles that code with the big switch statement into an efficient jump table, behind the scenes.
https://github.com/MitchBradley/cforth/blob/master/src/cfort...
Properly speaking, that's a token threaded interpreter, since it switches on token numbers in the code field, instead of indirecting function through pointers to the C equivalent of "code" words.
https://en.wikipedia.org/wiki/Threaded_code#Token_threading
https://news.ycombinator.com/item?id=27484426
DonHopkins on June 12, 2021 | root | parent | next [–]
From https://news.ycombinator.com/item?id=21823081
I wrote malloc.fth for Mitch Bradley's ForthMacs, which ended up in OpenFirmware:
https://github.com/openbios/openfirmware/blob/master/ofw/cor...
[...]
https://news.ycombinator.com/item?id=21822840
DonHopkins on Dec 18, 2019 | parent | context | favorite | on: Thoughts on Forth Programming
Here's the interview with Mitch Bradley saved on archive.org:
https://web.archive.org/web/20120118132847/http://howsoftwar...
I've previously posted some stuff about Mitch Bradley -- I have used various versions of his ForthMacs / CForth / OpenFirmware systems, and I was his summer intern at Sun in '87!
Mitch is an EXTREMELY productive FORTH programmer! He explains that FORTH is a "Glass Box": you just have to memorize its relatively simple set of standard words, and then you can have a complete understanding and full visibility into exactly how every part of the system works: there is no mysterious "magic", you can grok and extend every part of the system all the way down to the metal. It's especially nice when you have a good decompiler / dissassembler ("SEE") like ForthMacs, CForth, and OpenFirmware do.
https://news.ycombinator.com/item?id=9271644
[...]