aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/main.zig b/src/main.zig
index 48637c2..314459b 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -21,8 +21,6 @@ pub fn main() !void {
std.io.getStdOut();
const run = if (args.next()) |arg| std.mem.eql(u8, arg, "run") else false;
- const output = out_file.writer();
-
// var br = std.io.bufferedReader(std.io.getStdIn().reader());
// const stdin = br.reader();
//
@@ -40,11 +38,11 @@ pub fn main() !void {
\\{
\\ let x = 10
\\ if x {
- \\ let x = read_int(0)
+ \\ # let x = read_int(0)
\\ # print(18446744073709551615)
- \\ # print(x + x)
+ \\ x = x + x
\\ } else {
- \\ print(10)
+ \\ x = 69
\\ }
\\ print(x)
\\}
@@ -63,16 +61,16 @@ pub fn main() !void {
std.debug.print("Unexpected token {}, expected end of file\n", .{lexer.next()});
}
const procedure = try compile.compile(allocator, source, ast);
- std.debug.print("Bytecode instructions:\n", .{});
- for (procedure.blocks, 0..) |block, i| {
- std.debug.print(" ${}:\n", .{i});
- for (block.instrs.items) |instr| {
- std.debug.print(" {}\n", .{instr});
- }
- }
+ std.debug.print("Bytecode instructions:\n{}", .{procedure});
+ // for (procedure.blocks, 0..) |block, i| {
+ // std.debug.print(" ${}:\n", .{i});
+ // for (block.instrs.items) |instr| {
+ // std.debug.print(" {}\n", .{instr});
+ // }
+ // }
// std.debug.print("Last use of each virtual register: {}\n", .{fmtHashMap(block.vreg_last_use)});
- const elf = try codegen.create_elf(allocator, procedure);
- try output.writeAll(elf);
+ // const elf = try codegen.create_elf(allocator, procedure);
+ // try out_file.writer().writeAll(elf);
std.debug.print("Run output:\n", .{});
if (run) {
out_file.close();