desguar += and -=
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user