Set, add, remove bytes

This commit is contained in:
2025-10-11 18:07:46 +11:00
parent 74494711f6
commit 333a1241e8
2 changed files with 24 additions and 2 deletions

View File

@@ -241,12 +241,34 @@ for i in file:
else:
raise TypeError("Could not find variable type")
bfcode += "<<[[<<]<<]<<<<<<<<"
elif "+=" in i:
if a.split("[")[0] in variables:
var = a.split("[")[0]
idx = int(a.split("[")[1].split("]")[0])
bfcode += ">>>>>>>>>>>>" + "[>>]>>" * variables.index(var) + ">>" * idx + ">"
bfcode += "+" * int(removeChar(i.split("+=")[1], " "))
bfcode += "<[[<<]<<]<<<<<<<<"
else:
raise NameError(f"Could not find variable {a.split("[")[0]}")
elif "-=" in i:
if a.split("[")[0] in variables:
var = a.split("[")[0]
idx = int(a.split("[")[1].split("]")[0])
bfcode += ">>>>>>>>>>>>" + "[>>]>>" * variables.index(var) + ">>" * idx + ">"
bfcode += "-" * int(removeChar(i.split("-=")[1], " "))
bfcode += "<[[<<]<<]<<<<<<<<"
else:
raise NameError(f"Could not find variable {a.split("[")[0]}")
elif "=" in i:
if a.split("[")[0] in variables:
var = a.split("[")[0]
idx = int(a.split("[")[1].split("]")[0])
bfcode += ">>>>>>>>>>>>" + "[>>]>>" * variables.index(var) + ">>" * idx + ">"
bfcode += "[-]" + "+" * ord(i.split("=", 1)[1].split("\"")[1])
if "\"" in i:
replace = ord(i.split("=", 1)[1].split("\"")[1])
else:
replace = int(i.split("=", 1)[1].lstrip().rstrip())
bfcode += "[-]" + "+" * replace
bfcode += "<[[<<]<<]<<<<<<<<"
else:
raise NameError(f"Could not find variable {a.split("[")[0]}")

View File

@@ -1,4 +1,4 @@
create var *5 = "Hello"
create var2 *5 = "World"
set var[1] = "E"
set var2[2] = "R"
set var2[2] -= 1