Add interface for Peter Norvig's BASIC.py
This commit is contained in:
parent
2f4b58f358
commit
72c652628b
|
@ -0,0 +1,13 @@
|
|||
# An interface to Peter Norvig's BASIC interpreter.
|
||||
import BASIC,argparse,os.path
|
||||
|
||||
parser = argparse.ArgumentParser(prog="python runBASIC.py",description="An interface to Peter Norvig's BASIC interpreter.")
|
||||
parser.add_argument("program",help="Program to run.")
|
||||
args = parser.parse_args()
|
||||
progpath = os.path.expanduser(args.program)
|
||||
|
||||
if not os.path.exists(progpath):
|
||||
parser.error("file {} does not exist".format(args.program))
|
||||
|
||||
with open(progpath) as f:
|
||||
BASIC.run(f.read())
|
Loading…
Reference in New Issue