Implemented if statements
This commit is contained in:
parent
c139dced9e
commit
962a362578
16 changed files with 280 additions and 14 deletions
|
@ -3,13 +3,14 @@ package core
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/build/asm"
|
||||
"git.akyoto.dev/cli/q/src/build/ast"
|
||||
)
|
||||
|
||||
// CompileLoop compiles a loop instruction.
|
||||
func (f *Function) CompileLoop(loop *ast.Loop) error {
|
||||
label := fmt.Sprintf("%s_loop_%d", f.Name, f.count.loop)
|
||||
f.assembler.Label(label)
|
||||
f.assembler.Label(asm.LABEL, label)
|
||||
defer f.assembler.Jump(label)
|
||||
f.count.loop++
|
||||
return f.CompileAST(loop.Body)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue