1
0
Fork 0
forked from fun/fun

Added to_string() and to_number() functions as built-ins.

This commit is contained in:
Johannes Findeisen 2025-09-15 03:45:26 +02:00
commit 559400a866
11 changed files with 113 additions and 3 deletions

View file

@ -16,7 +16,8 @@ static const char *opcode_names[] = {
"JUMP_IF_FALSE","CALL","RETURN","PRINT","HALT",
"MOD","AND","OR","NOT","DUP","SWAP",
"MAKE_ARRAY","INDEX_GET","INDEX_SET",
"LEN","ARR_PUSH","ARR_POP","ARR_SET","ARR_INSERT","ARR_REMOVE","SLICE"
"LEN","ARR_PUSH","ARR_POP","ARR_SET","ARR_INSERT","ARR_REMOVE","SLICE",
"TO_NUMBER","TO_STRING"
};
typedef struct {
@ -57,7 +58,7 @@ void vm_dump_globals(VM *vm);
void vm_run(VM *vm, Bytecode *entry);
static inline int opcode_is_valid(int op) {
return op >= OP_NOP && op <= OP_SLICE; // all current opcodes
return op >= OP_NOP && op <= OP_TO_STRING; // all current opcodes
}
#endif