comparisons and booleans
This commit is contained in:
22
code/code.go
22
code/code.go
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user