Documentation
¶
Index ¶
- type ArrayValue
- type BooleanValue
- type Environment
- type EnvironmentStruct
- func (e *EnvironmentStruct) AssignVariable(variableName string, value RuntimeValue) RuntimeValue
- func (e *EnvironmentStruct) DeclareVariable(variableName string, value RuntimeValue, isConstant bool) RuntimeValue
- func (e *EnvironmentStruct) Environment()
- func (e *EnvironmentStruct) GetVariable(variableName string) RuntimeValue
- func (e *EnvironmentStruct) LookupVariable(variableName string) RuntimeValue
- func (e *EnvironmentStruct) ResolveVariable(variableName string) Environment
- type FunctionValue
- type NativeFunctionValue
- type NilValue
- type NumberValue
- type ReturnValue
- type RuntimeValue
- func EvaluateExpression(node ast.Expression, env Environment) RuntimeValue
- func EvaluateStatement(node ast.Statement, env Environment) RuntimeValue
- func NATIVE_BOOL_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
- func NATIVE_ECHO_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
- func NATIVE_FLOAT_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
- func NATIVE_INT_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
- func NATIVE_POP_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
- func NATIVE_PUSH_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
- func NATIVE_SHIFT_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
- func NATIVE_STRING_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
- func NATIVE_TYPEOF_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
- func NATIVE_UNSHIFT_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
- type StringValue
- type ValueTypes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayValue ¶
type ArrayValue struct {
Elements []RuntimeValue
}
func ARRAY ¶
func ARRAY(elements []RuntimeValue) *ArrayValue
func (*ArrayValue) String ¶
func (a *ArrayValue) String() string
func (*ArrayValue) Type ¶
func (a *ArrayValue) Type() ValueTypes
type BooleanValue ¶
type BooleanValue struct {
Value bool
}
func BOOLEAN ¶
func BOOLEAN(value bool) *BooleanValue
func (*BooleanValue) String ¶
func (n *BooleanValue) String() string
func (*BooleanValue) Type ¶
func (n *BooleanValue) Type() ValueTypes
type Environment ¶
type Environment interface {
Environment()
DeclareVariable(variableName string, value RuntimeValue, isConstant bool) RuntimeValue
AssignVariable(variableName string, value RuntimeValue) RuntimeValue
ResolveVariable(variableName string) Environment
GetVariable(variableName string) RuntimeValue
LookupVariable(variableName string) RuntimeValue
}
type EnvironmentStruct ¶
type EnvironmentStruct struct {
// contains filtered or unexported fields
}
func NewEnvironment ¶
func NewEnvironment(parentEnv Environment) *EnvironmentStruct
func (*EnvironmentStruct) AssignVariable ¶
func (e *EnvironmentStruct) AssignVariable(variableName string, value RuntimeValue) RuntimeValue
func (*EnvironmentStruct) DeclareVariable ¶
func (e *EnvironmentStruct) DeclareVariable(variableName string, value RuntimeValue, isConstant bool) RuntimeValue
func (*EnvironmentStruct) Environment ¶
func (e *EnvironmentStruct) Environment()
func (*EnvironmentStruct) GetVariable ¶
func (e *EnvironmentStruct) GetVariable(variableName string) RuntimeValue
func (*EnvironmentStruct) LookupVariable ¶
func (e *EnvironmentStruct) LookupVariable(variableName string) RuntimeValue
func (*EnvironmentStruct) ResolveVariable ¶
func (e *EnvironmentStruct) ResolveVariable(variableName string) Environment
type FunctionValue ¶
type FunctionValue struct {
Name string
Parameters []string
Body ast.Statement
Closure Environment
}
func FUNCTION ¶
func FUNCTION(name string, params []string, body ast.Statement, closure Environment) *FunctionValue
func (*FunctionValue) String ¶
func (f *FunctionValue) String() string
func (*FunctionValue) Type ¶
func (f *FunctionValue) Type() ValueTypes
type NativeFunctionValue ¶
type NativeFunctionValue struct {
Name string
Call func(args []RuntimeValue, env Environment) RuntimeValue
}
func NATIVE_FUNCTION ¶
func NATIVE_FUNCTION(name string, call func([]RuntimeValue, Environment) RuntimeValue) *NativeFunctionValue
func (*NativeFunctionValue) String ¶
func (n *NativeFunctionValue) String() string
func (*NativeFunctionValue) Type ¶
func (n *NativeFunctionValue) Type() ValueTypes
type NumberValue ¶
type NumberValue struct {
Value float64
}
func (*NumberValue) String ¶
func (n *NumberValue) String() string
func (*NumberValue) Type ¶
func (n *NumberValue) Type() ValueTypes
type ReturnValue ¶
type ReturnValue struct {
Value RuntimeValue
}
func (*ReturnValue) String ¶
func (r *ReturnValue) String() string
func (*ReturnValue) Type ¶
func (r *ReturnValue) Type() ValueTypes
type RuntimeValue ¶
type RuntimeValue interface {
Type() ValueTypes
String() string
}
func EvaluateExpression ¶
func EvaluateExpression(node ast.Expression, env Environment) RuntimeValue
func EvaluateStatement ¶
func EvaluateStatement(node ast.Statement, env Environment) RuntimeValue
func NATIVE_BOOL_FUNCTION ¶
func NATIVE_BOOL_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
func NATIVE_ECHO_FUNCTION ¶
func NATIVE_ECHO_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
func NATIVE_FLOAT_FUNCTION ¶
func NATIVE_FLOAT_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
func NATIVE_INT_FUNCTION ¶
func NATIVE_INT_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
func NATIVE_POP_FUNCTION ¶
func NATIVE_POP_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
func NATIVE_PUSH_FUNCTION ¶
func NATIVE_PUSH_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
func NATIVE_SHIFT_FUNCTION ¶
func NATIVE_SHIFT_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
func NATIVE_STRING_FUNCTION ¶
func NATIVE_STRING_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
func NATIVE_TYPEOF_FUNCTION ¶
func NATIVE_TYPEOF_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
func NATIVE_UNSHIFT_FUNCTION ¶
func NATIVE_UNSHIFT_FUNCTION(args []RuntimeValue, env Environment) RuntimeValue
type StringValue ¶
type StringValue struct {
Value string
}
func (*StringValue) String ¶
func (n *StringValue) String() string
func (*StringValue) Type ¶
func (n *StringValue) Type() ValueTypes
type ValueTypes ¶
type ValueTypes string
const ( BOOLEAN_VALUE ValueTypes = "boolean" NIL_VALUE ValueTypes = "nil" NUMBER_VALUE ValueTypes = "number" STRING_VALUE ValueTypes = "string" ARRAY_VALUE ValueTypes = "array" FUNCTION_VALUE ValueTypes = "function" NATIVE_FUNCTION_VALUE ValueTypes = "native_function" )
Click to show internal directories.
Click to hide internal directories.