Equal bugfix
This commit is contained in:
18
src/main.py
18
src/main.py
@@ -20,7 +20,6 @@ def find_file(filename, root_dir):
|
|||||||
if filename in filenames:
|
if filename in filenames:
|
||||||
return os.path.join(dirpath, filename)
|
return os.path.join(dirpath, filename)
|
||||||
return None
|
return None
|
||||||
print(var[1])
|
|
||||||
|
|
||||||
def removeChar(str, char):
|
def removeChar(str, char):
|
||||||
ans = ""
|
ans = ""
|
||||||
@@ -53,6 +52,7 @@ def filewrite():
|
|||||||
with open(argv[2], "w") as file:
|
with open(argv[2], "w") as file:
|
||||||
file.write(bfcode)
|
file.write(bfcode)
|
||||||
|
|
||||||
|
filewrite()
|
||||||
for i in file:
|
for i in file:
|
||||||
while (i[0] == " "):
|
while (i[0] == " "):
|
||||||
i = i.split(" ", 1)[1]
|
i = i.split(" ", 1)[1]
|
||||||
@@ -297,8 +297,11 @@ for i in file:
|
|||||||
bfcode += "<" + "<<" * (idx1+1) + ">[" + ">>" * (idx1+1) + "+" + "<<" * (idx1+1) + "-]"
|
bfcode += "<" + "<<" * (idx1+1) + ">[" + ">>" * (idx1+1) + "+" + "<<" * (idx1+1) + "-]"
|
||||||
|
|
||||||
# Move copy to start
|
# Move copy to start
|
||||||
print(var1)
|
bfcode += "<["
|
||||||
bfcode += "<[" + "[<<]<<" * (var1) + "+>>>>" + "[>>]>>" * (var1-1) + ">>" * varbytes[var1-1] + "-]"
|
if (var1 > 0):
|
||||||
|
bfcode += "[<<]<<" * (var1) + "+>>>>" + "[>>]>>" * (var1-1) + ">>" * varbytes[var1-1] + "-]"
|
||||||
|
else:
|
||||||
|
bfcode += "[<<+>>-]]"
|
||||||
bfcode += "<<" + "[<<]<<" * (var1) + "[<<<<<<<<+>>>>>>>>-]<<<<<<<<"
|
bfcode += "<<" + "[<<]<<" * (var1) + "[<<<<<<<<+>>>>>>>>-]<<<<<<<<"
|
||||||
|
|
||||||
# Get second data by copying the above
|
# Get second data by copying the above
|
||||||
@@ -307,10 +310,12 @@ for i in file:
|
|||||||
bfcode += ">>" * idx2 + ">"
|
bfcode += ">>" * idx2 + ">"
|
||||||
bfcode += "[<" + "<<" * (idx2+1) + "+>+>" + ">>" * idx2 + ">-]"
|
bfcode += "[<" + "<<" * (idx2+1) + "+>+>" + ">>" * idx2 + ">-]"
|
||||||
bfcode += "<" + "<<" * (idx2+1) + ">[" + ">>" * (idx2+1) + "+" + "<<" * (idx2+1) + "-]"
|
bfcode += "<" + "<<" * (idx2+1) + ">[" + ">>" * (idx2+1) + "+" + "<<" * (idx2+1) + "-]"
|
||||||
bfcode += "<[" + "[<<]<<" * (var2) + "+>>>>" + "[>>]>>" * (var2-1) + ">>" * varbytes[var2-1] + "-]"
|
bfcode += "<["
|
||||||
|
if (var2 > 0):
|
||||||
|
bfcode += "[<<]<<" * (var2) + "+>>>>" + "[>>]>>" * (var2-1) + ">>" * varbytes[var2-1] + "-]"
|
||||||
|
else:
|
||||||
|
bfcode += "[<<+>>-]"
|
||||||
bfcode += "<<" + "[<<]<<" * (var2) + "[<<<<<<<+>>>>>>>-]<<<<<<<"
|
bfcode += "<<" + "[<<]<<" * (var2) + "[<<<<<<<+>>>>>>>-]<<<<<<<"
|
||||||
|
|
||||||
# Check if they are equal
|
|
||||||
bfcode += "[<->-]+<[>-]>[>]<<[-]>[<+>-]<"
|
bfcode += "[<->-]+<[>-]>[>]<<[-]>[<+>-]<"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -331,7 +336,6 @@ for i in file:
|
|||||||
|
|
||||||
# No command
|
# No command
|
||||||
elif ((i != "\n") & (i != "")):
|
elif ((i != "\n") & (i != "")):
|
||||||
print(i)
|
|
||||||
raise ValueError(f"Invalid Command")
|
raise ValueError(f"Invalid Command")
|
||||||
|
|
||||||
print("Successfully compiled!")
|
print("Successfully compiled!")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
create buffer *1 = true
|
create var *1 = "H"
|
||||||
create var *5 = "Hello"
|
create in *1 = "A"
|
||||||
input str *5 = string *5
|
|
||||||
if var[1] == var[2] {
|
if var[0] == in[0] {
|
||||||
set buffer = false
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user