Simplified file structure
This commit is contained in:
28
src/asm/Assembler.go
Normal file
28
src/asm/Assembler.go
Normal file
@ -0,0 +1,28 @@
|
||||
package asm
|
||||
|
||||
import (
|
||||
"maps"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/data"
|
||||
)
|
||||
|
||||
// Assembler contains a list of instructions.
|
||||
type Assembler struct {
|
||||
Data data.Data
|
||||
Instructions []Instruction
|
||||
}
|
||||
|
||||
// Merge combines the contents of this assembler with another one.
|
||||
func (a *Assembler) Merge(b Assembler) {
|
||||
maps.Copy(a.Data, b.Data)
|
||||
a.Instructions = append(a.Instructions, b.Instructions...)
|
||||
}
|
||||
|
||||
// SetData sets the data for the given label.
|
||||
func (a *Assembler) SetData(label string, bytes []byte) {
|
||||
if a.Data == nil {
|
||||
a.Data = data.Data{}
|
||||
}
|
||||
|
||||
a.Data[label] = bytes
|
||||
}
|
Reference in New Issue
Block a user