This commit is contained in:
Judah Caruso 2025-06-02 19:52:24 -06:00
parent 85065a23e6
commit 822f5c9ae4
2 changed files with 6 additions and 6 deletions

View file

@ -3,7 +3,6 @@ Interp :: struct {
symbols: kv.Kv(string, *Interp_Value);
toplevel: []*Node;
// stack: [..]*Interp_Value;
}
Interp_Value :: struct {
@ -27,8 +26,6 @@ Interp_Value :: struct {
}
init :: (i: *Interp, allocator: Allocator) {
// i.stack.allocator = allocator;
value_nil = make_interp_value(i, .nil);
value_true = make_interp_value(i, .bool);
@ -56,15 +53,16 @@ interp_program :: (i: *Interp) {
case .print;
print := it.(*Node_Print);
expr := interp_expr(i, print.expr);
basic.assert(expr != null); // @errors
if expr == null continue;
if expr.kind == {
case .none; basic.print("()");
case .none; // do nothing
case .nil; basic.print("nil");
case .bool; basic.print("%", expr.b);
case .int; basic.print("%", expr.i);
case .float; basic.print("%", expr.f);
case .string; basic.print("%", expr.s);
case; basic.assert(false, "unhandled interp value kind: %", expr.kind);
}
basic.print("\n");

View file

@ -5,6 +5,8 @@
#scope_module;
// exported to the entire module since we want these everywhere
mem :: #import "jc/memory";
array :: #import "jc/array";
kv :: #import "jc/kv";