compeval

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package compeval runs GX code at compile time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalExpr

func EvalExpr(ctx evaluator.Context, expr ir.Expr) (cpevelements.Element, error)

EvalExpr evaluates a GX expression into an interpreter element.

func EvalInt

func EvalInt(fetcher ir.Fetcher, expr ir.Expr) (int, error)

EvalInt evaluates an expression to return an int.

func EvalRank

func EvalRank(fetcher ir.Fetcher, expr ir.Expr) (ir.ArrayRank, []canonical.Canonical, error)

EvalRank evaluates an expression to build the rank of an array.

func NewOptionVariable

func NewOptionVariable(vr *ir.VarExpr) options.PackageOption

NewOptionVariable creates a package option to set a static variable of a package with its corresponding symbolic element.

Types

type CompEval

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

CompEval is the evaluator used for compilation evaluation.

func NewHostEvaluator

func NewHostEvaluator(importer ir.Importer) *CompEval

NewHostEvaluator returns a new evaluator for the host.

func (*CompEval) ArrayOps

func (ev *CompEval) ArrayOps() evaluator.ArrayOps

ArrayOps returns the implementation used for array operations.

func (*CompEval) ElementFromAtom

func (ev *CompEval) ElementFromAtom(ctx ir.Evaluator, src ir.AssignableExpr, val values.Array) (evaluator.NumericalElement, error)

ElementFromAtom returns an element from a GX value.

func (*CompEval) Importer

func (ev *CompEval) Importer() ir.Importer

Importer returns the importer used by the evaluator.

func (*CompEval) NewFunc

func (ev *CompEval) NewFunc(itp *interp.Interpreter, fn ir.PkgFunc, recv *interp.Receiver) interp.Func

NewFunc creates a new function given its definition and a receiver.

func (*CompEval) NewFuncLit added in v0.3.0

func (ev *CompEval) NewFuncLit(fitp *interp.FileScope, fn *ir.FuncLit) (interp.Func, error)

NewFuncLit creates a new function literal.

func (*CompEval) Processor

func (ev *CompEval) Processor() *processor.Processor

Processor returns the processor used to process inits and traces for compiled function.

func (*CompEval) Trace

func (ev *CompEval) Trace(ctx ir.Evaluator, call *ir.CallExpr, args []ir.Element) error

Trace register a call to the trace builtin function.

Directories

Path Synopsis
Package cpevelements provides elements for the interpreter for compeval.
Package cpevelements provides elements for the interpreter for compeval.

Jump to

Keyboard shortcuts

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