Documentation ¶
Index ¶
Constants ¶
const ( //INTEGER - Integer INTEGER = "INT_OBJ" //FLOAT - Float FLOAT = "FLT_OBJ" //STRING - String STRING = "STR_OBJ" //BOOLEAN - Boolean BOOLEAN = "BOOL_OBJ" //ARRAY - Array ARRAY = "ARR_OBJ" //MAP - Map MAP = "MAP_OBJ" //INDEX - Map or Array index INDEX = "IDX_OBJ" //NULL - Null value NULL = "NULL_OBJ" //RETURN - Return value of a block RETURN = "RETURN_OBJ" //FUNCTION - Function object FUNCTION = "FUNC_OBJ" //BUILTIN - Builtin function BUILTIN = "BUILTIN_OBJ" //ERROR - Error object ERROR = "ERROR_OBJ" //IDENT - Identifier IDENT = "IDENT_OBJ" //PRES - Program result PRES = "PROG_RES" //ENVIRONMENT - Environment ENVIRONMENT = "ENV_OBJ" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Boolean ¶
type Boolean struct {
Value bool
}
Boolean represents a bool
type Environment ¶
type Environment struct { Data map[string]Object Outer *Environment }
Environment represents the execution environment
func NewEnclosedEnv ¶
func NewEnclosedEnv(outer *Environment) *Environment
NewEnclosedEnv nests the provided environment inside a new one It mimics a new stack frame
func (*Environment) Display ¶
func (env *Environment) Display()
Display implements Object for Environment
func (*Environment) Get ¶
func (env *Environment) Get(ident string) (Object, bool)
Get recursively gets a variable from the environment and all its outer envs
func (*Environment) Inspect ¶
func (env *Environment) Inspect() string
Inspect implements Object for Environment
func (*Environment) Set ¶
func (env *Environment) Set(ident string, val Object) Object
Set adds a variable to the environment
func (*Environment) Type ¶
func (env *Environment) Type() string
Type implements Object for Environment
type Exception ¶
Exception - an error type to return
type Function ¶
type Function struct { Params []*ast.Identifier Body *ast.BlockStatement Env *Environment }
Function represents a function in the environment
type Hashable ¶
type Hashable interface {
HashKey() HashKey
}
Hashable defines whether a type can be used as a key in a Map
type Integer ¶
type Integer struct {
Value int64
}
Integer represents an integer
type Return ¶
type Return struct {
Inner Object
}
Return - A wrapper type for a value returned by a return statement
type StmtResults ¶
type StmtResults struct {
Results []Object
}
StmtResults is the results returned by a program
func (*StmtResults) Display ¶
func (pr *StmtResults) Display()
Display implements Object for StmtResults
func (*StmtResults) Inspect ¶
func (pr *StmtResults) Inspect() string
Inspect implements Object for StmtResults
func (*StmtResults) Type ¶
func (pr *StmtResults) Type() string
Type implements Object for StmtResults