const std = @import("std"); const langs = @import("lang.zig"); const runners = @import("runner.zig"); pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.c_allocator); defer arena.deinit(); const allocator = &arena.allocator; var lang = langs.Lang.init(allocator); //defer lang.deinit(); var runner = runners.Runner.init(allocator); defer runner.deinit(); var args_it = std.process.args(); const exe_name = try (args_it.next(allocator) orelse @panic("expected exe name")); // args[1] is the path to scri file const scri_path = try (args_it.next(allocator) orelse @panic("expected scri path")); var file = try std.fs.File.openRead(scri_path); defer file.close(); // sadly, we read it all into memory. such is life const total_bytes = try file.getEndPos(); var data = try allocator.alloc(u8, total_bytes); defer allocator.free(data); _ = try file.read(data); var cmds = try lang.parse(data); defer cmds.deinit(); try runner.runCommands(cmds, true); }