def decompile_file(inputfile, outputfile): tifile = TIPrgmFile(inputfile) compiler = PrgmCompiler() decompiled = compiler.decompile(tifile) if outputfile == 'stdout': print("\n".join(decompiled)) else: with open(outputfile, 'w') as out: for line in decompiled: out.write(line+"\n")
def decompile_file(inputfile, outputfile): tifile = TIPrgmFile(inputfile) compiler = PrgmCompiler() decompiled = compiler.decompile(tifile) if outputfile == 'stdout': print("\n".join(decompiled)) else: with open(outputfile, 'w') as out: for line in decompiled: out.write(line + "\n")
def compile_file(inputfile, outputfile): file_lines = [] with open(inputfile, 'r') as f: for line in f: file_lines.append(line) compiler = PrgmCompiler() compiled_file = compiler.compile(file_lines) if outputfile == "stdout": print("".join(compiled_file.prgmdata)) else: compiled_file.writeOut(outputfile)