executor

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CastNumberLiteral

func CastNumberLiteral(ast Ast, to AstType) (Ast, bool)

func Execute

func Execute(ctx *ExecutionContext, ast Ast) (interface{}, error)

func ToAstType

func ToAstType(ty AstOpCodeType) AstType

TODO: BUG: `xtor.ToAstType` returns w/o checking type marker flags

func ToOpCodeType

func ToOpCodeType(ty AstType) AstOpCodeType

Types

type ExecutionContext

type ExecutionContext struct {
	RootScope       *ExecutionScope
	ModuleScope     *ExecutionScope
	LastModuleScope *ExecutionScope
	Scope           *ExecutionScope
	// contains filtered or unexported fields
}

func NewExecutionContext

func NewExecutionContext(rootScope *ExecutionScope) *ExecutionContext

func (*ExecutionContext) CaptureVariable

func (p *ExecutionContext) CaptureVariable(vi *VariableInfo, newName string) (*VariableInfo, bool)

func (*ExecutionContext) DefineVariable

func (p *ExecutionContext) DefineVariable(name string, vi VariableInfo) (*VariableInfo, bool)

func (*ExecutionContext) DummyTypeId

func (p *ExecutionContext) DummyTypeId() uint32

func (*ExecutionContext) GetRegisteredTypeInfo

func (p *ExecutionContext) GetRegisteredTypeInfo(ty tsys.TypeInfo) (tsys.TypeInfo, error)

TODO:

func (*ExecutionContext) GetTypeInfoById

func (p *ExecutionContext) GetTypeInfoById(id uint32) (tsys.TypeInfo, error)

TODO:

func (*ExecutionContext) GetTypeInfoByName

func (p *ExecutionContext) GetTypeInfoByName(name string) (tsys.TypeInfo, error)

func (*ExecutionContext) GetVariableInfo

func (p *ExecutionContext) GetVariableInfo(name string) (*VariableInfo, bool)

func (*ExecutionContext) NewTypeId

func (p *ExecutionContext) NewTypeId() uint32

func (*ExecutionContext) PopScope

func (p *ExecutionContext) PopScope() bool

func (*ExecutionContext) PushFuncScope

func (p *ExecutionContext) PushFuncScope(returnType mnem.AstOpCodeType)

func (*ExecutionContext) PushLambdaScope

func (p *ExecutionContext) PushLambdaScope(returnType mnem.AstOpCodeType)

func (*ExecutionContext) PushScope

func (p *ExecutionContext) PushScope(returnType mnem.AstOpCodeType)

func (*ExecutionContext) ResetScope

func (p *ExecutionContext) ResetScope()

type ExecutionScope

type ExecutionScope struct {
	Type       ExecutionScopeType
	ReturnType AstOpCodeType
	Dict       map[string]*VariableInfo
	Next       *ExecutionScope
	StackNext  *ExecutionScope
}

type ExecutionScopeType

type ExecutionScopeType int
const (
	//
	ExecutionScope_Normal ExecutionScopeType = iota
	//
	ExecutionScope_Function
	//
	ExecutionScope_Lambda
)

type VariableInfo

type VariableInfo struct {
	Flags AstOpCodeType
	Value interface{}
}

Implements interface Box

func (*VariableInfo) ComplexMapIndex

func (p *VariableInfo) ComplexMapIndex(k interface{}) Box

func (*VariableInfo) GetAny

func (p *VariableInfo) GetAny() interface{}

func (*VariableInfo) GetBool

func (p *VariableInfo) GetBool() bool

func (*VariableInfo) GetBytes

func (p *VariableInfo) GetBytes() []byte

func (*VariableInfo) GetFloat

func (p *VariableInfo) GetFloat() float64

func (*VariableInfo) GetInt

func (p *VariableInfo) GetInt() int64

func (*VariableInfo) GetPointer

func (p *VariableInfo) GetPointer() unsafe.Pointer

func (*VariableInfo) GetString

func (p *VariableInfo) GetString() string

func (*VariableInfo) GetUint

func (p *VariableInfo) GetUint() uint64

func (*VariableInfo) Index

func (p *VariableInfo) Index(i int) Box

func (*VariableInfo) MapIndex

func (p *VariableInfo) MapIndex(k string) Box

func (*VariableInfo) SetAny

func (p *VariableInfo) SetAny(v interface{})

func (*VariableInfo) SetBool

func (p *VariableInfo) SetBool(v bool)

func (*VariableInfo) SetBytes

func (p *VariableInfo) SetBytes(v []byte)

func (*VariableInfo) SetFloat

func (p *VariableInfo) SetFloat(v float64)

func (*VariableInfo) SetInt

func (p *VariableInfo) SetInt(v int64)

func (*VariableInfo) SetPointer

func (p *VariableInfo) SetPointer(v unsafe.Pointer)

func (*VariableInfo) SetString

func (p *VariableInfo) SetString(v string)

func (*VariableInfo) SetUint

func (p *VariableInfo) SetUint(v uint64)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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