feat: implement objects and classes
This commit is contained in:
+16
-4
@@ -20,15 +20,27 @@ void fzl_vm_print_ops(fzl_vm_t *vm)
|
||||
|
||||
switch (vm->ops[i])
|
||||
{
|
||||
case FZL_OPCODE_ALLOC_OBJECT:
|
||||
printf("ALLOC_OBJECT: %lu fields\n", vm->ops[++i]);
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_GET_FIELD:
|
||||
printf("GET_FIELD #%lu\n", vm->ops[++i]);
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_SET_FIELD:
|
||||
printf("SET_FIELD #%lu\n", vm->ops[++i]);
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_CALL:
|
||||
{
|
||||
size_t ip = vm->ops[++i];
|
||||
printf("Call IP: %lu\n", ip);
|
||||
printf("CALL IP: %lu\n", ip);
|
||||
break;
|
||||
}
|
||||
|
||||
case FZL_OPCODE_RET:
|
||||
printf("Return\n");
|
||||
printf("RET\n");
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_LOADCONST:
|
||||
@@ -77,7 +89,7 @@ void fzl_vm_print_ops(fzl_vm_t *vm)
|
||||
case FZL_OPCODE_DIV:
|
||||
case FZL_OPCODE_POW:
|
||||
case FZL_OPCODE_MOD:
|
||||
printf("Math opcode\n");
|
||||
printf("MATH\n");
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_AND:
|
||||
@@ -129,7 +141,7 @@ void fzl_vm_print_ops(fzl_vm_t *vm)
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("<Unknown>\n");
|
||||
printf("<UNKNOWN>\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user