Improved code generation

This commit is contained in:
2024-07-09 17:00:04 +02:00
parent 1204591cdc
commit 4386392844
23 changed files with 201 additions and 95 deletions

View File

@ -21,8 +21,8 @@ func (f *Function) TokenToRegister(t token.Token, register cpu.Register) error {
return errors.New(&errors.UnknownIdentifier{Name: name}, f.File, t.Position)
}
f.assembler.RegisterRegister(asm.MOVE, register, variable.Register)
f.useVariable(variable)
f.RegisterRegister(asm.MOVE, register, variable.Register)
return nil
case token.Number:
@ -33,7 +33,7 @@ func (f *Function) TokenToRegister(t token.Token, register cpu.Register) error {
return err
}
f.assembler.RegisterNumber(asm.MOVE, register, n)
f.RegisterNumber(asm.MOVE, register, n)
return nil
case token.String: