Are you familiar with how a fax machine works?
You place your document in the machine, dial the recipient’s number, and voilà, the document is transmitted via the phone line and printed remotely. It was mind-blowing for its time! Now, if I told you that a tinkerer repurposed this old technology to create a C compiler via fax, you probably wouldn’t believe me.
Yet, thanks to the crazy CompilerFax project, you can now send your C code via fax, have it compiled and executed on a remote Raspberry Pi, and receive the result… again by fax! It’s a real retro-tech trip, an improbable mashup of technology from another era with modern software. I love these kinds of WTF projects, so I had to tell you about it!
You write your C code on a nice sheet of paper, using a font suitable for optical character recognition (OCR). Calibri seems to work well, and don’t forget to add the magic comment line //REPLY= followed by your fax number, or you won’t get the response!
According to tests, the OCR error rate varies depending on the fonts used because some characters like O, i, or x are often misinterpreted. So, it’s better to avoid them in your variable names, and also make sure to space out your code well to facilitate recognition.
Next, head to your favorite fax machine, dial CompilerFax’s number, and send your code. On the other end, a Raspberry Pi equipped with a fax modem receives your document, extracts the code with an OCR tool like Tesseract OCR, compiles it with GCC, and executes it in a sandboxed environment under Alpine Linux (to prevent any sneaky exploits). The result is then faxed back to you promptly! Well, within a reasonable time since compilation is limited to 20 seconds and execution to 60 seconds. Beyond that, the program is terminated.
Behind this wacky project lies high-level tinkering because CompilerFax’s creator, Lex Bailey, had to deploy ingenious solutions to make these seemingly incompatible technologies work together. And if you’re interested, the entire source code is available on Github.
Sure, the 9600 bits/s fax transmission rate isn’t ideal for sending large programs. That’s why, for now, only single-page submissions are supported, and the OCR quality isn’t always perfect. But in the end, CompilerFax works and allows a return to basics at a more human pace in our world of near-instantaneous everything.
A fantastic hack indeed!