-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSBasicCLI.py
More file actions
29 lines (19 loc) · 764 Bytes
/
SBasicCLI.py
File metadata and controls
29 lines (19 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import argparse
from BasicInterpreter import BasicInterpreter
def main():
parser = argparse.ArgumentParser(
prog='SBasic',
description='Sinclair-Spectrum-alike BASIC Interpreter',
epilog='This is not a Sinclair Spectrum emulator, but just a programming tool that resembles how programming was donde these days.')
parser.add_argument("filepath", help="Old-fashioned BASIC program file")
args = parser.parse_args()
if not args.filepath:
parser.print_help()
return
with open(args.filepath) as file:
program = file.readlines()
interpreter = BasicInterpreter()
interpreter.load(program)
interpreter.run()
if __name__ == "__main__":
main()