Better brainfuck compille
This commit is contained in:
@@ -24,14 +24,11 @@ class BrainFuckByteCodeCompiler:
|
|||||||
self.source_data: bytearray = data
|
self.source_data: bytearray = data
|
||||||
|
|
||||||
def compile(self) -> bytearray:
|
def compile(self) -> bytearray:
|
||||||
# whitespace_b = whitespace.encode()
|
return bytearray(
|
||||||
valid_b = set(ord(s) for s in BrainFuckByteCode.keys())
|
BrainFuckByteCode[c]
|
||||||
self.source_data = bytearray(b for b in self.source_data if b in valid_b)
|
for byte in self.source_data
|
||||||
|
if (c := chr(byte)) in BrainFuckByteCode
|
||||||
out = bytearray()
|
)
|
||||||
for byte in self.source_data:
|
|
||||||
out.append(BrainFuckByteCode[chr(byte)])
|
|
||||||
return out
|
|
||||||
|
|
||||||
|
|
||||||
class BrainFuckEnterpreter(Enterpreter):
|
class BrainFuckEnterpreter(Enterpreter):
|
||||||
|
|||||||
Reference in New Issue
Block a user