feat(bytecode): add opcode set
This commit is contained in:
1 parent
0cf76fb6a2
commit
3fa3ba4aba
1 file changed
+55
@@ -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]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user