desguar += and -=

This commit is contained in:
2026-06-06 18:53:11 +02:00
parent 535364931e
commit 22874181cd
32 changed files with 185 additions and 146 deletions

View File

@@ -12,38 +12,38 @@ func main[] : i64
op := src[i]
if op == '>'
p = p + 1
p += 1
else if op == '<'
p = p - 1
p -= 1
else if op == '+'
memory[p] = memory[p] + 1
memory[p] += 1
else if op == '-'
memory[p] = memory[p] - 1
memory[p] -= 1
else if op == '.'
io.print_char(memory[p])
else if op == ','
memory[p] = io.read_char()
else if op == '['
if !memory[p]
i = i + 1
i += 1
opened := 0
while i < src_len && !(src[i] == ']' && !opened)
if src[i] == '['
opened = opened + 1
opened += 1
else if src[i] == ']'
opened = opened - 1
i = i + 1
opened -= 1
i += 1
else if op == ']'
if memory[p]
i = i - 1
i -= 1
closed := 0
while i >= 0 && !(src[i] == '[' && !closed)
if src[i] == ']'
closed = closed + 1
closed += 1
else if src[i] == '['
closed = closed - 1
i = i - 1
closed -= 1
i -= 1
i = i + 1
i += 1
mem.free(memory)