Simplified file structure

This commit is contained in:
2024-08-07 19:39:10 +02:00
parent 1b13539b22
commit 66569446b1
219 changed files with 453 additions and 457 deletions

28
src/asm/Assembler.go Normal file
View 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
}