catseye / Befunge-93

MIRROR of https://codeberg.org/catseye/Befunge-93 : The NEW reference distribution for Befunge-93!
https://catseye.tc/node/Befunge-93
Other
98 stars 9 forks source link

Debugger never leave loops? #27

Closed civrot closed 1 year ago

civrot commented 5 years ago

I just started playing around with befunge I was playing around with the debugger and noticed that it never leaves a loop, even though the code works.

For example, when running the following code in debug mode, the cursor never reaches the end. Is this an issue with the debugger, or is there something I don't understand.

"E">:# ,# _@

cpressey commented 5 years ago

Thanks for the report. I believe the problem is that, by default in debug mode, input and output don't do anything at all - meaning the , leaves the character E on the stack. (and then this test program loops forever because _ never pops a 0.)

I think this is discussed somewhere in #14 and is considered undesirable behaviour of the debugger and it should probably get fixed one day.

In the meantime, there's a simple workaround: use the -w option to send the output somewhere when using the debugger. (Similarly, use -r if the program takes input). For example, I ran your test program with

bef -d -r output.txt test.bf

and the program did terminate correctly.

EDIT: originally I wrote -o and -i for the options to use; they are actually called -w and -r.