Show HN: A virtual machine made with Google Sheets formulas (no script)
620 pointsIn a popular post today[1] the title claims "VM in Google Sheets", but it's actually in Google Script, which is basically Javascript and not an interesting technical accomplishment (definitely a useful educational tool, though).
Disappointed, I set out to fix it. Voila!
https://docs.google.com/spreadsheets/d/1g3-FZBnkDuLqFYOmk457...
A Brainfk interpreter in pure Google Sheets formulas. The hard part was parentheses matching, so I think other VMs would be even easier.
[1] https://news.ycombinator.com/item?id=14701460
Comments (37) 9 threads
Earlier commentshttps://docs.google.com/spreadsheets/d/1ZJECuw6GXA_wEMnfe2Oj...
Then you can read the writeup I wrote in response to another commenter (the guy who wrote the original Apps Script VM).
So if you go to the orange section of the sheet you see where the program state is displayed. Each row represents the state of the program at that point. The "Out" column is the stack represented as ASCII characters. The "Cursor" column is the stack pointer. The "IP" column is the instruction pointer (which instruction you're currently looking at). The "Instruction" column is the instruction being done at that point in time. The "Cells" column is the stack displayed from left to right.
I may be a little off but that is the general idea.
Replace the word "stack" with "memory buffer" or "tape" everywhere. "Out" represents STDOUT, there is the "." command for printing (and "," for reading from STDIN).
Thanks!
Continue this thread — 2 replies
All comments shown.
Couldn't load more comments. Check your connection and try again.