Skip to main content
Fixed problem where input was not handled correctly during execution
Source Link

Python 3.8 (pre-release), 245 237237 247 bytes

-8 bytes thanks to Jo King

+10 bytes because input wasn't handled correctly

from sys import*
i,n,*a=[0]*30002
exec('\n'.join([((i:=i+(v:=s=='[')-(s==']'))-v)*' '+'while(a[n]): 0 n-=1 n+=1 a[n]+=1 a[n]-=1 a[n]=ord(stdin.read(1)) print(end=chr(a[n]))'.split()[u.index(s)]for s in open(argv[1]).read()if s in(u:='[]<>+-,.')]))

Try it online!Try it online!

Compiles bf source code to python and execs.

Python 3.8 (pre-release), 245 237 bytes

-8 bytes thanks to Jo King

from sys import*
i,n,*a=[0]*30002
exec('\n'.join([((i:=i+(v:=s=='[')-(s==']'))-v)*' '+'while(a[n]): 0 n-=1 n+=1 a[n]+=1 a[n]-=1 stdin.read(1) print(end=chr(a[n]))'.split()[u.index(s)]for s in open(argv[1]).read()if s in(u:='[]<>+-,.')]))

Try it online!

Compiles bf source code to python and execs.

Python 3.8 (pre-release), 245 237 247 bytes

-8 bytes thanks to Jo King

+10 bytes because input wasn't handled correctly

from sys import*
i,n,*a=[0]*30002
exec('\n'.join([((i:=i+(v:=s=='[')-(s==']'))-v)*' '+'while(a[n]): 0 n-=1 n+=1 a[n]+=1 a[n]-=1 a[n]=ord(stdin.read(1)) print(end=chr(a[n]))'.split()[u.index(s)]for s in open(argv[1]).read()if s in(u:='[]<>+-,.')]))

Try it online!

Compiles bf source code to python and execs.

shaved off 8 bytes
Source Link

Python 3.8 (pre-release), 245245 237 bytes

-8 bytes thanks to Jo King

from sys import*
i=0
n=0
a=[0]*30000i,n,*a=[0]*30002
exec('\n'.join([((i:=i+(v:=s=='[')-(s==']'))-v)*' '+'while (a[n]):^0^n 0 n-=1^n+=1^a[n]+=1^a[n]=1 n+=1 a[n]+=1 a[n]-=1^stdin=1 stdin.read(1)^print print(chrend=chr(a[n]),end="")'.split('^')[u.index(s)]for s in open(argv[1]).read()if s in(u:='[]<>+-,.')]))

Try it online!Try it online!

Compiles bf source code to python and execs.

Python 3.8 (pre-release), 245 bytes

from sys import*
i=0
n=0
a=[0]*30000
exec('\n'.join([((i:=i+(v:=s=='[')-(s==']'))-v)*' '+'while a[n]:^0^n-=1^n+=1^a[n]+=1^a[n]-=1^stdin.read(1)^print(chr(a[n]),end="")'.split('^')[u.index(s)]for s in open(argv[1]).read()if s in(u:='[]<>+-,.')]))

Try it online!

Compiles bf source code to python and execs.

Python 3.8 (pre-release), 245 237 bytes

-8 bytes thanks to Jo King

from sys import*
i,n,*a=[0]*30002
exec('\n'.join([((i:=i+(v:=s=='[')-(s==']'))-v)*' '+'while(a[n]): 0 n-=1 n+=1 a[n]+=1 a[n]-=1 stdin.read(1) print(end=chr(a[n]))'.split()[u.index(s)]for s in open(argv[1]).read()if s in(u:='[]<>+-,.')]))

Try it online!

Compiles bf source code to python and execs.

Source Link

Python 3.8 (pre-release), 245 bytes

from sys import*
i=0
n=0
a=[0]*30000
exec('\n'.join([((i:=i+(v:=s=='[')-(s==']'))-v)*' '+'while a[n]:^0^n-=1^n+=1^a[n]+=1^a[n]-=1^stdin.read(1)^print(chr(a[n]),end="")'.split('^')[u.index(s)]for s in open(argv[1]).read()if s in(u:='[]<>+-,.')]))

Try it online!

Compiles bf source code to python and execs.