Version: v0.0.0-...-0d16973 Latest Latest

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

Go to latest
Published: Aug 10, 2021 License: MIT Imports: 10 Imported by: 0



Package interpreter contains the recipe interpreter for the machine node.



This section is empty.


View Source
var (
	// ErrCompilerConfigNil occurs if an interpreter is supplied a nil compiler config.
	ErrCompilerConfigNil = errors.New("compiler config nil")
	// ErrBadOp occurs if an interpreter is supplied an unknown opcode.
	ErrBadOp = errors.New("bad opcode")
	// ErrBadOutput occurs if an interpreter is asked to output something that isn't compatible with its output spec.
	ErrBadOutput = errors.New("bad output type")
	// ErrFileUnavailable occurs if an instruction specifies a file that has been consumed, or wasn't available.
	ErrFileUnavailable = errors.New("file not available")
	// ErrObjOverflow occurs if too many object files are created.
	ErrObjOverflow = errors.New("object file count overflow")
View Source
var ErrDriverNil = errors.New("driver nil")

ErrDriverNil occurs when the compiler tries to use the nil pointer as its single-compile driver.


This section is empty.


type Driver

type Driver interface {
	// RunCompiler runs the compiler job j.
	// If applicable, errw will be connected to the compiler's standard error.
	// Implementors should note that the paths in j are slash-paths, and will need converting to filepaths.
	RunCompiler(ctx context.Context, j compiler.Job, sr service.Runner) error

Driver is the interface of things that can run compilers.

type Interpreter

type Interpreter struct {
	// contains filtered or unexported fields

Interpreter is an interpreter for compile recipes.

func New

func New(ofile string, r recipe.Recipe, sr service.Runner, os ...Option) (*Interpreter, error)

New creates a new interpreter using the recipe r, service runner sr, options os, and output file ofile.

func (*Interpreter) Interpret

func (p *Interpreter) Interpret(ctx context.Context) error

Interpret processes this processor's compilation recipe using ctx for timeout and cancellation. It resumes from the last position where interpretation halted.

type Option

type Option func(*Interpreter)

Option is the type of options to the interpreter.

func CompileWith

func CompileWith(d Driver, c *compiler.Instance) Option

CompileWith sets the interpreter's compiler to driver d and config c. This is required to interpret recipes that involve compilation.

func Options

func Options(os ...Option) Option

Options bundles the options os into one option.

func SetMaxObjs

func SetMaxObjs(cap uint64) Option

SetMaxObjs sets the maximum number of object files the interpreter can create.


Path Synopsis

Jump to

Keyboard shortcuts

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