From 54cba4ebb5efa7380a3f52319acf3226092ee55e Mon Sep 17 00:00:00 2001 From: Giovani Date: Tue, 15 Jun 2021 10:57:45 -0400 Subject: [PATCH] feat: add open file logic --- dopey.py | 18 +++++++++++++++++- helloworld.bf | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 helloworld.bf diff --git a/dopey.py b/dopey.py index 998308d..192c453 100644 --- a/dopey.py +++ b/dopey.py @@ -1,3 +1,4 @@ +import sys # create memory buffer BUFFER_SIZE = 30_000 @@ -11,4 +12,19 @@ DECREMENT = "-" OUTPUT = "." INPUT = "," OPEN_LOOP = "[" -CLOSE_LOOP = "]" \ No newline at end of file +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)) + + + diff --git a/helloworld.bf b/helloworld.bf new file mode 100644 index 0000000..929a771 --- /dev/null +++ b/helloworld.bf @@ -0,0 +1,2 @@ +++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.> +---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. \ No newline at end of file