comparisons and booleans

This commit is contained in:
Chuck Smith
2024-02-05 16:58:59 -05:00
parent b4cc771baa
commit dcc869a6e2
5 changed files with 233 additions and 6 deletions

View File

@@ -17,6 +17,11 @@ const (
OpSub
OpMul
OpDiv
OpTrue
OpFalse
OpEqual
OpNotEqual
OpGreaterThan
)
type Definition struct {
@@ -25,12 +30,17 @@ 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{}},
OpConstant: {"OpConstant", []int{2}},
OpAdd: {"OpAdd", []int{}},
OpPop: {"OpPop", []int{}},
OpSub: {"OpSub", []int{}},
OpMul: {"OpMul", []int{}},
OpDiv: {"OpDiv", []int{}},
OpTrue: {"OpTrue", []int{}},
OpFalse: {"OpFalse", []int{}},
OpEqual: {"OpEqual", []int{}},
OpNotEqual: {"OpNotEqual", []int{}},
OpGreaterThan: {"OpGreaterThan", []int{}},
}
func Lookup(op byte) (*Definition, error) {