Documentation
¶
Overview ¶
Package context maintains the namespaces and stack for the interpreter.
Index ¶
- type Context
- func (ctx *Context) Core() *Core
- func (ctx *Context) CurrentFrame() *Frame
- func (ctx *Context) CurrentFunc() ir.Func
- func (ctx *Context) File() *ir.File
- func (ctx *Context) PopFrame()
- func (ctx *Context) PushBlockFrame() *Frame
- func (ctx *Context) PushFuncFrame(fn ir.Func) (*Frame, error)
- func (ctx *Context) String() string
- func (ctx *Context) Sub(elts map[string]ir.Element) *Context
- type Core
- type Frame
- type Interpreter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context of an evaluation while running the interpreter. It contains the current frame stack, values of variables, and the evaluator to execute operations.
func (*Context) CurrentFrame ¶
CurrentFrame returns the current frame.
func (*Context) CurrentFunc ¶
CurrentFunc returns the current function being run.
func (*Context) PopFrame ¶
func (ctx *Context) PopFrame()
PopFrame pops the current frame from the stack.
func (*Context) PushBlockFrame ¶
PushBlockFrame pushes an empty new frame on the stack.
func (*Context) PushFuncFrame ¶
PushFuncFrame pushes a function frame to the stack.
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core contains everything in the context independent of code location.
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame in the context.
type Interpreter ¶
type Interpreter interface { // InitPkgScope initialises the namespace of a package. InitPkgScope(pkg *ir.Package, scope *scope.RWScope[ir.Element]) (ir.Element, error) // InitBuiltins initialises a namespace with GX builtins implementation. InitBuiltins(ctx *Context, scope *scope.RWScope[ir.Element]) error }
Interpreter evaluates expressions and statements given the context.