import sys from pathlib import Path from .executer import Interpreter, InterpreterError def main(): try: scri_path = Path(sys.argv[1]).resolve() except IndexError: print(f'usage: {sys.argv[0]} path/to/file.scri') return full_text = scri_path.read_text() full_text = full_text.replace('\n', '') stmts = full_text.split(';') interp = Interpreter() try: for stmt in stmts: if not stmt: continue interp.run(stmt) print('OK') except InterpreterError as err: print(f'Interpreter error. {err.args[0]!r}')