diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2025-01-08 21:32:26 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2025-01-08 21:32:26 +0100 |
commit | 0361b8b891a04cd84189d81a0f1b5f8e512bae7b (patch) | |
tree | 7a8b144b44e9968930bf9ae40f751ec541805541 /src/parser.zig | |
parent | Parser: Prepare for variable statement parsing (diff) | |
download | interpreter-0361b8b891a04cd84189d81a0f1b5f8e512bae7b.tar.gz interpreter-0361b8b891a04cd84189d81a0f1b5f8e512bae7b.tar.bz2 interpreter-0361b8b891a04cd84189d81a0f1b5f8e512bae7b.zip |
Parser: Use arena allocator
Diffstat (limited to 'src/parser.zig')
-rw-r--r-- | src/parser.zig | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/parser.zig b/src/parser.zig index 7fb6372..e855cbd 100644 --- a/src/parser.zig +++ b/src/parser.zig @@ -49,31 +49,6 @@ pub const Parser = struct { return parser; } - //TODO: We maybe should use an arena alocator or smth - pub fn deinit(self: *Parser, ast: ?*Node) void { - if (ast != null) { - std.debug.assert(ast.?.* == .PROGRAM); - for (ast.?.PROGRAM.statements) |statement| { - switch (statement.*) { - .STATEMENT => |x| { - switch (x.statement.*) { - .PRINT_STATEMENT => |p| { - self.allocator.destroy(p.expression); - }, - else => @panic("NOT IMPLEMENTED"), - } - self.allocator.destroy(x.statement); - }, - else => @panic("NOT IMPLEMENTED"), - } - self.allocator.destroy(statement); - } - self.allocator.free(ast.?.PROGRAM.statements); - self.allocator.destroy(ast.?); - } - self.allocator.destroy(self); - } - pub fn parse(self: *Parser) !*Node { return self.parse_program(); } |