News for hackers. Stuff that matters.
Re:RetroForth 2021.1 by lhorie on Wednesday February 17, 2021 @06:45PM (#26173475)
> Forth compilers can be bootstrapped from not-very-much assembler

Do you have any resources handy on how one could do that from scratch?

Re:RetroForth 2021.1 by benhoyt on Wednesday February 17, 2021 @06:59PM (#26173601)
A good learning resource is Jonesforth (something of a classic), on GitHub here: https://github.com/nornagon/jonesforth/blob/master/jonesfort...

I wrote several Forth compilers when learning to code as a teenager, one using the A86 assembler, and two fully bootstrapped-from-assembler ones for 8086 and 386. The 8086 source code is here (I didn't write the assembler myself): https://github.com/benhoyt/third (KERNEL.F has the assembler parts)

Re:RetroForth 2021.1 by ampdepolymerase on Wednesday February 17, 2021 @10:59PM (#26175564)
Re:RetroForth 2021.1 by transfire on Thursday February 18, 2021 @04:22AM (#26177714)
Nice find. Thanks.
Re:RetroForth 2021.1 by naters on Wednesday February 17, 2021 @06:57PM (#26173582)
Jonesforth [1] is a classic example of this, and a really good example of “literate” code.

[1] https://github.com/nornagon/jonesforth/blob/master/jonesfort...

Re:RetroForth 2021.1 by dreamcompiler on Wednesday February 17, 2021 @11:53PM (#26175991)
I did this for the TMS34010 graphics processor many years ago but my notes are long gone. I was inspired by Mach 2 Forth, an amazing compiler for the early Mac. My compiler had local variables and tail call detection to take advantage of a special "one-deep" stack register on the chip.

The key point is that Forth can easily incorporate an RPN assembler which you can write in Forth, and with which you can then build a better Forth. I'm not sure if I even started with the official TI assembler for the chip; I probably first wrote a cross assembler in Mach 2 by transcribing the ISA manual and bootstrapped from that.

Re:RetroForth 2021.1 by tailrecursion on Wednesday February 17, 2021 @11:21PM (#26175744)
You requested from scratch, but also look into "metacompilation", which was typically how it was done.