Added define operator

This commit is contained in:
Eduard Urbach 2024-06-15 11:36:57 +02:00
parent 06d16b48da
commit a4ecaf0622
Signed by: eduard
GPG key ID: 49226B848C78F6C8
9 changed files with 51 additions and 51 deletions

View file

@ -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
}