3 ms·
You made my day. Though an explanation would help understanding it. For the commonfolk like me.
by kronos29296 9y ago
You made my day. Though an explanation would help understanding it. For the commonfolk like me.
- SonOfLilit 9y agoI suggest you first try to follow it yourself, maybe copy and play with A1 and see what happens, maybe copy aside parts of the formulas and see what they output. Then you can read the writeup I wrote in response to another commenter (the guy who wrote the original Apps Script VM).
- eatonphil 9y agoBrainfuck is a stack-based language with only 6-8? syntactic elements for manipulating the stack. + increments the current stack element, - decrements it. > increases the stack pointer and < decreases it. [ and ] have to with conditional jumping I believe. And it is common to convert the elements in the stack to ascii characters to display a result. 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.
- SonOfLilit 9y agoYou got it basically right, a few small corrections: 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!
- eatonphil 9y agoAh. I thought "." must be printing (as it's something similar to that in Forth [guess it's ".s" though not "."]), but I was confused by the comma because I didn't understand how you'd be reading from stdin here. Actually I'm still confused. What are you reading in?
- SonOfLilit 9y agoA2
- fasquoika 9y ago`.` in Forth is to pop a number and print it, `.s` is to print the whole stack non-destructively