feat: add open file logic

This commit is contained in:
2021-06-15 10:57:45 -04:00
parent 3112dd5714
commit 54cba4ebb5
2 changed files with 19 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
import sys
# create memory buffer
BUFFER_SIZE = 30_000
@@ -11,4 +12,19 @@ DECREMENT = "-"
OUTPUT = "."
INPUT = ","
OPEN_LOOP = "["
CLOSE_LOOP = "]"
CLOSE_LOOP = "]"
# get bf file location
file_location = None
if len(sys.argv) != 2:
print("Invalid or missing arguments...")
sys.exit()
else:
file_location = sys.argv[1]
# open file
file = open(file_location, "r")
print(file.read(1))

2
helloworld.bf Normal file
View File

@@ -0,0 +1,2 @@
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>
---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.