diff options
Diffstat (limited to 'src/bytecode/main.c')
-rw-r--r-- | src/bytecode/main.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/bytecode/main.c b/src/bytecode/main.c index 5081d95..66089c0 100644 --- a/src/bytecode/main.c +++ b/src/bytecode/main.c | |||
@@ -38,10 +38,16 @@ process_source(const StringView *source) { | |||
38 | return; | 38 | return; |
39 | } | 39 | } |
40 | 40 | ||
41 | // Push some test instructions. | 41 | size_t const_a = add_constant(vm.chunk, 7); |
42 | size_t const_idx = add_constant(vm.chunk, 7); | ||
43 | add_code(vm.chunk, OP_CONSTANT, 1, 1); | 42 | add_code(vm.chunk, OP_CONSTANT, 1, 1); |
44 | add_code(vm.chunk, const_idx, 1, 1); | 43 | add_code(vm.chunk, const_a, 1, 1); |
44 | size_t const_b = add_constant(vm.chunk, 2); | ||
45 | add_code(vm.chunk, OP_CONSTANT, 1, 2); | ||
46 | add_code(vm.chunk, const_b, 1, 2); | ||
47 | |||
48 | // Arithmetic. | ||
49 | add_code(vm.chunk, OP_MOD, 1, 3); | ||
50 | |||
45 | add_code(vm.chunk, OP_RETURN, 1, 1); | 51 | add_code(vm.chunk, OP_RETURN, 1, 1); |
46 | 52 | ||
47 | vm_interpret(vm); | 53 | vm_interpret(vm); |