Added define operator
This commit is contained in:
parent
06d16b48da
commit
a4ecaf0622
9 changed files with 51 additions and 51 deletions
|
@ -5,15 +5,5 @@ import "fmt"
|
|||
// Instruction represents a single instruction which can be converted to machine code.
|
||||
type Instruction struct {
|
||||
Mnemonic Mnemonic
|
||||
Data interface{}
|
||||
}
|
||||
|
||||
// String returns a human readable version.
|
||||
func (x *Instruction) String() string {
|
||||
switch data := x.Data.(type) {
|
||||
case RegisterNumber:
|
||||
return fmt.Sprintf("%s %s, %x", x.Mnemonic, data.Register, data.Number)
|
||||
default:
|
||||
return x.Mnemonic.String()
|
||||
}
|
||||
Data fmt.Stringer
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue