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