Documentation
¶
Index ¶
- Variables
- func BasicAuth(h httprouter.Handle, requiredUser, requiredPassword string) httprouter.Handle
- func DebugInterface(a interface{})
- func HashKeyExist(hash *object.Hash, hashpair object.HashPair) bool
- func MakeStruct(typeName string, vals map[string]interface{}) interface{}
- func ParseJson(data []byte) *object.Hash
- func ParseJsonToString(data object.Object) string
- func ParseXML(file string) *object.Hash
- type Bytecode
- type CompilationScope
- type Compiler
- type EmittedInstruction
- type ServerFunction
- type Symbol
- type SymbolScope
- type SymbolTable
Constants ¶
This section is empty.
Variables ¶
var Builtins = []*object.Builtin{}
Builtins tüm builtin fonksiyonları içeren global değişken
var PreBuiltFunctions = builtins
Functions ¶
func BasicAuth ¶
func BasicAuth(h httprouter.Handle, requiredUser, requiredPassword string) httprouter.Handle
func DebugInterface ¶
func DebugInterface(a interface{})
func MakeStruct ¶
func ParseJsonToString ¶
Types ¶
type Bytecode ¶
type Bytecode struct { Instructions code.Instructions Constants []object.Object }
Bytecode contains the Instructions our Compiler generated and the Constants the Compiler evaluated
type CompilationScope ¶
type CompilationScope struct {
// contains filtered or unexported fields
}
CompilationScope - Before we start compiling a function's body (enter a new scope) we push a new CompilationScope on to the scopes stack. While compiling inside this scope, the emit method of the compiler will modify only the fields of the current CompilationScope. Once we're done compiling the function, we leave the scope by popping it off the scopes stack and putting the instructions in a new *object.CompiledFunction
type Compiler ¶
type Compiler struct {
// contains filtered or unexported fields
}
Compiler defines our compiler with instructions which hold the generated bytecode, constants which serve as our constant pool, and the last and previous instructions
func New ¶
func New() *Compiler
New creates and returns a pointer to a Compiler with initialized instructions & constants
func NewWithState ¶
func NewWithState(s *SymbolTable, constants []object.Object) *Compiler
NewWithState creates a new compiler with the passed in symbol table and constants (needed in REPL)
func (*Compiler) Bytecode ¶
Bytecode returns a pointer to a Bytecode intialized with our compilers instructions & constants
type EmittedInstruction ¶
EmittedInstruction represents an instruction through an opcode and it's position
type ServerFunction ¶
func NewServer ¶
func NewServer(name string) *ServerFunction
func (*ServerFunction) RouterGenerator ¶
func (fn *ServerFunction) RouterGenerator(obj object.Object) *ServerFunction
type Symbol ¶
type Symbol struct { Name string Scope SymbolScope Index int }
Symbol - Holds all the necessary info about a symbol - Name, Scope, and Index
type SymbolScope ¶
type SymbolScope string
SymbolScope - Type alias for a string. Used in a Symbol to define it's scope.
const ( GlobalScope SymbolScope = "GLOBAL" LocalScope SymbolScope = "LOCAL" BuiltinScope SymbolScope = "BUILTIN" FreeScope SymbolScope = "FREE" FunctionScope SymbolScope = "FUNCTION" )
Define all our scopes
type SymbolTable ¶
type SymbolTable struct { Outer *SymbolTable FreeSymbols []Symbol // contains filtered or unexported fields }
SymbolTable holds a "store" which is a map of strings to Symbols, an int of number of definitions, and "Outer" which defines it's parent scope
func NewEnclosedSymbolTable ¶
func NewEnclosedSymbolTable(outer *SymbolTable) *SymbolTable
NewEnclosedSymbolTable takes an outer parent symbol table and returns a pointer to the new enclosed SymbolTable after attaching the outer parent to the new one
func NewSymbolTable ¶
func NewSymbolTable() *SymbolTable
NewSymbolTable creates and returns a pointer to a symbol table initialized with a "store"
func (*SymbolTable) Define ¶
func (s *SymbolTable) Define(name string) Symbol
Define takes a name and creates a symbol with the name, an index, and assigns scope. It then assigns the symbol to the SymbolTable's store, increases numDefinitions and returns the symbol.
func (*SymbolTable) DefineBuiltin ¶
func (s *SymbolTable) DefineBuiltin(index int, name string) Symbol
DefineBuiltin creates and returns a symbol within builtin scope
func (*SymbolTable) DefineFunctionName ¶
func (s *SymbolTable) DefineFunctionName(name string) Symbol
DefineFunctionName creates a new Symbol with FunctionScope and adds it to the s.store