Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoundedType ¶
type BoundedType interface { Type MinVal() *big.Rat // MinVal returns the smallest value of this type. MaxVal() *big.Rat // MaxVal returns the largest value of this type. }
BoundedType represents a numeric type with boundaries on its value.
type CodeInstruction ¶
type CodeInstruction func(*Thread)
type DivByZeroError ¶
type DivByZeroError struct{}
DivByZeroError is used to abort a thread when a division by zero occurs.
func (DivByZeroError) Error ¶
func (DivByZeroError) Error() string
type Frame ¶
type IndexError ¶
type IndexError struct {
Idx, Len int64
}
IndexError is used to abort a thread when an indexed expression is out of bounds.
func (IndexError) Error ¶
func (e IndexError) Error() string
type KeyError ¶
type KeyError struct {
Key interface{}
}
KeyError is used to abort a thread when invalid key indices are used in a map expression.
type NegativeCapacityError ¶
type NegativeCapacityError struct {
Len int64
}
NegativeCapacityError is used to abort a thread when a negative capacity is used when creating a Slice.
func (NegativeCapacityError) Error ¶
func (e NegativeCapacityError) Error() string
type NegativeLengthError ¶
type NegativeLengthError struct {
Len int64
}
NegativeLengthError is used to abort a thread when a negative length is used when creating a Slice.
func (NegativeLengthError) Error ¶
func (e NegativeLengthError) Error() string
type NilPointerError ¶
type NilPointerError struct{}
NilPointerError is used to abort a thread when a nil pointer is dereferenced.
func (NilPointerError) Error ¶
func (NilPointerError) Error() string
type SliceError ¶
type SliceError struct {
Lo, Hi, Cap int64
}
SliceError is used to abort a thread when invalid indices are used for a slice manipulation of a Slice, Array or String.
func (SliceError) Error ¶
func (e SliceError) Error() string
type Thread ¶
type Thread struct { PC uint // Program Counter Frame *Frame // The execution frame of this function. This remains the same throughout a function invocation. // contains filtered or unexported fields }
type Type ¶
type Type interface { // Compat returns whether this type is compatible with another type. // If conv is false, this is normal compatibility, where two named types are compatible only if they are the same named type. // If conv if true, this is conversion compatibility, where two named types are conversion compatible if their definitions are conversion compatible. Compat(t Type, conv bool) bool // TODO: Deal with recursive types // Lit returns this type's literal. // If this is a named type, this is the unnamed underlying type. // Otherwise, this is an identity operation. Lit() Type // IsBoolean returns true if this is a boolean type. IsBoolean() bool // IsInteger returns true if this is an integer type. IsInteger() bool // IsFloat returns true if this is a floating type. IsFloat() bool // IsIdeal returns true if this represents an ideal value. IsIdeal() bool // Zero returns a new zero value of this type. Zero() Value // String returns the string representation of this type. String() string }
Type is the common interface for all supported types
type Value ¶
type Value interface { // String returns the string representation of this value. String() string // Assign copies another value into this one. // It should assume that the other value satisfies the same specific value interface (BoolValue, etc.), // but must not assume anything about its specific type. Assign(t *Thread, v Value) }