Arithmetic

This commit is contained in:
Chuck Smith
2024-01-26 12:13:23 -05:00
parent e34991c081
commit b4cc771baa
6 changed files with 111 additions and 14 deletions

View File

@@ -13,6 +13,10 @@ type Opcode byte
const (
OpConstant Opcode = iota
OpAdd
OpPop
OpSub
OpMul
OpDiv
)
type Definition struct {
@@ -23,6 +27,10 @@ type Definition struct {
var definitions = map[Opcode]*Definition{
OpConstant: {"OpConstant", []int{2}},
OpAdd: {"OpAdd", []int{}},
OpPop: {"OpPop", []int{}},
OpSub: {"OpSub", []int{}},
OpMul: {"OpMul", []int{}},
OpDiv: {"OpDiv", []int{}},
}
func Lookup(op byte) (*Definition, error) {