„compile.py“ löschen
parent
34c4e65af1
commit
f2789e097f
26
compile.py
26
compile.py
|
@ -1,26 +0,0 @@
|
|||
import ast
|
||||
import binarytools
|
||||
code = []
|
||||
class notinlibrary(Exception):
|
||||
pass
|
||||
def tobinary(function):
|
||||
if function in library:
|
||||
temp = library[function[0]]
|
||||
function.remove(function[0])
|
||||
for i in function:
|
||||
temp += binarytools.thing2b(i)
|
||||
return temp
|
||||
else:
|
||||
raise notinlibrary("error: the function {} is not in the library".format(function))
|
||||
library = open("library", 'r')
|
||||
library = library.read()
|
||||
library = ast.literal_eval(library)
|
||||
target = open("target", 'r')
|
||||
target = target.read()
|
||||
code = target.splitlines()
|
||||
for line in code:
|
||||
line = line.split()
|
||||
code.append(tobinary(line))
|
||||
output = open("output.jc", 'w')
|
||||
output.writelines(code)
|
||||
output.close()
|
Loading…
Reference in New Issue