compiler

package
v0.7.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: EPL-1.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer struct {
	Macroexpand1 func(form interface{}) (interface{}, error)
	CreateVar    func(sym *Symbol, env Env) (interface{}, error)
	IsVar        func(v interface{}) bool
	Optimizer    *Optimizer

	Gensym func(prefix string) *Symbol

	FindNamespace func(sym *lang.Symbol) *lang.Namespace
	ResolveHost   func(sym *lang.Symbol) (interface{}, bool)
}

func (*Analyzer) Analyze

func (a *Analyzer) Analyze(form interface{}, env Env) (*ast.Node, error)

Analyze performs semantic analysis on the given s-expression, returning an AST.

type Env

type Env IPersistentMap

type OptimizationOptions added in v0.7.2

type OptimizationOptions struct {
	DirectLinking bool
}

OptimizationOptions controls rewrites whose validity depends on compiler semantics rather than only on local tree shape.

type OptimizationPass added in v0.7.2

type OptimizationPass interface {
	Name() string
	Optimize(*ast.Node) (*ast.Node, error)
}

OptimizationPass is one backend-neutral AST optimization. A pass receives the whole tree so it may perform analysis, rewriting, or multiple sweeps.

type Optimizer added in v0.7.2

type Optimizer struct {
	// contains filtered or unexported fields
}

Optimizer applies AST passes in declaration order. Each pass sees the full output of the previous pass.

func NewDefaultOptimizer added in v0.7.2

func NewDefaultOptimizer(options OptimizationOptions) *Optimizer

NewDefaultOptimizer constructs the standard backend-neutral pass pipeline.

func NewOptimizer added in v0.7.2

func NewOptimizer(passes ...OptimizationPass) *Optimizer

NewOptimizer constructs an optimizer from an ordered pass pipeline.

func (*Optimizer) Optimize added in v0.7.2

func (o *Optimizer) Optimize(root *ast.Node) (*ast.Node, error)

Optimize applies every pass to root.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL