summary refs log tree commit diff
path: root/src/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main.zig b/src/main.zig
index e7ebba3..da72d72 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -17,8 +17,8 @@ pub fn main() !void {
         if (deinit_status == .leak) @panic("Memory leak detected!");
     }
 
-    const source_evaluator = try evaluator.Evaluator.init(allocator);
-    defer source_evaluator.deinit();
+    // const source_evaluator = try evaluator.Evaluator.init(allocator);
+    // defer source_evaluator.deinit();
 
     var arena = std.heap.ArenaAllocator.init(allocator);
     defer arena.deinit();
@@ -30,7 +30,7 @@ pub fn main() !void {
             const buf = try stdin.readUntilDelimiterAlloc(allocator, '\n', 1024);
             defer allocator.free(buf);
 
-            process_buf(buf, allocator, &arena, source_evaluator) catch |err| {
+            process_buf(buf, allocator, &arena) catch |err| {
                 try stdout.print("Error processing line: {any}\n", .{err});
             };
         }
@@ -39,11 +39,11 @@ pub fn main() !void {
         const file = try std.fs.cwd().openFile(path, .{});
         const buf = try file.readToEndAlloc(allocator, 1 * 1024 * 1024);
         defer allocator.free(buf);
-        try process_buf(buf, allocator, &arena, source_evaluator);
+        try process_buf(buf, allocator, &arena);
     }
 }
 
-fn process_buf(buf: []u8, allocator: std.mem.Allocator, arena: *std.heap.ArenaAllocator, source_evaluator: *evaluator.Evaluator) !void {
+fn process_buf(buf: []u8, allocator: std.mem.Allocator, arena: *std.heap.ArenaAllocator) !void {
     std.debug.print("Buf:\n{s}\n", .{buf});
 
     var token_list = std.ArrayList(tokenizer.Token).init(allocator);
@@ -55,12 +55,12 @@ fn process_buf(buf: []u8, allocator: std.mem.Allocator, arena: *std.heap.ArenaAl
         try token_list.append(token);
     }
 
-    const source_parser = try parser.Parser.init(token_list.items, arena.allocator());
+    const source_parser = try parser.Parser.init(token_list.items, arena);
     const ast = try source_parser.parse();
     std.debug.print("AST: {any}\n", .{ast});
 
-    const result = try source_evaluator.evaluate_ast(ast);
-    std.debug.print("Evaluation result: {any}\n", .{result});
+    // const result = try source_evaluator.evaluate_ast(ast);
+    // std.debug.print("Evaluation result: {any}\n", .{result});
 }
 
 test {