Example #1
0
except IndexError:
    example_usage('improper arguments')

if '.vm' in input:
    if input in os.listdir():
        vm_files = [input]
    else:
        example_usage('file not found')
else:
    if input in os.getcwd():
        vm_files = get_all_VM_files(os.getcwd())
        if len(vm_files) == 0:
            example_usage('no vm files found')
    else:
        try:
            os.chdir(input)
            vm_files = get_all_VM_files(os.getcwd())
            if len(vm_files) == 0:
                example_usage('no vm files in specified directory')
        except FileNotFoundError:
            example_usage('no such directory')

# create a CodeWriter instance
cw = CodeWriter(vm_files, output, boot)

# perform translation
cw.translate()

# close the output of the CodeWriter
cw.close()