summary refs log tree commit diff
path: root/src/main.zig
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-08 21:32:26 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-08 21:32:26 +0100
commit0361b8b891a04cd84189d81a0f1b5f8e512bae7b (patch)
tree7a8b144b44e9968930bf9ae40f751ec541805541 /src/main.zig
parentParser: Prepare for variable statement parsing (diff)
downloadinterpreter-0361b8b891a04cd84189d81a0f1b5f8e512bae7b.tar.gz
interpreter-0361b8b891a04cd84189d81a0f1b5f8e512bae7b.tar.bz2
interpreter-0361b8b891a04cd84189d81a0f1b5f8e512bae7b.zip
Parser: Use arena allocator
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig
index 86ba202..e6de7f9 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -49,10 +49,10 @@ fn process_buf(buf: []u8, allocator: std.mem.Allocator) !void {
         std.debug.print("{any}\n", .{token});
     }
 
-    const source_parser = try parser.Parser.init(token_list.items, allocator);
-    errdefer source_parser.deinit(null);
+    var arena = std.heap.ArenaAllocator.init(allocator);
+    const source_parser = try parser.Parser.init(token_list.items, arena.allocator());
+    defer arena.deinit();
     const ast = try source_parser.parse();
-    defer source_parser.deinit(@constCast(ast));
     std.debug.print("AST: {any}\n", .{ast});
 }