Added table support to the parser

a new instruction, OP_NEWARRAY has been added. this instruction will create a table out of the uint16_t values on the stack, with incremental keys [0-(u16-1)]
This commit is contained in:
2021-01-08 22:47:36 -06:00
parent 824c0e89b9
commit 75b571c09a
4 changed files with 45 additions and 2 deletions

View File

@@ -125,6 +125,8 @@ int disasmInstr(CChunk *chunk, int offset, int indent) {
return simpleInstruction("OP_CLOSE", offset);
case OP_NEWTABLE:
return u16OperandInstruction("OP_NEWTABLE", chunk, offset);
case OP_NEWARRAY:
return u16OperandInstruction("OP_NEWARRAY", chunk, offset);
case OP_INDEX:
return simpleInstruction("OP_INDEX", offset);
case OP_NEWINDEX:
@@ -189,7 +191,7 @@ int disasmInstr(CChunk *chunk, int offset, int indent) {
return u8OperandInstruction("OP_RETURN", chunk, offset);
default:
printf("Unknown opcode! [%d]\n", i);
exit(0);
return 1;
}