1
# An implementation of Dartmouth BASIC (1964)
5
sys.path.insert(0,"../..")
7
if sys.version_info[0] >= 3:
13
filename = "parselog.txt",
16
log = logging.getLogger()
22
# If a filename has been specified, we try to run it.
23
# If a runtime error occurs, we bail out and enter
24
# interactive mode below
25
if len(sys.argv) == 2:
26
data = open(sys.argv[1]).read()
27
prog = basparse.parse(data,debug=log)
28
if not prog: raise SystemExit
29
b = basinterp.BasicInterpreter(prog)
37
b = basinterp.BasicInterpreter({})
39
# Interactive mode. This incrementally adds/deletes statements
40
# from the program stored in the BasicInterpreter object. In
41
# addition, special commands 'NEW','LIST',and 'RUN' are added.
42
# Specifying a line number with no code deletes that line from
47
line = raw_input("[BASIC] ")
52
prog = basparse.parse(line,debug=log)
57
b.add_statements(prog)
65
elif stat[0] == 'LIST':
67
elif stat[0] == 'BLANK':
69
elif stat[0] == 'NEW':