Documentation ¶
Index ¶
- Constants
- Variables
- type Array
- func (a *Array) Concat(other Object) Object
- func (a *Array) Contains(item Object) Object
- func (a *Array) ConvertType(which TypeFlag) Object
- func (a *Array) GetItem(key Object) Object
- func (a *Array) Inspect() string
- func (a *Array) Iter() <-chan Object
- func (a *Array) Length() Object
- func (a *Array) SetItem(key Object, val Object) Object
- func (a *Array) Slice(start Object, end Object) Object
- func (a *Array) Type() TypeFlag
- type Bool
- type Builtin
- type BuiltinFunction
- type Char
- type Dict
- func (d *Dict) Concat(other Object) Object
- func (d *Dict) Contains(key Object) Object
- func (d *Dict) ConvertType(which TypeFlag) Object
- func (d *Dict) GetItem(key Object) Object
- func (d *Dict) Inspect() string
- func (d *Dict) Iter() <-chan Object
- func (d *Dict) Length() Object
- func (d *Dict) SetItem(key Object, val Object) Object
- func (d *Dict) Slice(start Object, end Object) Object
- func (d *Dict) Type() TypeFlag
- type DictItem
- type Environment
- type Error
- type File
- type FileHandler
- type Float
- type Function
- type HashKey
- type Hashable
- type Int
- type Iterable
- type Lambda
- type None
- type Numeric
- type Object
- type ReturnValue
- type String
- func (s *String) Concat(other Object) Object
- func (s *String) Contains(sub Object) Object
- func (s *String) ConvertType(which TypeFlag) Object
- func (s *String) GetItem(key Object) Object
- func (s *String) Hash() HashKey
- func (s *String) Inspect() string
- func (s *String) Iter() <-chan Object
- func (s *String) Length() Object
- func (s *String) SetItem(key Object, val Object) Object
- func (s *String) Slice(start Object, end Object) Object
- func (s *String) Type() TypeFlag
- type TypeFlag
- type Variable
Constants ¶
const ( InvalidArgLenError = "Wrong number of args to function %s. Want=%d. Got=%d." ConvertTypeError = "Cannot convet type '%s' to type '%s'" )
some pre defined errors for consistency.
Variables ¶
var ( FILE = &FileHandler{} STDIN = &File{os.NewFile(uintptr(syscall.Stdin), "/dev/stdin")} STDOUT = &File{os.NewFile(uintptr(syscall.Stdout), "/dev/stdout")} STDERR = &File{os.NewFile(uintptr(syscall.Stderr), "/dev/stderr")} )
OS VARS
”””””””””””””””””””””””””””””””””””””” Singleton objects : Only one instance of these needs to be created.
var BinaryOps = make(map[string]*binaryOp)
BinaryOps : binary operations available to the user.
var ( // ZERO : is the number zero ZERO = NewInt(0) )
Functions ¶
This section is empty.
Types ¶
type Array ¶
Array : Homogeneous array object, that can store objects of any type. Array conforms to the iterable interface.
func (*Array) ConvertType ¶
ConvertType : return the conversion into the specified type
type Bool ¶
type Bool struct{ Value bool }
Bool : builtin bool type.
func (*Bool) ConvertType ¶
ConvertType : return the conversion into the specified type
type Builtin ¶
type Builtin struct { Fn BuiltinFunction Name string Info string ArgC int ArgT []string ReturnT string }
Builtin :
func (*Builtin) ConvertType ¶
ConvertType : return the conversion into the specified type
type Char ¶
type Char struct{ Value byte }
Char :
func (*Char) ConvertType ¶
ConvertType : return the conversion into the specified type
type Dict ¶
Dict :
func (*Dict) ConvertType ¶
ConvertType : return the conversion into the specified type
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment : Holds the environment variables created by the user. Pretty much a symbol table.
func InitialEnvironment ¶
func InitialEnvironment() *Environment
InitialEnvironment : Define the initial environment scope. with system variables etc.
func NewEnclosedEnvironment ¶
func NewEnclosedEnvironment(outer *Environment) *Environment
NewEnclosedEnvironment : Define a new environment scope within another.
func NewEnvironment ¶
func NewEnvironment() *Environment
NewEnvironment : Define a new environment scope.
type Error ¶
type Error struct{ Message string }
Error : builtin Error type.
func (*Error) ConvertType ¶
ConvertType : return the conversion into the specified type
type File ¶
type File struct {
// contains filtered or unexported fields
}
File : wrapper around goes file system
func (*File) ConvertType ¶
ConvertType : return the conversion into the specified type
type FileHandler ¶
type FileHandler struct{}
FileHandler :
func (*FileHandler) Create ¶
func (fh *FileHandler) Create(path string) Object
Create : return a new writable file
func (*FileHandler) Open ¶
func (fh *FileHandler) Open(path string) Object
Open : return a new readable file
type Float ¶
type Float struct{ Value float64 }
Float : builtin float type basically go's float64
func (*Float) ConvertType ¶
ConvertType : return the conversion into the specified type
type Function ¶
type Function struct { Parameters []*ast.Identifier Name string Stmts *ast.BlockStatement Env *Environment }
Function :
func (*Function) ConvertType ¶
ConvertType : return the conversion into the specified type
type Hashable ¶
type Hashable interface { Object // Hash : returns the Hashkey for the objects value Hash() HashKey }
Hashable : the requirements to enable the object to be used as a hash key.
type Int ¶
type Int struct{ Value int }
Int : builtin integer type. -9223372036854775807 and 9223372036854775807
func (*Int) ConvertType ¶
ConvertType : return the conversion into the specified type
type Iterable ¶
type Iterable interface { Object // Length : return the number of items in the iterable Length() Object // IterItems : return a iterable channel to loop through the items in // order. Iter() <-chan Object // GetItem : get item at location of the provided key. GetItem(Object) Object // SetItem : set item at location of the provided key. SetItem(Object, Object) Object // Concat : concat two iterables together. Concat(Object) Object // Contains : is item in the iterable. would use 'in' operator. Contains(Object) Object // Slice : return a slice of an iterables elements Slice(Object, Object) Object }
Iterable : the requirements needed for a Object to be an Iterable. eg: Array, String, Dict.
type Lambda ¶
type Lambda struct { Parameters []*ast.Identifier Expr ast.Expression Env *Environment }
Lambda :
func NewLambda ¶
func NewLambda(params []*ast.Identifier, expr ast.Expression, env *Environment) *Lambda
NewLambda : return new initialised instance of the object.
func (*Lambda) ConvertType ¶
ConvertType : return the conversion into the specified type
type None ¶
type None struct{}
None : builtin None type.
func (*None) ConvertType ¶
ConvertType : return the conversion into the specified type
type Object ¶
type Object interface { // Type : type which is used internally and available to the user through the // builtin 'type' function at runtime. Type() TypeFlag // Inspect : returns the value of the object. Is used to display values to // the user. Inspect() string // ConvertType : Convert an objects type into another type. The default // behavior for incompatible conversions is to return an error object. ConvertType(which TypeFlag) Object }
Object : defines the interface for the objects used in the dito programming language.
type ReturnValue ¶
type ReturnValue struct{ Value Object }
ReturnValue : Packages other objects to determine the end objects of programs.
func (*ReturnValue) ConvertType ¶
func (rv *ReturnValue) ConvertType(which TypeFlag) Object
ConvertType : return the conversion into the specified type
func (*ReturnValue) Inspect ¶
func (rv *ReturnValue) Inspect() string
Inspect : return a string representation of the objects value.
func (*ReturnValue) Type ¶
func (rv *ReturnValue) Type() TypeFlag
Type : return objects type as a string
type String ¶
type String struct {
Value string
}
String : builtin string type
func (*String) ConvertType ¶
ConvertType : return the conversion into the specified type
func (*String) Length ¶
Length : return the number of items in the String. An item is an ascii char like in C strings.
type TypeFlag ¶
type TypeFlag int
TypeFlag : type flag for what type of Dito object it is.
const ( CharType TypeFlag = iota IntType FloatType BoolType StringType ArrayType NoneType ErrorType ReturnType LambdaType BultinType FunctionType DictType FileType )
Define the strings used available to the user to describe objects. Values here will be returned when an objects type method is called.