Developer Brian Steffens built the virtual machine while experimenting with Google’s Apps Script. Apps Script is built into Google’s online Docs suite and lets you run custom code when events happen in a document. By crafting Apps Script code, Steffens made a visual representation of a computer processor using spreadsheet cells. The virtual machine has four general purpose registers, used to hold the output of operations, and a 100-cell memory bank which functions as the “computer’s” RAM. There’s also dedicated cells for the instruction and stack pointers that control the execution of “programs.” The result is a processor simulator that runs entirely using Google Sheets formulas, or the same expressions you’d write in a regular spreadsheet. It can run code written in Brainfk, a simplistic esoteric programming language intended to challenge programmers. Saraf said that interpreters for other programming languages could be similarly created using a spreadsheet. Brainfk is comparatively complex to interpret so implementations in a different language would be less demanding. Several CPU instructions have been implemented which allow the spreadsheet to operate as a basic computer. It can move memory around the registers, perform operations on data and log any errors that occur during execution. Two sample programs, a factorial generator and a Fibonacci number calculator, demonstrate the computer in action.
The debate led to Aur Saraf, a Hacker News user known as “SonOfLilit,” setting out to build a spreadsheet-based virtual machine without resorting to using scripts. Dismissing Steffens’ effort as “not an interesting technical accomplishment,” the user returned to Google Docs to create a rival prototype. You can view both Steffens’ and Saraf’s spreadsheets over on Google Docs. http://www.digitaljournal.com/tech-and-science/technology/developer-emulates-an-entire-computer-using-just-a-spreadsheet/article/497018