Hacker News new | past | comments | ask | show | jobs | submit login

Forth is the ideal language for bootstrapping a cobbled-together computer from whatever scraps you can find. Forth gives you a shell, an assembler, a disassembler, and a rich, extensible programming language in a few kilobytes. You can peek or poke hardware interactively, or use the REPL as a calculator. Forth-style assemblers also make cross-compilation very practical.

If I was tasked with bootstrapping a post-apocalyptic computer from junk, a hard copy of a well-commented Forth implementation would be a welcome assistance.

Here's a very nice forth implementation for the C64 (not z80-based, it's 6502, but close): https://github.com/jkotlinski/durexforth

Sounds great! Can we get all that with a less confusing syntax? That’s my main difficulty with forth.

The syntax is unfamiliar to most, but it's very consistent and learnable. The syntax is one of many aspects of the design that keeps the whole thing simple. The use of a stack to pass arguments between words makes the kind of "pipelines" which are common in CLI shells very natural. I can think of few, if any, other languages I would want to use interactively as a replacement shell without complex line-editing assistance.

For those curious as to what a modern machine using Forth on bare metal as an operating system might feel like, check out Open Firmware: https://www.openfirmware.info/Open_Firmware

(If you have an OLPC sitting around in a closet somewhere from the Give-One-Get-One program years ago, you already have a serviceable and physically robust Forth machine ready to roll! Same deal for some older Powerbooks and Sun workstations.)

I wish openfirmware was the norm. PC BIOS and UEFI are horrible in comparison.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact