Documentation
¶
Index ¶
- func DebugBuiltinTypes()
- func RegisterAdtModule(ml *ModuleLinker)
- func RegisterBuiltinModule(ml *ModuleLinker)
- func VerifyIdempotence(prog *core.Program, registry *types.DictionaryRegistry) error
- type CompileUnit
- type CycleError
- type GlobalEnv
- type ImportedSym
- type LinkDiagnostics
- type LinkOptions
- type LinkResult
- type Linker
- func (l *Linker) AddDictionary(key string, dict core.DictValue)
- func (l *Linker) DryRun(expr core.CoreExpr) []string
- func (l *Linker) GetErrors() []error
- func (l *Linker) GetWarnings() []string
- func (l *Linker) Link(expr core.CoreExpr) (core.CoreExpr, error)
- func (l *Linker) LinkProgram(prog *core.Program, opts LinkOptions) (*core.Program, error)
- func (l *Linker) LinkWithResult(prog *core.Program, opts LinkOptions) LinkResult
- type ModuleID
- type ModuleLinker
- func (ml *ModuleLinker) BuildGlobalEnv(imports []*ast.ImportDecl) (GlobalEnv, *LinkDiagnostics, error)
- func (ml *ModuleLinker) GetIface(path string) *iface.Iface
- func (ml *ModuleLinker) GetLoadedModules() map[string]*iface.Iface
- func (ml *ModuleLinker) RegisterIface(iface *iface.Iface)
- func (ml *ModuleLinker) Resolver() *Resolver
- func (ml *ModuleLinker) TopoSortFromRoot(root string, loaded map[string]*loader.LoadedModule) ([]ModuleID, error)
- type ModuleLoader
- type Resolver
- func (r *Resolver) InvalidateAll()
- func (r *Resolver) InvalidateModule(module string)
- func (r *Resolver) RegisterCompiledModule(moduleID string, unit CompileUnit)
- func (r *Resolver) ResolveValue(ref core.GlobalRef) (eval.Value, error)
- func (r *Resolver) SetBuiltinLookup(lookup func(string) (eval.Value, bool))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugBuiltinTypes ¶
func DebugBuiltinTypes()
func RegisterAdtModule ¶
func RegisterAdtModule(ml *ModuleLinker)
RegisterAdtModule creates and registers the $adt module interface for ADT constructors
func RegisterBuiltinModule ¶
func RegisterBuiltinModule(ml *ModuleLinker)
RegisterBuiltinModule creates and registers the $builtin module interface
func VerifyIdempotence ¶
func VerifyIdempotence(prog *core.Program, registry *types.DictionaryRegistry) error
VerifyIdempotence checks that linking is idempotent
Types ¶
type CompileUnit ¶
CompileUnit represents a compiled module (shared interface to avoid circular dependency)
type CycleError ¶
CycleError represents a dependency cycle error
func (*CycleError) Error ¶
func (e *CycleError) Error() string
func (*CycleError) GetSuggestion ¶
func (e *CycleError) GetSuggestion() string
GetSuggestion returns a fix suggestion for the cycle error
type GlobalEnv ¶
type GlobalEnv map[string]*ImportedSym
GlobalEnv maps imported names to their symbol information
type ImportedSym ¶
ImportedSym represents an imported symbol with its type information
type LinkDiagnostics ¶
type LinkDiagnostics struct {
ResolutionTrace []string // Paths tried during resolution
Suggestions []string // Suggestions for fixes
}
LinkDiagnostics contains diagnostic information from linking process (separate from LinkReport which is for structured error output)
type LinkOptions ¶
type LinkOptions struct {
DryRun bool // If true, only check for errors without modifying
Verbose bool // If true, print detailed linking information
Namespace string // Default namespace for lookups (usually "prelude")
}
LinkOptions configures the linking process
type LinkResult ¶
type LinkResult struct {
Program *core.Program
Errors []error
Warnings []string
Resolved map[string]bool // Dictionary keys that were resolved
}
LinkResult contains the result of linking
type Linker ¶
type Linker struct {
// contains filtered or unexported fields
}
Linker resolves dictionary references to concrete implementations
func NewLinker ¶
func NewLinker() *Linker
NewLinker creates a new linker without a registry (for REPL)
func NewLinkerWithRegistry ¶
func NewLinkerWithRegistry(registry *types.DictionaryRegistry) *Linker
NewLinkerWithRegistry creates a new linker with the given registry
func (*Linker) AddDictionary ¶
AddDictionary adds a dictionary to the linker (for REPL)
func (*Linker) GetWarnings ¶
GetWarnings returns all linking warnings
func (*Linker) LinkProgram ¶
LinkProgram resolves all dictionary references in a Core program
func (*Linker) LinkWithResult ¶
func (l *Linker) LinkWithResult(prog *core.Program, opts LinkOptions) LinkResult
LinkWithResult performs linking and returns detailed results
type ModuleLinker ¶
type ModuleLinker struct {
// contains filtered or unexported fields
}
ModuleLinker manages module interfaces and cross-module resolution
func NewModuleLinker ¶
func NewModuleLinker(loader ModuleLoader) *ModuleLinker
NewModuleLinker creates a new module linker
func (*ModuleLinker) BuildGlobalEnv ¶
func (ml *ModuleLinker) BuildGlobalEnv(imports []*ast.ImportDecl) (GlobalEnv, *LinkDiagnostics, error)
BuildGlobalEnv constructs the global environment for imports
func (*ModuleLinker) GetIface ¶
func (ml *ModuleLinker) GetIface(path string) *iface.Iface
GetIface retrieves a module interface by path
func (*ModuleLinker) GetLoadedModules ¶
func (ml *ModuleLinker) GetLoadedModules() map[string]*iface.Iface
GetLoadedModules returns all loaded module interfaces
func (*ModuleLinker) RegisterIface ¶
func (ml *ModuleLinker) RegisterIface(iface *iface.Iface)
RegisterIface registers a module interface
func (*ModuleLinker) Resolver ¶
func (ml *ModuleLinker) Resolver() *Resolver
Resolver returns a GlobalResolver for the evaluator
func (*ModuleLinker) TopoSortFromRoot ¶
func (ml *ModuleLinker) TopoSortFromRoot(root string, loaded map[string]*loader.LoadedModule) ([]ModuleID, error)
TopoSortFromRoot performs topological sorting starting from a single root module Input: root module ID and map of already-loaded modules with their import lists Output: sorted ModuleIDs in dependency order (dependencies first)
type ModuleLoader ¶
type ModuleLoader interface {
LoadInterface(modulePath string) (*iface.Iface, error)
EvaluateExport(ref core.GlobalRef) (eval.Value, error)
}
ModuleLoader is the interface for loading and evaluating modules
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver implements GlobalResolver for the evaluator
func NewResolver ¶
func NewResolver(linker *ModuleLinker) *Resolver
NewResolver creates a new resolver backed by a module linker
func (*Resolver) InvalidateAll ¶
func (r *Resolver) InvalidateAll()
InvalidateAll clears the entire cache
func (*Resolver) InvalidateModule ¶
InvalidateModule clears the cache for a specific module
func (*Resolver) RegisterCompiledModule ¶
func (r *Resolver) RegisterCompiledModule(moduleID string, unit CompileUnit)
RegisterCompiledModule adds a compiled module for on-demand evaluation
func (*Resolver) ResolveValue ¶
ResolveValue resolves a global reference to its value