1 # An implementation of Dartmouth BASIC (1964)
5 sys
.path
.insert(0,"../..")
11 # If a filename has been specified, we try to run it.
12 # If a runtime error occurs, we bail out and enter
13 # interactive mode below
14 if len(sys
.argv
) == 2:
15 data
= open(sys
.argv
[1]).read()
16 prog
= basparse
.parse(data
)
17 if not prog
: raise SystemExit
18 b
= basinterp
.BasicInterpreter(prog
)
26 b
= basinterp
.BasicInterpreter({})
28 # Interactive mode. This incrementally adds/deletes statements
29 # from the program stored in the BasicInterpreter object. In
30 # addition, special commands 'NEW','LIST',and 'RUN' are added.
31 # Specifying a line number with no code deletes that line from
36 line
= raw_input("[BASIC] ")
41 prog
= basparse
.parse(line
)
46 b
.add_statements(prog
)
54 elif stat
[0] == 'LIST':
56 elif stat
[0] == 'BLANK':
58 elif stat
[0] == 'NEW':