1
0
Fork 0
forked from fun/fun

Added line numbers to debug and error output.

This commit is contained in:
Johannes Findeisen 2025-09-16 11:23:42 +02:00
commit 6b14c2776e
6 changed files with 52 additions and 3 deletions

View file

@ -32,6 +32,7 @@ static const char *opcode_names[] = {
"LOAD_GLOBAL","STORE_GLOBAL","ADD","SUB","MUL","DIV",
"LT","LTE","GT","GTE","EQ","NEQ","POP","JUMP",
"JUMP_IF_FALSE","CALL","RETURN","PRINT","HALT",
"LINE",
"MOD","AND","OR","NOT","DUP","SWAP",
"MAKE_ARRAY","INDEX_GET","INDEX_SET",
"LEN","PUSH","APOP","SET","INSERT","REMOVE","SLICE",
@ -63,6 +64,8 @@ typedef struct {
int output_count;
long long instr_count; // executed instructions in the last vm_run
int current_line; // last executed source line (debug)
} VM;
// initialize VM (zero state)