HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
MitchBradley
cforth
C2018–2026
MitchBradley / cforth

cforth

Mitch Bradley's CForth implementation

2Distinct people
19Mentions
0Explicit recommenders
171GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Mitch Bradley's CForth implementation

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 10:49:33 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year19 dated mentions

Observed mentions: 2018-07-07 20:56:31 UTC to 2026-10-14 05:57:22 UTC.

012342018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20182019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20222023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC202
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC303
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC000
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC404
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC000
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC404
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC101
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC303
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC202

What Hacker News says

4 sources
NeWS didn't use FORTH. But HyperTIES used both FORTH and NeWS because there were a lot of things that FORTH could do that NeWS couldn't, like link and call C code directly. The FORTH I used was Mitch Bradley's "Sun Forth", aka "Forthmacs" (with the Jove ersatz Emacs editor by Jonathan Payne built in), which eventually evolved into OpenFirmware, and which was once defined by an IEEE standard, "IEEE 1275-1994", but it was withdrawn because the standard was not reaffirmed: https://en.wikipedia.org/wiki/Open_Firmware >Open Firmware is described by IEEE standard IEEE 1275-1994, which was not reaffirmed by the Open Firmware Working Group (OFWG) since 1998 and has therefore been officially withdrawn by IEEE. It's still alive and maintained and used for many things. Here's the source code, called OpenBIOS, as well as some other implementations an
Read the rest
In Hypertext '87 (1988) [pdf]
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 Compiled user defined Forth colon definitions, <builds and does> definitions, etc, do thread through code field address pointers though -- see the default case of the switch statement: https://github.com/MitchBradley/cforth/blob/master/src/c
Read the rest
fort... At the other end of the spectrum, there's the Novix Forth Engine! https://news.ycombinator.com/item?id=8860786 >DonHopkins on Jan 9, 2015 | parent | context | favorite | on: Design of Lisp-Based Processors Or, LAMBDA: The Ul... >The Novix FORTH chip was a pretty cool implementation of FORTH in hardware -- it had separate data and return stacks, which it could push or pop at the same time, so the compiler could combine several FORTH words into one opcode. http://users.ece.cmu.edu/~koopman/stack_computers/sec4_4.htm... >The Novix NC4016, formerly called the NC4000, is a 16-bit stack based microprocessor designed to execute primitives of the Forth programming language. It was the first single-chip Forth computer to be built, and originated many of the features found on subsequent designs. Intended applications are real time control and high speed execution of the Forth language for general purpose programming. >The NC4016 uses dedicated off-chip stack memories for the Data Stack and the Return Stack. Since three separate groups of pins connect the two stacks and the RAM data bus to the NC4016, it can execute most instructions in a single clock cycle. https://web.archive.org/web/20160402032358/http://www.forth.... >The NC4000P is a single chip FORTH Engine based upon minimum hardware concepts developed by Mr. Charles H. Moore. This highly parallel machine architecture directly executes FORTH primitives in a single clock cycle. The initial implementation of this device is based upon a 4000 gate CMOS semicustom integrated circuit operating at an 8 MHz clock rate. But I'm preaching to the choir, Jacques! ;) Dadadatablblblblbl! https://news.ycombinator.com/item?id=3814155 >jacquesm on April 8, 2012 | parent | context | favorite | on: A Forth Story... >Quite a story, and it seems it does not have a happy ending, but for all the wrong reasons. About 2/3rds in (past the 'read more') the Novix rates a mention. I think that that is possibly the most underrated CPU design that ever saw the light of day, at the time it was so out of the ordinary that only very few people knew what to do with it. >A high level language (forth is by most definitions a high level language) directly executed by the CPU. >At the time I worked for a company called dadadata in the Netherlands, they were in the process of developing a bunch of real time software to process video images for classification and recognition (1988 or thereabouts). The Novix chip arrived and would have definitely blown the socks of anything that I could have done with a regular PC at the time, if not for one small problem: someone dropped a dime into the power supply and the whole development kit was toast. A couple of all nighters later we had a working reproduction of the code in 'C' and that was used for the customer demonstrations. Still, the power of that little chip is something I'll never forget and it is a pity that the Novix and its successor which iirc was called shboom never made real headway. The forth code for the novix was probably only about 10% or so in size of the equivalent C code. The head forth honcho there called C sneeringly a 'great' language. >There is still hope, even today that one day that power will finally be available in some package that sees wide distribution, the heritage of Novix lives on in the greenarrays line (which is now shipping dev boards and chips). http://www.greenarraychips.com/ >To kill forth and the concepts behind it permanently will take a lot of garlic and stakes, I think it will always have its champions.
In Forth vs Lisp
In PostScript that would be: /PostScript Know? { Honk! } { /PostScript Learn! } ifelse FORTH doesn't have an IFELSE unless you define it yourself of course, but it would have no way of telling which part of your code was the conditional, part to do if true, or part to do if false, since white space and line breaks have no meaning to it, except for a few cases like \ comments. The IF comes between the conditional and the part to do if true, the ELSE comes between the part to do if true and the part to do if false, and the THEN comes at the end. The structure of PostScript code, conditionals, and flow control is homoiconic, made of nested arrays, like polymorphic JSON arrays, where FORTH code is flat untyped arrays of threaded pointers with relative branching. Forth has an "inner interpreter" called NEXT that threads from one pointer to the
Read the rest
next (sometimes implemented as one machine language instruction, or just a few), and also an "outer interpreter" or compiler that translates text into threaded code for the inner interpreter. https://en.wikipedia.org/wiki/Polymorphism_(computer_science... https://en.wikipedia.org/wiki/Homoiconicity https://en.wikipedia.org/wiki/Threaded_code Here's Mitch Bradley's implementation of interactive control structures (IF, ELSE, THEN, BEGIN, UNTIL, AGAIN, REPEAT, WHILE, DO, LOOP, etc) in the outer interpreter of his FORTH system, which actually allows you to use conditionals and loops at the interactive top level of the interpreter, not just in compiled words (which solves a traditional and frustrating limitation of classic FORTH). https://github.com/MitchBradley/openfirmware/blob/master/for... Here is an alternative but equivalent implementation of interactive Forth control structures in his CForth (Forth implemented in C, of course): https://github.com/MitchBradley/cforth/blob/master/src/cfort... Here's some more of Mitch's beautiful code from OpenFirmware, his Forth kernel meta-compiler written in Forth, which supports 8, 16, 32, an 64 bit, big-endian and little-endian architectures, as well as direct, indirect, and token threaded code: https://github.com/MitchBradley/openfirmware/blob/master/for... https://en.wikipedia.org/wiki/Threaded_code#Direct_threading https://en.wikipedia.org/wiki/Threaded_code#Indirect_threadi... https://en.wikipedia.org/wiki/Threaded_code#Token_threading
In Forth vs Lisp
Speaking of Forth experts -- there's Mitch Bradley, who created OpenFirmware: https://news.ycombinator.com/item?id=21822840 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
Read the rest
have a good decompiler / dissassembler ("SEE") like ForthMacs, CForth, and OpenFirmware do. https://news.ycombinator.com/item?id=9271644 >DonHopkins on Mar 26, 2015 | parent | favorite | on: The Elusive Universal Web Bytecode >The other "universal bytecode" that came out of Sun and actually has seen a lot of use is Mitch Bradley's Open Firmware Forth based boot ROMs, used by Suns' 68k, SPARC and x86 boxes, Apple's PPC Macs, IBM, ARM, OLCP XO-1, and many other systems. >http://en.wikipedia.org/wiki/Open_Firmware https://news.ycombinator.com/item?id=12240478 DonHopkins on Aug 7, 2016 | parent | favorite | on: “EFI? Intel has been trying to shove that down ou... >Mitch Bradley originally developed a Forth system at Sun for use diagnosing and developing hardware, by burning it into ROM and running it via a serial port. >It was based on Langston and Perry's Forth-83, and had a meta compiler that could target different word sizes and architectures. He made it even more architecture and word size independent, implemented interactive top level loops and conditionals, emacs-like line editing, all kinds of low level device drivers and testers that ran in stand-alone mode, and many other features, including full 16 and 32 bit support with a vocabulary for writing word size and endian independent code. >He ported Sun Forth to 68K and SPARC Sun workstations, as well as the Amiga and other systems. It ran in both stand-alone mode (from disk, tftp or ROM), or under Unix. Under Unix, it could dynamically relocate and link in Unix libraries, and you could call back and forth between Forth and C. >Sun Forth eventually evolved and standardized into the Open Firmware [1], whose purpose was to support machine independent byte code [2], so plug-in hardware cards could include ROMs with Forth byte code drivers that ran on 68K, SPARC, x86 and other systems. >Sun shipped it with the SPARC workstations, Apple adopted it and shipped it on their PowerPC Macs, IBM shipped with their POWER servers, and Mitch worked directly with the OLPC project extending OpenFirmware to support the OLPC XO-1 Children's Computer secure and power efficient hardware. [3] >>OLPC Wiki: Open Firmware >>Open Firmware is the hardware-independent firmware (computer software which loads the operating system) that the XO runs. >>It was developed by Mitch Bradley at Sun Microsystems, and used in post-NuBus PowerPC-based Apple Macintosh computers (though it has been dropped with Apple's transition to Intel processors), Sun Microsystems SPARC based workstations and servers, IBM POWER systems, and PegasosPPC systems, among others. On those computers, Open Firmware fulfills the same tasks as BIOS does on PC computers. >>For example Fedora and Debian use the YaBoot BootLoader for Open Firmware. >>The Open Firmware user interface includes a FORTH-based shell interface. FORTH is a powerful high level language that is remarkably compact. A complete Forth development environment including compiler, decompiler, assembler, disassembler, source level debugger, and assembly language debugger is present in the XO boot ROM (SPI FLASH). With the Open Firmware Forth system, you can directly access all of the hardware devices on the XO, use built-in functions like selftest diagnostics and games, and even write complete applications, without needing any external tools. The bulk of Open Firmware is written in Forth, so the source level debugger can be used to debug Open Firmware itself. >[1] http://www.openfirmware.info >[2] http://www.openfirmware.info/FCODE_suite >[3] http://wiki.laptop.org/go/Open_Firmware https://news.ycombinator.com/item?id=15040859 >DonHopkins on Aug 17, 2017 [-] >Emacs qualifies as a window manager in my book! ;) >That code you linked to is from Mitch Bradley's "Forthmacs", which ran on Sun workstations including 68k i86 and SPARC, and also Atari ST, Mac and other systems. He developed it into the "Open Boot ROM" architecture, which was used in Sun workstations and Apple PowerPC Macs as well as the OLPC children's laptop. >https://github.com/ForthHub/ForthFreak/blob/master/Forthmacs >https://en.wikipedia.org/wiki/Open_Firmware >http://wiki.laptop.org/go/Open_Firmware >On SunOS, Forthmacs had a library clink.f with the ability to dynamically relocate and link Unix libraries so that you could call them from Forthmacs, pass arguments on the stack, etc. SunOS didn't actually support shared libraries or dynamic address relocating at that time, so Forthmacs simply ran the Unix linker utility to create a file with the library relocated to the desired address space in the FORTH dictionary, and then read that file into memory, define its symbols in the FORTH dictionary, and let you access its variables and call its functions directly from FORTH! >That's how Mitch originally integrated MicroEmacs with Forth to make Forthmacs, and how I later integrated "uwm" into FORTH: I refactored uwm so instead of having an event loop in the main function, it was a library that could be called by FORTH, which would link the library in and run the main loop itself, calling into the library as needed to initialize and handle specific events (_uwm_init, _uwm_poop). http://www.donhopkins.com/home/archive/piemenu/uwm1/fuwm-mai... >Here's the glue that links in the uwm library from fuwm.out: http://www.donhopkins.com/home/archive/piemenu/uwm1/load-fuw... .( Loading...) cr requires tasking.f requires uwm.f requires clink.f .( Linking...) cr "" fuwm.out clink .( Linked!) cr https://news.ycombinator.com/item?id=17480298 >DonHopkins on July 7, 2018 | parent | favorite | on: Tali Forth 2 for the 6502 >Cool! Does it include a FORTH 6502 assembler written in FORTH? I love writing assembly code in RPN with Forth macros! >You can write FORTH code with loops and conditionals and any kind of logic and parameters, that dynamically assembles machine code! Much better than your typical macro assembler. >Here's some 6502 assembler for an Apple ][ SUPDUP terminal emulator that does ram card bank switching: >http://www.donhopkins.com/home/archive/forth/supdup.f >Here's some Forth 68k assembler that draws lines on a weird Sun-2 CGONE graphics board. >http://www.donhopkins.com/home/archive/forth/cg/bline.f >Mitch Bradley's 68k forth lets you use interactive conditionals and loops in the top level outer interpreter! >I think he wrote a paper about that feature, which I might be able to dig up ... Here's something related he wrote about refactoring the outer interpreter, but not what I'm thinking of: https://groups.google.com/forum/#!topic/comp.lang.forth/lKQj... >avhon1 on July 7, 2018 [-] >> Does it include a FORTH 6502 assembler written in FORTH? https://github.com/scotws/TaliForth2/blob/master/docs/manual... >>Currently, there is no assembler included. The plan is to include a simple assembler based on Simpler Assembler Notation (SAN). >It does include a disassembler: https://github.com/scotws/TaliForth2/blob/master/docs/ch_dis... >The author has written a 6502 assembler in gforth: https://github.com/scotws/tasm65c02 >Here is a document describing the notation: https://docs.google.com/document/d/16Sv3Y-3rHPXyxT1J3zLBVq4r... >DonHopkins on July 7, 2018 [-] >I got a quick reply from Mitch Bradley! >Yes I wrote a paper but I probably can't find it. The easiest place to look would be in the Open Firmware source. >https://github.com/MitchBradley/openfirmware/blob/master/for... >The magic is all in +level and -level. Search for those in kernel.fth to see other places they are used to achieve a similar effect, e.g. in abort" >For an alternative but effectively equivalent formulation, see: >https://github.com/MitchBradley/cforth/blob/master/src/cfort... >and >https://github.com/MitchBradley/cforth/blob/master/src/cfort... lukego on Dec 18, 2019 [–] I love your posts about this stuff :) I was also an "intern" of sorts for Mitch as recently as 2009 or so. I wrote the audio driver for OLPC XO 1.5 and went to Taipei to help with the bringup. I was amazed to watch Mitch using Forth to interactively tweak the DDR memory settings, find bugs in the motherboard, and find bugs in the CPU which was a godawful x86 from VIA that had seemingly only been debugged enough to boot windows :) DonHopkins on Dec 18, 2019 | parent [–] That must have been a fun and unique opportunity! His programming and debugging process has to be seen to be believed. OpenFirmware is definitely a highly polished work of love. Its well-commented and meticulously organized source code reads like fine literature or classical music! Stuff like the metacompiler and kernel, for example: https://github.com/MitchBradley/openfirmware/blob/master/for... https://github.com/MitchBradley/openfirmware/blob/master/for...
In Forth vs Lisp

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.