feat: implement objects and classes

This commit is contained in:
samsonium
2026-10-16 18:11:28 +03:00
parent 683dd08181
commit bc5d887ec4
22 changed files with 848 additions and 116 deletions
+16 -4
View File
@@ -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");
}
}
}