aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/jq/execute.zig
blob: 9857d461de4ee44b1e7cc8e53badaca386b7b253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const std = @import("std");
const jv = @import("../jv.zig");
const Instr = @import("./compile.zig").Instr;

pub const ExecuteError = error{
    Unimplemented,
};

pub fn execute(allocator: std.mem.Allocator, instrs: []const Instr, input: jv.Value) !jv.Value {
    _ = allocator;
    const len = instrs.len;
    var pc: usize = 0;
    while (pc < len) {
        const cur = instrs[pc];
        _ = switch (cur.op) {
            .nop => void,
            .identity => return input,
        };
        pc += 1;
    }
    return ExecuteError.Unimplemented;
}