Implemented data labels

This commit is contained in:
2024-07-13 00:13:13 +02:00
parent 7b18056006
commit 9df899cb52
18 changed files with 428 additions and 327 deletions

View File

@ -1,6 +1,7 @@
package core
import (
"fmt"
"strconv"
"git.akyoto.dev/cli/q/src/build/asm"
@ -37,7 +38,12 @@ func (f *Function) TokenToRegister(t token.Token, register cpu.Register) error {
return nil
case token.String:
return errors.New(errors.NotImplemented, f.File, t.Position)
value := t.Text()[1 : len(t.Bytes)-1]
label := fmt.Sprintf("%s_data_%d", f.Name, f.count.data)
f.assembler.Data[label] = []byte(value)
f.RegisterLabel(asm.MOVE, register, label)
f.count.data++
return nil
default:
return errors.New(errors.InvalidExpression, f.File, t.Position)