other stuff idk
This commit is contained in:
parent
a4f175ac61
commit
a521a0f18a
1 changed files with 0 additions and 18 deletions
18
bf.zig
18
bf.zig
|
@ -24,8 +24,6 @@ const Level1 = union(enum) {
|
||||||
loop_end: u24,
|
loop_end: u24,
|
||||||
|
|
||||||
zero,
|
zero,
|
||||||
find_zero_left,
|
|
||||||
find_zero_right,
|
|
||||||
|
|
||||||
const Self = @This();
|
const Self = @This();
|
||||||
|
|
||||||
|
@ -59,8 +57,6 @@ const Level1 = union(enum) {
|
||||||
.loop_start => |n| try writer.print("JEZ {d:0>4}", .{n}),
|
.loop_start => |n| try writer.print("JEZ {d:0>4}", .{n}),
|
||||||
.loop_end => |n| try writer.print("JNZ {d:0>4}", .{n}),
|
.loop_end => |n| try writer.print("JNZ {d:0>4}", .{n}),
|
||||||
.zero => try writer.print("ZER ", .{}),
|
.zero => try writer.print("ZER ", .{}),
|
||||||
.find_zero_left => try writer.print("FZL ", .{}),
|
|
||||||
.find_zero_right => try writer.print("FZR ", .{}),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -113,10 +109,6 @@ fn compileLevel1(allocator: mem.Allocator, src: []const u8) !ArrayList(Level1) {
|
||||||
try out.append(.zero);
|
try out.append(.zero);
|
||||||
skip = 2;
|
skip = 2;
|
||||||
cur = Level1.nothing();
|
cur = Level1.nothing();
|
||||||
} else if ((src[i + 1] == '>' or src[i + 1] == '<') and src[i + 2] == ']') {
|
|
||||||
try out.append(if (src[i + 1] == '>') .find_zero_right else .find_zero_left);
|
|
||||||
skip = 2;
|
|
||||||
cur = Level1.nothing();
|
|
||||||
} else {
|
} else {
|
||||||
cur = .{ .loop_start = 0 };
|
cur = .{ .loop_start = 0 };
|
||||||
try openers.append(@as(u24, @truncate(out.items.len)));
|
try openers.append(@as(u24, @truncate(out.items.len)));
|
||||||
|
@ -318,16 +310,6 @@ pub fn main() !void {
|
||||||
if (memory[mp] != 0) ip = new_ip;
|
if (memory[mp] != 0) ip = new_ip;
|
||||||
},
|
},
|
||||||
.zero => memory[mp] = 0,
|
.zero => memory[mp] = 0,
|
||||||
.find_zero_right => {
|
|
||||||
while (memory[mp] != 0) {
|
|
||||||
mp +%= 1;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
.find_zero_left => {
|
|
||||||
while (memory[mp] != 0) {
|
|
||||||
mp -%= 1;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
ip += 1;
|
ip += 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue