object

package
v0.0.0-...-d57dce6 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func IsPrimitive

func IsPrimitive(obj Object) bool

Types

type AST

type AST struct {
	Node ast.Node
}

func (*AST) Inspect

func (a *AST) Inspect() string

func (*AST) Kind

func (a *AST) Kind() Kind

type Array

type Array struct {
	Elements []Object
}

func (*Array) Inspect

func (array *Array) Inspect() string

func (*Array) Kind

func (array *Array) Kind() Kind

type Builtin

type Builtin struct {
	Name string
	Fn   BuiltinFn
	Type *Type
}

func (*Builtin) Inspect

func (builtin *Builtin) Inspect() string

func (*Builtin) Kind

func (*Builtin) Kind() Kind

type BuiltinFn

type BuiltinFn func(args *ast.SExp, env *Env, eval Eval) Object

type Env

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

func NewEnv

func NewEnv() *Env

func (*Env) Assign

func (env *Env) Assign(name string, value Object) *Env

func (*Env) Child

func (env *Env) Child() *Env

func (*Env) LookUp

func (env *Env) LookUp(name string) (_ Object, ok bool)

func (*Env) Names

func (env *Env) Names(yield func(string) bool)

type Error

type Error struct {
	Err error
}

func (*Error) Inspect

func (err *Error) Inspect() string

func (*Error) Kind

func (err *Error) Kind() Kind

type Eval

type Eval = func(node ast.Node, env *Env) Object

type Function

type Function struct {
	Parameters []*ast.Symbol
	Body       *ast.SExp
	Env        *Env
}

func (*Function) Inspect

func (fn *Function) Inspect() string

func (*Function) Kind

func (fn *Function) Kind() Kind

type Kind

type Kind string
const (
	ObjType      Kind = "type"
	ObjKind      Kind = "kind"
	ObjInteger   Kind = "integer"
	ObjAny       Kind = "any"
	ObjFloat64   Kind = "float64"
	ObjBool      Kind = "boolean"
	ObjString    Kind = "string"
	ObjNull      Kind = "null"
	ObjError     Kind = "error"
	ObjReturn    Kind = "return"
	ObjFunc      Kind = "function"
	ObjBuiltin   Kind = "builtin"
	ObjArray     Kind = "array"
	ObjAST       Kind = "ast"
	ObjNamespace Kind = "namespace"
)

func (Kind) Inspect

func (ot Kind) Inspect() string

func (Kind) Kind

func (ot Kind) Kind() Kind

type Namespace

type Namespace struct {
	Env *Env
}

func (*Namespace) Inspect

func (ns *Namespace) Inspect() string

func (*Namespace) Kind

func (*Namespace) Kind() Kind

type Null

type Null struct{}

func (Null) Inspect

func (Null) Inspect() string

func (Null) Kind

func (Null) Kind() Kind

type Object

type Object interface {
	Kind() Kind
	Inspect() string
}

type Ordered

type Ordered interface {
	Compare(other Object) (int, bool)
}

type Primitive

type Primitive[E PrimitiveTypes] struct {
	Value E
	// contains filtered or unexported fields
}

func PrimitiveOf

func PrimitiveOf[E PrimitiveTypes](value E) *Primitive[E]

func (*Primitive[E]) Compare

func (primitive *Primitive[E]) Compare(other Object) (_ int, ok bool)

func (*Primitive[E]) Inspect

func (primitive *Primitive[E]) Inspect() string

func (*Primitive[E]) Kind

func (primitive *Primitive[E]) Kind() Kind

type PrimitiveTypes

type PrimitiveTypes interface {
	string | int64 | float64 | bool
}

type Return

type Return struct {
	Value Object
}

func (*Return) Inspect

func (ret *Return) Inspect() string

func (*Return) Kind

func (ret *Return) Kind() Kind

type Type

type Type struct {
	ObjKind Kind
	Params  []Type
}

func TypeFor

func TypeFor(kind Kind, paramsKinds ...Kind) *Type

func (*Type) Equal

func (ot *Type) Equal(other *Type) bool

func (*Type) Inspect

func (ot *Type) Inspect() string

func (*Type) Kind

func (ot *Type) Kind() Kind

Jump to

Keyboard shortcuts

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