-
-
Save hornc/fc0477e7a3321485ef16b4d7c0cd9f38 to your computer and use it in GitHub Desktop.
Brainfoctal Interpreter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Brainfoctal interpreter. | |
# REQUIREMENTS: | |
# python3 to convert | |
# bff4, http://mazonka.com/brainf/bff4.c to interpret, | |
# $BFI should point to the compiled interpreter | |
# USAGE: | |
# ./bf8 <bf8 Gödel number in dec|oct|hex|bin> <input data> | |
# EX. | |
# ./bf8 0o6565 Hi | |
# ./bf8 0xd75 Hi | |
BFI=./bff4 | |
BF="]><+-.,[" | |
BF8PY="""s=oct(int(\"$1\", 0))[2:] | |
for i,c in enumerate(\"$BF\"):s=s.replace(str(i),c) | |
print(s)""" | |
conv=$(python3 -c "$BF8PY");echo $conv | |
if [ -e $BFI ];then $BFI <<<$conv\!$2;echo;fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment