2021-01-17 20:33:39 +03:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum OpCode {
|
2021-02-28 15:15:46 +02:00
|
|
|
/// Push a constant onto the stack.
|
2021-01-17 20:33:39 +03:00
|
|
|
OpConstant(usize),
|
|
|
|
|
2021-02-28 15:15:46 +02:00
|
|
|
// Literal pushes
|
|
|
|
OpNil,
|
|
|
|
OpTrue,
|
|
|
|
OpFalse,
|
|
|
|
|
2021-01-17 20:33:39 +03:00
|
|
|
/// Return from the current function.
|
|
|
|
OpReturn,
|
2021-01-18 00:08:30 +03:00
|
|
|
|
2021-02-28 15:28:04 +02:00
|
|
|
// Boolean operators
|
|
|
|
OpNot,
|
|
|
|
|
2021-01-18 00:08:30 +03:00
|
|
|
/// Unary negation
|
|
|
|
OpNegate,
|
|
|
|
|
|
|
|
// Arithmetic operators
|
|
|
|
OpAdd,
|
|
|
|
OpSubtract,
|
|
|
|
OpMultiply,
|
|
|
|
OpDivide,
|
2021-01-17 20:33:39 +03:00
|
|
|
}
|