compiler

package
Version: v0.0.0-...-46d7da7 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package compiler implements a compiler that converts Mixer's expression language into a Mixer IL-based program that can be executed via an interpreter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(text string, finder ast.AttributeDescriptorFinder, functions map[string]ast.FunctionMetadata) (*il.Program, error)

Compile converts the given expression text, into an IL based program.

Types

type Compiler

type Compiler struct {
	// contains filtered or unexported fields
}

Compiler is a stateful compiler that can be used to gradually build an il.Program out of multiple independent compilation of expressions.

func New

New returns a new compiler instance.

func (*Compiler) CompileExpression

func (c *Compiler) CompileExpression(text string) (uint32, descriptor.ValueType, error)

CompileExpression creates a new parameterless IL function, using the given expression text as its body. Upon success, it returns the id of the generated function.

func (*Compiler) Program

func (c *Compiler) Program() *il.Program

Program returns the program instance that is being built by this compiler.

type Result

type Result struct {
	Program    *il.Program
	Expression *ast.Expression
}

Result is returned as the result of compilation.

Source Files

Jump to

Keyboard shortcuts

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