Exemple #1
0
def run_compiled(filename):
    """ Given the name of a compiled Bob file (.bobc), run it with the 
        Bob VM with output redirected to stdout.
    """
    bytecode = open(filename, 'rb').read()
    codeobject = Deserializer().deserialize_bytecode(bytecode)
    vm = BobVM(output_stream=sys.stdout)
    vm.run(codeobject)
def vm_compiler_runner(code, ostream):
    codeobject = compile_code(code)

    # Run the code through (de+)serialization to test how that works 
    # too
    #
    ser = Serializer().serialize_bytecode(codeobject)
    codeobject = Deserializer().deserialize_bytecode(ser)
    vm = BobVM(output_stream=ostream)
    vm.run(codeobject)
Exemple #3
0
def vm_compiler_runner(code, ostream):
    codeobject = compile_code(code)

    # Run the code through (de+)serialization to test how that works
    # too
    #
    ser = Serializer().serialize_bytecode(codeobject)
    codeobject = Deserializer().deserialize_bytecode(ser)
    vm = BobVM(output_stream=ostream)
    vm.run(codeobject)
Exemple #4
0
def vm_compiler_runner(code, ostream):
    codeobject = compile_code(code)
    vm = BobVM(output_stream=ostream)
    vm.run(codeobject)