Skip to content

Commit

Permalink
Yagni opcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenhombre committed Jul 28, 2023
1 parent 0fae863 commit bcb44d8
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions opcode.go
Original file line number Diff line number Diff line change
@@ -1,42 +1,15 @@
package main

const (
op_nop = iota
op_ret
op_push
op_pop
op_const
op_jump
op_plus
op_times
op_negate
op_divide
op_ret = iota
)

type opcode byte

func (o opcode) String() string {
switch o {
case op_nop:
return "NOP"
case op_ret:
return "RET"
case op_push:
return "PUSH"
case op_pop:
return "POP"
case op_const:
return "CONST"
case op_jump:
return "JUMP"
case op_plus:
return "PLUS"
case op_times:
return "TIMES"
case op_negate:
return "NEGATE"
case op_divide:
return "DIVIDE"
default:
return "UNKNOWN_OPCODE"
}
Expand Down

0 comments on commit bcb44d8

Please sign in to comment.