Something went wrong. Try again.
🌱 A minimal programming language and compiler. git.urbach.dev/cli/q
high-performance programming-language compiler
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536package core
import ( "git.urbach.dev/cli/q/src/ast")
// Compile translates tokens to SSA form.func (f *Function) Compile() { err := f.compileInputs()
if err != nil { f.Err = err return }
// From the body tokens we generate the AST which is // a list of top-level instructions. tree, err := ast.Parse(f.Body(), f.File)
if err != nil { f.Err = err return }
// Compile the AST nodes to SSA form. // This evaluates expressions and adds their SSA values // to basic blocks in the intermediate representation. err = f.compileAST(tree)
if err != nil { f.Err = err return }
f.Err = f.optimize()}