compiler

package
v0.7.16 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: EPL-1.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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