pulumi/pkg/compiler/core/backend.go
joeduffy 6dfc528ad1 Create a new core.Compiland type
This change rejiggers a few things so that we can more clearly introduce
a boundary between front- and back-end compiler phases, including sharing more,
like a diagnostics sink.  Future extensions will include backend code-generation
options.
2016-11-18 17:08:44 -08:00

24 lines
752 B
Go

// Copyright 2016 Marapongo, Inc. All rights reserved.
package core
import (
"github.com/marapongo/mu/pkg/ast"
"github.com/marapongo/mu/pkg/diag"
)
// 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 {
Diag diag.Sink // a shared diagnostics sink to use for warnings, errors, etc.
Target *ast.Target // the compilation target.
Doc *diag.Document // the document from which the root stack came.
Stack *ast.Stack // the root stack to compile.
}