import "robpike.io/ivy/exec"
context.go function.go opdef.go operator.go
NewContext returns a new execution context: the stack and variables, plus the execution configuration.
Predefined reports whether the operator is predefined, a built-in.
type Context struct { // Stack is a stack of symbol tables, one entry per function (op) invocation, // plus the 0th one at the base. Stack []Symtab // UnaryFn maps the names of unary functions (ops) to their implemenations. UnaryFn map[string]*Function // BinaryFn maps the names of binary functions (ops) to their implemenations. BinaryFn map[string]*Function // Defs is a list of defined ops, in time order. It is used when saving the // Context to a file. Defs []OpDef // contains filtered or unexported fields }
Context holds execution context, specifically the binding of names to values and operators. It is the only implementation of ../value/Context, but since it references the value package, there would be a cycle if that package depended on this type definition.
Assign assigns the variable the value. The variable must be defined either in the current function or globally. Inside a function, new variables become locals.
Declare makes the name a variable while parsing the next function.
Define defines the function and installs it. It also performs some error checking and adds the function to the sequencing information used by the save method.
DefinedBinary reports whether the operator is a known binary.
DefinedOp reports whether the operator is known.
DefinedUnary reports whether the operator is a known unary.
Eval evaluates a list of expressions.
EvalBinary evaluates a binary operator, including products.
EvalUnary evaluates a unary operator, including reductions and scans.
ForgetAll forgets the declared variables.
Lookup returns the value of a symbol.
SetConstants re-assigns the fundamental constant values using the current setting of floating-point precision.
Function represents a unary or binary user-defined operator.
OpDef is just a record of an op's name and arg count. It is held in execContext.defs to control writing the ops out in the right order during save. See comment above.
Symtab is a symbol table, a map of names to values.
Package exec imports 4 packages (graph) and is imported by 6 packages. Updated 2020-06-28. Refresh now. Tools for package owners.