The debugger works!!
After hours of work (mainly debugging and patching up code), it finally works! :DD
The power of the debugger
You can use the debugger to step forward and backward in your brainf*ck program. While stepping, a live program counter display (labelled “PC”) shows the current program counter index, while the tape in the bottom panel shows the current state of each cell, which cell is currently selected by the data pointer and what the cell contains, in both decimal and ASCII format.
The following is just for if you’re interested in the technical details ;)
Why I wanted to wipe my drive several times while making this (Problem 1)
The first main problem in writing the debugger was stepping backward. You’d think its just “do the instruction in reverse, like when you back-step a -, just do a + instead” but the problem arises when, for example, you read in something using , and the info got overwritten. How do you reverse to something that got destroyed? Well, you don’t.
The Solution to the Back-Stepping problem
I implemented backward stepping by just recomputing the entire tape from scratch on every backstep. Yes, it’s probably not the best way, but it works.
Problem 2
Loops. Once. Again.
The jumping around of loops in brainf*ck is not the simplest thing to correctly compute, especially when only partially executing a program.
When you land on a [ or a ], you also need to account for nested loops. You can probably imagine that that can definitely cause some headaches.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.