← Paleocomputing · Русский

RED, GREEN, BLUE and YELLOW in the browser

The four designs of the Pentagon language competition: RED and GREEN, the finalists of 1979, and BLUE and YELLOW, dropped after the first phase in 1978. Your program is translated to C by a translator written in its own language, compiled by clang and run here, with a thread for every task. Nothing leaves the page.

Standard input

    

How it works

redc, greenc, bluec and yellowc, the translators written in RED, GREEN, BLUE and YELLOW, are built to WebAssembly from the same C seeds the repository bootstraps from. They translate your source to C; a YELLOW program gets the standard prelude in front of it, as on Linux. clang and lld, compiled to WebAssembly, turn that C into a program for wasm32 with threads. The runtime is the same C file as on Linux: it hands the processor from task to task by the RED rules, on a virtual clock, so the output here matches a native run byte for byte.

The first run downloads the C compiler, about 20 MB, from jsDelivr; after that the browser keeps it.

Sources, labs and the article