#include #include "val.h" void print_val(Val v) { switch (v.ty) { case TY_NIL: printf("nil"); break; case TY_NUM: printf("%f",AS_NUM(v)); break; case TY_BOOL: printf("%s",AS_BOOL(v) ? "true" : "false"); break; } } void println_val(Val v) { print_val(v); putchar('\n'); } static const char *ty_names[] = { "nil", "num", "bool", }; const char *valty_str(ValTy ty) { return ty_names[ty]; }