From e65555ca8a609952a2a688df8cd07625dfdccd30 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Thu, 29 Aug 2024 20:08:59 +1000 Subject: [PATCH] Added notes about opcodes --- .notes/opcodes.txt | 80 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .notes/opcodes.txt diff --git a/.notes/opcodes.txt b/.notes/opcodes.txt new file mode 100644 index 0000000..128f1ae --- /dev/null +++ b/.notes/opcodes.txt @@ -0,0 +1,80 @@ +The following opcodes would be embedded into the final bytecode + +=== + +//idk +EOF, PASS, ERROR, + +//general commands +READ_INTO + [register] //read from the bytecode into the stack +LOAD_INTO + [register, data] //load from the data section into the stack +ASSERT + [register, "message"] //message could be embedded, possibly in a data section +PRINT + [register] + +//can double as "assign" +ADD + [lhs, rhs, dest] +SUBTRACT + [lhs, rhs, dest] +MULTIPLY + [lhs, rhs, dest] +DIVIDE + [lhs, rhs, dest] +MODULO + [lhs, rhs, dest] + +//GT can be replaced, probably +COMPARE_EQUAL + [lhs, rhs, dest] +COMPARE_NOT + [lhs, rhs, dest] +COMPARE_LESS + [lhs, rhs, dest] +COMPARE_LESS_EQUAL + [lhs, rhs, dest] +COMPARE_GREATER + [lhs, rhs, dest] +COMPARE_GREATER_EQUAL + [lhs, rhs, dest] + +COMPARE_TRUTHY + [lhs, dest] +AND + [lhs, rhs, dest] +OR + [lhs, rhs, dest] +INVERT + [lhs, dest] + +//jump around the bytecode +JUMP + [pos] +JUMP_IF_FALSE + [pos, lhs] +FN_CALL + //push args and move +FN_RETURN + //push results and move - closures are required + + + +CONCAT? + [lhs, rhs, dest] + + +IMPORT? (as?) + +RETURN? //some kind of jump with a return value + + + +SCOPE_BEGIN? +SCOPE_END? + +cast? +rest? +index access and assign?