def main(): """ Print lines of input along with output. """ opts, args = parse_args(sys.argv) runtime.init(args, opts) console = runtime.state source_lines = (line.rstrip() for line in sys.stdin) source = "" try: while True: source = source_lines.next() print "mio>", source more = console.runsource(source) while more: next_line = source_lines.next() print "....", next_line source += "\n" + next_line more = console.runsource(source) except StopIteration: if more: print ".... " more = console.runsource(source + "\n")
def main(argv): try: opts, args = parse_args(argv) runtime.init(args, opts) if opts.eval: runtime.state.eval(opts.eval) elif args: runtime.state.load(args[0]) if opts.inspect: runtime.state.repl() else: runtime.state.repl() except SystemExit as e: return e[0]
#!/usr/bin/python -i import sys from mio import lexer from mio import parser from mio import runtime from mio.main import parse_args opts, args = parse_args(sys.argv) runtime.init(args, opts) eval = runtime.state.eval def parse(s): return parser.parse(lexer.tokenize(s))
def mio(request): runtime.init() return runtime.state
#!/usr/bin/env python import hotshot import hotshot.stats from mio import runtime runtime.init() runtime.state.load("fact.mio") profiler = hotshot.Profile("fact.profile") profiler.start() for i in xrange(100): runtime.state.eval("10 fact()") profiler.stop() profiler.close() stats = hotshot.stats.load("fact.profile") stats.strip_dirs() stats.sort_stats("time", "calls") stats.print_stats(20)