//! Front door used by the CLI, the conformance runner and (later) `ajid`: //! parse → verify, collecting diagnostics (spec 07 §8.6). const std = @import("std"); const air = @import("air.zig"); const diag = @import("diag.zig"); const verifier = @import("verifier.zig"); pub const Status = enum { /// Module verified; no error diagnostics. accepted, /// At least one error diagnostic. rejected, /// The pipeline cannot yet decide this input. unimplemented, }; pub const Report = struct { status: Status, diagnostics: []const diag.Diagnostic, /// Present when `status == .accepted`. module: ?air.Module = null, /// Pipeline stage that is missing when `status == .unimplemented`. missing_stage: []const u8 = "", }; /// Checks a text AIR module. All allocations go into `arena`. pub fn checkAir(arena: std.mem.Allocator, file_name: []const u8, source: []const u8) !Report { const parsed = try air.parse.parse(arena, file_name, source); if (parsed.diagnostics.len != 0) return .{ .status = .rejected, .diagnostics = parsed.diagnostics }; const module = parsed.module.?; const ds = try verifier.verify(arena, file_name, module); if (ds.len != 0) return .{ .status = .rejected, .diagnostics = ds }; return .{ .status = .accepted, .diagnostics = &.{}, .module = module }; }