wmww / BrainfuckIDE

A Brainfuck IDE/debugger designed to be intuitive, featureful and visually appealing
MIT License
92 stars 11 forks source link

Hangs when given non-halting programs #1

Open ghost opened 6 years ago

ghost commented 6 years ago

The IDE will hang if told to "skip to end" with a non-halting program.

Example program:

+[>+]

Actions taken: Program input, run. IDE told to "skip to end."

Expected result: IDE stops after program runs too long or otherwise indicates that it cannot be "skipped to end."

Actual result: IDE runs program at high speed, using an entire CPU core. If user attempts to stop program using the "reset everything" button, IDE hangs.

wmww commented 6 years ago

Pull requests welcome, but I probably won't look into this at the moment. There's a lot of improvements I'd like to make, but I haven't been doing much brainfuck development or tooling lately.

wmww commented 6 years ago

It's on the line, but I guess it is a bug.

wmww commented 6 years ago

Hmm... looks like reset hangs even on long programs, like:

load 1000 into position 2
++++++++++
[
    >++++++++++
    [
        >++++++++++
    <-]
<-]

move to position 2
>>

move 1000 spaces to the right
[[>+<-]>-]
wmww commented 6 years ago

Ah, it's a memory issue, not a logic error (as can be seen by +[+] being resetable after clicking 'skip to end' and waiting, and +[>+] being resetable if you click reset within a few moments of 'skip to end' (before the tape gets too long). I tried a simple fix, but it just broke everything. You'll have to wait for #6.