There is now a programming language shell on this website. Open kaizenkodo.no/wafer, type a line of Forth, and watch it compile and run, right there on the page. No install, no server, no account: the compiler itself runs in your browser.

What WAFER is

WAFER (WebAssembly Forth Engine in Rust) is an optimizing compiler for Forth 2012, the modern standard of one of computing's most enduring languages. It implements over 300 words across 12 standard word sets at 100% compliance. The unusual part is what happens when you define a word of your own: WAFER compiles it, on the fly, into its own WebAssembly module. Definitions are not interpreted; they become real machine-level code the moment you finish typing them. That is why it is faster than gforth, the reference workhorse of the Forth world, on every benchmark we run, typically two to ten times.

> : FIB  DUP 2 < IF DROP 1 ELSE DUP 1- RECURSE SWAP 2 - RECURSE + THEN ;  ok
> 25 FIB .  121393  ok

Why Forth

Forth is small, honest, and teachable. A program is a vocabulary: you start with simple words and compose them into better ones, testing each at the prompt as you go. There is no ceremony between you and the machine. That is also why it fits this company: a Forth system is improved one word at a time, the same way we improve everything we ship. One deliberate cycle, then the next.

Forth's creator, Chuck Moore, laid out this philosophy in his 1970 book Programming a Problem-Oriented Language. His advice: do not force your problem into a fixed language; grow a small vocabulary of words until it speaks the language of the problem, and the solution reads almost like a description of itself. The book was never formally published, yet it never went away: the community keeps it alive on GitHub, most recently as a freshly typeset edition.

xkcd 3277 'Forth': the rear of a car with a bumper sticker reading 'I FORTH ❤', which is 'I ❤ FORTH' in reverse Polish notation: operands first, operator last.
xkcd 3277, “Forth”: bumper-sticker love, in reverse Polish notation, naturally. xkcd.com/3277 · CC BY-NC 2.5

Why in the browser

The same principle as LesS/KEY, our first public tool: software that runs on your device and keeps your data there. The WAFER page is a static page plus one WebAssembly module. Everything you type is compiled and executed locally; nothing is ever sent to a server, and once loaded, the page makes no network requests at all.

Type a definition, and a millisecond later it exists as its own WebAssembly module, born in your browser, living on your machine.

Try it

Open the shell and press the demo chips, or type the two lines above yourself. WORDS lists the whole dictionary. The source code, benchmarks, and the Forth 2012 compliance table live on GitHub.

The Tools section grows the way everything here grows: one deliberate cycle at a time.

Oleksandr Kozachuk, Kaizenkodo