Documentation
¶
Index ¶
- Constants
- Variables
- func GetBuiltinByName(name string) int
- func RegisterBuiltin(name string, fn BuiltinFunction)
- func RegisterResource(obj Object) memory.Ptr
- type Array
- type Atom
- type Boolean
- type Builtin
- type BuiltinDef
- type BuiltinFunction
- type Channel
- type Closure
- type CompiledFunction
- type Environment
- type Error
- type File
- type Float
- type Function
- type Hash
- type HashKey
- type HashPair
- type Hashable
- type Integer
- type Module
- type Mutex
- type Null
- type Object
- type ObjectType
- type Pointer
- type ReturnValue
- type String
- type Thread
- type Time
Constants ¶
View Source
const ( INTEGER_OBJ = "INTEGER" FLOAT_OBJ = "FLOAT" BOOLEAN_OBJ = "BOOLEAN" NULL_OBJ = "NULL" RETURN_VALUE_OBJ = "RETURN_VALUE" ERROR_OBJ = "ERROR" FUNCTION_OBJ = "FUNCTION" STRING_OBJ = "STRING" BUILTIN_OBJ = "BUILTIN" ARRAY_OBJ = "ARRAY" HASH_OBJ = "HASH" COMPILED_FUNCTION_OBJ = "COMPILED_FUNCTION" CLOSURE_OBJ = "CLOSURE" CHANNEL_OBJ = "CHANNEL" THREAD_OBJ = "THREAD" TIME_OBJ = "TIME" MUTEX_OBJ = "MUTEX" ATOM_OBJ = "ATOM" FILE_OBJ = "FILE" POINTER_OBJ = "POINTER" MODULE_OBJ = "MODULE" )
View Source
const ( ErrCodeSyntax = "E001" ErrCodeUndefined = "E002" ErrCodeTypeMismatch = "E003" ErrCodeUncheckedError = "E004" ErrCodeRuntime = "E005" ErrCodeIndexOutOfBounds = "E006" ErrCodeInvalidOp = "E007" ErrCodeMissingArgs = "E008" ErrCodeTooManyArgs = "E009" ErrCodeSignalLaunch = "SIGNAL_LAUNCH" )
Variables ¶
View Source
var Builtins []BuiltinDef
Functions ¶
func GetBuiltinByName ¶
func RegisterBuiltin ¶
func RegisterBuiltin(name string, fn BuiltinFunction)
func RegisterResource ¶
RegisterResource stores a host object and returns a memory-backed wrapper (Address).
Types ¶
type Array ¶
func (*Array) GetAddress ¶
func (*Array) GetElements ¶
func (*Array) Type ¶
func (ao *Array) Type() ObjectType
type Boolean ¶
func NewBoolean ¶
func (*Boolean) GetAddress ¶
func (*Boolean) Type ¶
func (b *Boolean) Type() ObjectType
type Builtin ¶
type Builtin struct {
Fn BuiltinFunction
Address memory.Ptr
}
func (*Builtin) GetAddress ¶
func (*Builtin) Type ¶
func (b *Builtin) Type() ObjectType
type BuiltinDef ¶
type BuiltinFunction ¶
type Channel ¶
func NewChannel ¶
func (*Channel) GetAddress ¶
func (*Channel) Type ¶
func (c *Channel) Type() ObjectType
type Closure ¶
func NewClosure ¶
func NewClosure(fn *CompiledFunction, freeVars []Object) *Closure
func (*Closure) Fn ¶
func (c *Closure) Fn() *CompiledFunction
func (*Closure) FreeVariables ¶
func (*Closure) GetAddress ¶
func (*Closure) Type ¶
func (c *Closure) Type() ObjectType
type CompiledFunction ¶
func (*CompiledFunction) GetAddress ¶
func (cf *CompiledFunction) GetAddress() memory.Ptr
func (*CompiledFunction) Inspect ¶
func (cf *CompiledFunction) Inspect() string
func (*CompiledFunction) Instructions ¶
func (cf *CompiledFunction) Instructions() []byte
func (*CompiledFunction) NumLocals ¶
func (cf *CompiledFunction) NumLocals() int
func (*CompiledFunction) NumParameters ¶
func (cf *CompiledFunction) NumParameters() int
func (*CompiledFunction) Type ¶
func (cf *CompiledFunction) Type() ObjectType
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
func NewEnclosedEnvironment ¶
func NewEnclosedEnvironment(outer *Environment) *Environment
func NewEnvironment ¶
func NewEnvironment() *Environment
type Error ¶
func (*Error) GetAddress ¶
func (*Error) GetMessage ¶
func (*Error) Type ¶
func (e *Error) Type() ObjectType
type Function ¶
type Function struct {
Parameters []*parser.Identifier
Body *parser.BlockStatement
Env *Environment
}
func (*Function) GetAddress ¶
func (*Function) Type ¶
func (f *Function) Type() ObjectType
type HashKey ¶
type HashKey struct {
Type ObjectType
Value uint64
}
type Integer ¶
func NewInteger ¶
func (*Integer) GetAddress ¶
func (*Integer) Type ¶
func (i *Integer) Type() ObjectType
type Module ¶
func NewModule ¶
func NewModule(name string, init *CompiledFunction) *Module
func (*Module) GetAddress ¶
func (*Module) GetExports ¶
func (*Module) GetInit ¶
func (m *Module) GetInit() *CompiledFunction
func (*Module) SetExports ¶
func (*Module) Type ¶
func (m *Module) Type() ObjectType
type Object ¶
type Object interface {
Type() ObjectType
Inspect() string
GetAddress() memory.Ptr
}
func FromPtr ¶
FromPtr rehydrates an Object Wrapper from a raw Memory Pointer. It reads the Header to determine the Type.
func GetResource ¶
GetResource retrieves the host object from a memory pointer.
type ObjectType ¶
type ObjectType string
type Pointer ¶
func NewPointer ¶
func (*Pointer) GetAddress ¶
func (*Pointer) Type ¶
func (p *Pointer) Type() ObjectType
type ReturnValue ¶
type ReturnValue struct {
Value Object
}
func (*ReturnValue) GetAddress ¶
func (rv *ReturnValue) GetAddress() memory.Ptr
func (*ReturnValue) Inspect ¶
func (rv *ReturnValue) Inspect() string
func (*ReturnValue) Type ¶
func (rv *ReturnValue) Type() ObjectType
Click to show internal directories.
Click to hide internal directories.