Implemented addition
This commit is contained in:
parent
b6722c5482
commit
0657b88945
6 changed files with 78 additions and 23 deletions
|
@ -113,6 +113,16 @@ func (f *Function) CompileInstruction(line token.List) error {
|
|||
return f.CompileFunctionCall(expr)
|
||||
}
|
||||
|
||||
if expr.Token.Kind == token.Operator {
|
||||
switch expr.Token.Text() {
|
||||
case "+=":
|
||||
name := expr.Children[0].Token.Text()
|
||||
number, _ := strconv.Atoi(expr.Children[1].Token.Text())
|
||||
f.Assembler.AddRegisterNumber(f.Variables[name].Register, uint64(number))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return errors.New(&errors.InvalidInstruction{Instruction: expr.Token.Text()}, f.File, expr.Token.Position)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue