# If a filename has been specified, we try to run it. # If a runtime error occurs, we bail out and enter # interactive mode below if len(sys.argv) == 2:
data = open(sys.argv[1]).read()
prog = basparse.parse(data) ifnot prog: raise SystemExit
b = basinterp.BasicInterpreter(prog) try:
b.run() raise SystemExit except RuntimeError: pass
else:
b = basinterp.BasicInterpreter({})
# Interactive mode. This incrementally adds/deletes statements # from the program stored in the BasicInterpreter object. In # addition, special commands 'NEW','LIST',and 'RUN' are added. # Specifying a line number with no code deletes that line from # the program.
while 1: try:
line = raw_input("[BASIC] ") except EOFError: raise SystemExit ifnot line: continue
line += "\n"
prog = basparse.parse(line) ifnot prog: continue
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.