e02921dc35
This change completes the implementation of dependency and type binding. The top-level change here is that, during the first semantic analysis AST walk, we gather up all unknown dependencies. Then the compiler resolves them, caching the lookups to ensure that we don't load the same stack twice. Finally, during the second and final semantic analysis AST walk, we populate the bound nodes by looking up what the compiler resolved for us.
21 lines
553 B
Go
21 lines
553 B
Go
// Copyright 2016 Marapongo, Inc. All rights reserved.
|
|
|
|
package core
|
|
|
|
import (
|
|
"github.com/marapongo/mu/pkg/ast"
|
|
)
|
|
|
|
// Backend represents the last phase during compilation; it handles code-generation and emission.
|
|
type Backend interface {
|
|
Phase
|
|
// CodeGen lowers and emits code for the given target and stack.
|
|
CodeGen(comp Compiland)
|
|
}
|
|
|
|
// Compiland contains all of settings passed from front-end to back-end compiler phases.
|
|
type Compiland struct {
|
|
Cluster *ast.Cluster // the target cluster.
|
|
Stack *ast.Stack // the root stack to compile.
|
|
}
|