package optimizer
import "github.com/azin-lang/Azin/internal/optimizer"
Package optimizer provides basic optimizations before transpiling to C.
Index
Functions
func Optimize
func Optimize(program *ast.Program)
Optimize is the main entry point.
Types
type Optimizer
type Optimizer struct { // contains filtered or unexported fields }
Optimizer holds the global state for the optimization pass.
func NewOptimizer
func NewOptimizer() *Optimizer
func (*Optimizer) Enter
func (o *Optimizer) Enter()
func (*Optimizer) Leave
func (o *Optimizer) Leave()
type Scope
type Scope struct { // contains filtered or unexported fields }
Scope tracks variables for a specific block (e.g., global, function, if-body).
func (*Scope) ClearAll
func (s *Scope) ClearAll()
func (*Scope) GetValue
func (s *Scope) GetValue(name string) (ast.Expr, bool)
func (*Scope) Invalidate
func (s *Scope) Invalidate(name string)
func (*Scope) MarkRead
func (s *Scope) MarkRead(name string)
func (*Scope) SetValue
func (s *Scope) SetValue(name string, val ast.Expr)