Implemented compilation to SSA form
Some checks failed
/ test (push) Failing after 31s

This commit is contained in:
Eduard Urbach 2025-06-23 00:09:52 +02:00
parent f7be86a3d9
commit d1ce1ef839
Signed by: akyoto
GPG key ID: 49226B848C78F6C8
24 changed files with 534 additions and 59 deletions

26
src/compiler/showSSA.go Normal file
View file

@ -0,0 +1,26 @@
package compiler
import (
"fmt"
"iter"
"git.urbach.dev/cli/q/src/core"
"git.urbach.dev/go/color/ansi"
)
// showSSA shows the SSA IR.
func showSSA(functions iter.Seq[*core.Function]) {
for f := range functions {
ansi.Bold.Printf("%s:\n", f.UniqueName)
for i, block := range f.Blocks {
if i != 0 {
fmt.Println("---")
}
for i, instr := range block.Instructions {
fmt.Printf("t%d = %s\n", i, instr.String())
}
}
}
}