project cleanup

This commit is contained in:
Lorenzo Torres 2025-12-16 23:30:02 +01:00
parent 46e1a1e2ce
commit 3e87a79d94
5 changed files with 202 additions and 77 deletions

View file

@ -30,13 +30,16 @@ pub fn main() !void {
}
const allocator = gpa.allocator();
var lexer = al.Lexer.init(@constCast("3*2+2.2"));
var lexer = try al.Lexer.init(allocator, @constCast("2+3+4"));
var parser = al.Parser.init(allocator, &lexer);
defer parser.deinit();
const graph = try parser.buildGraph();
defer graph.?.deinit(&parser);
std.debug.print("digraph G {{\n", .{});
nodeName(graph.?);
printGraph(graph.?);
std.debug.print("}}\n", .{});
if (graph) |g| {
defer g.deinit(&parser);
std.debug.print("digraph G {{\n", .{});
nodeName(g);
printGraph(g);
std.debug.print("}}\n", .{});
}
}