feat(bytecode): add opcode set

This commit is contained in:
dualfroz committed 2026-08-24 12:25:00 +02:00
1 parent 0cf76fb6a2
commit 3fa3ba4aba
1 file changed
+55
+55
View File
@@ -0,0 +1,55 @@
package lumen.bytecode
enum class Opcode {
Constant,
Nil,
True,
False,
Pop,
Add,
Sub,
Mul,
Div,
Mod,
Negate,
Equal,
NotEqual,
Less,
LessEqual,
Greater,
GreaterEqual,
Not,
GetLocal,
SetLocal,
GetGlobal,
SetGlobal,
DefineGlobal,
GetUpvalue,
SetUpvalue,
Jump,
JumpIfFalse,
Loop,
Call,
Invoke,
Closure,
CloseUpvalue,
Return,
BuildList,
BuildMap,
IndexGet,
IndexSet,
GetIter,
ForIter;
companion object {
private val values = entries.toTypedArray()
fun from(ordinal: Int): Opcode = values[ordinal]
}
}