feat: finished variables declaration / assign
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
#include "common/fzl_opcodes.h"
|
||||
#include <stdio.h>
|
||||
#include <vm/fzl_vm.h>
|
||||
|
||||
void fzl_vm_print_ops(fzl_vm_t *vm)
|
||||
{
|
||||
if (!vm)
|
||||
return;
|
||||
|
||||
if (vm->ops_count < 1)
|
||||
{
|
||||
printf("no opcodes\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < vm->ops_count; i++)
|
||||
{
|
||||
switch (vm->ops[i])
|
||||
{
|
||||
case FZL_OPCODE_LOADCONST:
|
||||
printf("LOADCONST #%lu\n", vm->ops[++i]);
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_CALL_BUILTIN:
|
||||
printf("CALL_BUILTIN #%lu\n", vm->ops[++i]);
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_PUSHNUM:
|
||||
printf("PUSHNUM %lu\n", vm->ops[++i]);
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_MK_ENVTABLE:
|
||||
printf("MK_ENVTABLE\n");
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_RM_ENVTABLE:
|
||||
printf("RM_ENVTABLE\n");
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_STORE:
|
||||
printf("STORE\n");
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_LOOKUP_ENV:
|
||||
printf("LOOKUP_ENV\n");
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_WRITE:
|
||||
printf("WRITE\n");
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_ADD:
|
||||
case FZL_OPCODE_SUB:
|
||||
case FZL_OPCODE_MUL:
|
||||
case FZL_OPCODE_DIV:
|
||||
case FZL_OPCODE_POW:
|
||||
case FZL_OPCODE_MOD:
|
||||
printf("Math opcode\n");
|
||||
break;
|
||||
|
||||
case FZL_OPCODE_NEG:
|
||||
printf("NEG\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unknown");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user