Пример #1
0
 def driver():
     bench = Benchmark()
     while 1:
         res = tlr.interpret(tlr.SQUARE, 1764)
         if bench.stop():
             break
     return res
Пример #2
0
def entry_point(args):
    """Main entry point of the stand-alone executable:
    takes a list of strings and returns the exit code.
    """
    # store args[0] in a place where the JIT log can find it (used by
    # viewcode.py to know the executable whose symbols it should display)
    highleveljitinfo.sys_executable = args[0]
    if len(args) < 3:
        print "Usage: %s filename x" % (args[0],)
        return 2
    filename = args[1]
    x = int(args[2])
    bytecode = load_bytecode(filename)
    res = interpret(bytecode, x)
    print res
    return 0
Пример #3
0
def entry_point(args):
    """Main entry point of the stand-alone executable:
    takes a list of strings and returns the exit code.
    """
    # store args[0] in a place where the JIT log can find it (used by
    # viewcode.py to know the executable whose symbols it should display)
    highleveljitinfo.sys_executable = args[0]
    if len(args) < 3:
        print "Usage: %s filename x" % (args[0], )
        return 2
    filename = args[1]
    x = int(args[2])
    bytecode = load_bytecode(filename)
    res = interpret(bytecode, x)
    print res
    return 0
Пример #4
0
 def test_square(self):
     assert tlr.interpret(tlr.SQUARE, 1) == 1
     assert tlr.interpret(tlr.SQUARE, 7) == 49
     assert tlr.interpret(tlr.SQUARE, 9) == 81
Пример #5
0
 def main(n, a):
     code = codes[n]
     return interpret(code, a)