correct bug in brainfuck.py (in function 'interpret') and add full debug support
This commit is contained in:
parent
c97caeee7e
commit
61b4c2cc9c
1 changed files with 11 additions and 0 deletions
11
brainfuck.py
11
brainfuck.py
|
@ -61,7 +61,18 @@ def interpret(prog):
|
|||
if ar[ptr]:
|
||||
index = blocks.pop()
|
||||
continue
|
||||
else:
|
||||
blocks.pop()
|
||||
elif instr == '#':
|
||||
try:
|
||||
if prog[index+1] == '(':
|
||||
index = index+2
|
||||
while prog[index] != ')':
|
||||
print(prog[index],end='',flush=True)
|
||||
index += 1
|
||||
print(' ',end='')
|
||||
except IndexError:
|
||||
pass
|
||||
print(ar, ptr, ar[ptr])
|
||||
|
||||
index += 1
|
||||
|
|
Loading…
Reference in a new issue