Last active
August 13, 2022 21:48
-
-
Save malted/7461a591d9b0566276ce6bc6d2f21d1a to your computer and use it in GitHub Desktop.
A minifier for Brainfuck scripts.
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
import sys | |
def main(): | |
min_file_name = sys.argv[1].split('.') | |
min_file_name.insert(len(sys.argv) - 1, "min") | |
min_file_name = '.'.join(min_file_name) | |
with open(min_file_name, "w+") as min_file: | |
final = "" | |
with open(sys.argv[1]) as src_file: | |
for c in src_file.read(): | |
if c in "<>.,+-[]": | |
final += c | |
min_file.write(final) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment